| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | set -o errexit |
| 3 | set -o nounset |
| 4 | set -o pipefail |
| 5 | # set -o xtrace |
| 6 | |
| 7 | create_ramdiskscip-shell shell shell-project 0.0.0 create_ramdisk(). () { |
| 8 | ORIGINAL="${1}" |
| 9 | RAMDISK="${ORIGINAL}_ram" |
| 10 | SIZE="${2}" |
| 11 | echoscip-shell system . . echo. "Creating ramdisk for ${1} of size ${SIZE}..." |
| 12 | |
| 13 | mountscip-shell system . . mount. -t tmpfs -o size="${SIZE}" tmpfs "${RAMDISK}" |
| 14 | rsyncscip-shell system . . rsync. -a --exclude="swap" --exclude="apt" --exclude="dpkg" --exclude=".mozilla" "${ORIGINAL}/" "${RAMDISK}/" |
| 15 | mountscip-shell system . . mount. --bind "${RAMDISK}" "${ORIGINAL}" |
| 16 | } |
| 17 | |
| 18 | echoscip-shell system . . echo. "Creating ramdisks..." |
| 19 | # Note: As of 2025 we are using 2 Gb ram rpi4 as basic IoT Boxes. |
| 20 | # The 2 Gb limit applies here |
| 21 | create_ramdiskscip-shell shell shell-project 0.0.0 create_ramdisk(). "/varscip-shell filesystem . . `/var`." "512M" |
| 22 | create_ramdiskscip-shell shell shell-project 0.0.0 create_ramdisk(). "/etcscip-shell filesystem . . `/etc`." "64M" |
| 23 | create_ramdiskscip-shell shell shell-project 0.0.0 create_ramdisk(). "/tmpscip-shell filesystem . . `/tmp`." "1G" # big size necessary for chromium kiosk usage |
| 24 | |
| 25 | # bind mount / so that we can get to the real /var and /etc |
| 26 | mountscip-shell system . . mount. --bind /scip-shell filesystem . . `/`. /root_bypass_ramdisksscip-shell filesystem . . `/root_bypass_ramdisks`. |
| 27 | |
| 28 | # allow to cups server to save configuration file of printers |
| 29 | mountscip-shell system . . mount. --bind /root_bypass_ramdisks/etc/cupsscip-shell filesystem . . `/root_bypass_ramdisks/etc/cups`. /root_bypass_ramdisks/etc/cupsscip-shell filesystem . . `/root_bypass_ramdisks/etc/cups`. |