blob: 01470fff3c6b8f4ed5e4a6fdd999856282c9556d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# set -o xtrace
create_ramdisk () {
ORIGINAL="${1}"
RAMDISK="${ORIGINAL}_ram"
SIZE="${2}"
echo "Creating ramdisk for ${1} of size ${SIZE}..."
mount -t tmpfs -o size="${SIZE}" tmpfs "${RAMDISK}"
rsync -a --exclude="swap" --exclude="apt" --exclude="dpkg" --exclude=".mozilla" "${ORIGINAL}/" "${RAMDISK}/"
mount --bind "${RAMDISK}" "${ORIGINAL}"
}
echo "Creating ramdisks..."
create_ramdisk "/var" "192M"
create_ramdisk "/etc" "16M"
create_ramdisk "/tmp" "64M"
# bind mount / so that we can get to the real /var and /etc
mount --bind / /root_bypass_ramdisks
# allow to cups server to save configuration file of printers
mount --bind /root_bypass_ramdisks/etc/cups /root_bypass_ramdisks/etc/cups
mount -o remount,rw /root_bypass_ramdisks/etc/cups /root_bypass_ramdisks/etc/cups
|