diff options
author | Sven Gothel <[email protected]> | 2021-07-01 06:21:25 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-07-01 06:21:25 +0200 |
commit | 81dc51e171a542f2534e9a3cb8c9bfbe6245a83b (patch) | |
tree | 3a9a94c14e9be8d5dfd9e535efc4fdfcd3c0f977 /stage2 | |
parent | f44f5a676b1c621f451550d77ed0ce75d5696dce (diff) |
ro: Move overlay handling stage1 -> stage2 (creation, as overlay_mount is located there already)
Diffstat (limited to 'stage2')
-rwxr-xr-x | stage2/01-sys-tweaks/01-run.sh | 14 | ||||
-rwxr-xr-x | stage2/01-sys-tweaks/files/overlay_mount | 19 |
2 files changed, 28 insertions, 5 deletions
diff --git a/stage2/01-sys-tweaks/01-run.sh b/stage2/01-sys-tweaks/01-run.sh index ff5bc4d..139154a 100755 --- a/stage2/01-sys-tweaks/01-run.sh +++ b/stage2/01-sys-tweaks/01-run.sh @@ -36,6 +36,20 @@ else systemctl disable ssh fi systemctl enable regenerate_ssh_host_keys + +mkdir -p /data/overlay_a +cd /data/overlay_a +mkdir -p etc/upper etc/work home/upper home/work srv/upper srv/work tmp/upper tmp/work var/upper var/work + +mkdir -p /data/overlay_b +cd /data/overlay_b +mkdir -p etc/upper etc/work home/upper home/work srv/upper srv/work tmp/upper tmp/work var/upper var/work + +cd /data +ln -s overlay_a overlay + +systemctl enable overlay_mount + EOF if [ "${USE_QEMU}" = "1" ]; then diff --git a/stage2/01-sys-tweaks/files/overlay_mount b/stage2/01-sys-tweaks/files/overlay_mount index f2e7e1e..0ecbcce 100755 --- a/stage2/01-sys-tweaks/files/overlay_mount +++ b/stage2/01-sys-tweaks/files/overlay_mount @@ -12,11 +12,20 @@ case "$1" in start) log_daemon_msg "Starting overlay_mount" /bin/mount -t ext4 DATADEV -odefaults,noatime /data && - /bin/mount -t overlay overlay -odefaults,noatime,lowerdir=/etc,upperdir=/data/etc/upper,workdir=/data/etc/work /etc && - /bin/mount -t overlay overlay -odefaults,noatime,lowerdir=/home,upperdir=/data/home/upper,workdir=/data/home/work /home && - /bin/mount -t overlay overlay -odefaults,noatime,lowerdir=/srv,upperdir=/data/srv/upper,workdir=/data/srv/work /srv && - /bin/mount -t overlay overlay -odefaults,noatime,lowerdir=/tmp,upperdir=/data/tmp/upper,workdir=/data/tmp/work /tmp && - /bin/mount -t overlay overlay -odefaults,noatime,lowerdir=/var,upperdir=/data/var/upper,workdir=/data/var/work /var && + if [ -f /data/overlay/ERASE ]; then \ + log_progress_msg "erasing overlay" ; \ + rm -f /data/overlay/ERASE ; \ + cd /data/overlay ; \ + rm -rf etc home srv tmp var ; \ + mkdir -p etc/upper etc/work home/upper home/work srv/upper srv/work tmp/upper tmp/work var/upper var/work ; \ + else \ + log_progress_msg "keeping overlay" ; \ + fi && + /bin/mount -t overlay overlay -odefaults,noatime,lowerdir=/etc,upperdir=/data/overlay/etc/upper,workdir=/data/overlay/etc/work /etc && + /bin/mount -t overlay overlay -odefaults,noatime,lowerdir=/home,upperdir=/data/overlay/home/upper,workdir=/data/overlay/home/work /home && + /bin/mount -t overlay overlay -odefaults,noatime,lowerdir=/srv,upperdir=/data/overlay/srv/upper,workdir=/data/overlay/srv/work /srv && + /bin/mount -t overlay overlay -odefaults,noatime,lowerdir=/tmp,upperdir=/data/overlay/tmp/upper,workdir=/data/overlay/tmp/work /tmp && + /bin/mount -t overlay overlay -odefaults,noatime,lowerdir=/var,upperdir=/data/overlay/var/upper,workdir=/data/overlay/var/work /var && log_end_msg $? ;; *) |