diff --git a/usr/lib/archboot/login.sh b/usr/lib/archboot/login.sh index 28b96a200..80c72f3e4 100644 --- a/usr/lib/archboot/login.sh +++ b/usr/lib/archboot/login.sh @@ -26,21 +26,23 @@ _local_mode () { # fstrim for manual action # it needs some seconds to get RAM free on delete! _switch_root_zram() { -clear -echo -e "Moving \e[1mrootfs\e[m to btrfs on 4G \e[1m/dev/zram0\e[m. This needs some time..." -[[ -d /sysroot ]] || mkdir /sysroot -modprobe zram &>/dev/null -modprobe zstd &>/dev/null -sleep 3 -echo "zstd" >/sys/block/zram0/comp_algorithm -echo "4G" >/sys/block/zram0/disksize -mkfs.btrfs /dev/zram0 &>/dev/null -mount -o discard /dev/zram0 /sysroot &>/dev/null -rsync -aAXv --numeric-ids \ ---exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/sysroot/*"} \ -"/" "/sysroot" / /sysroot &>/dev/null -touch /etc/initrd-release -systemctl start initrd-switch-root +if ! [[ -e "/.switch_root" ]]; then + touch /.switch_root + clear + echo -e "Moving \e[1mrootfs\e[m to btrfs on 4G \e[1m/dev/zram0\e[m. This needs some time..." + [[ -d /sysroot ]] || mkdir /sysroot + modprobe zram &>/dev/null + modprobe zstd &>/dev/null + echo "zstd" >/sys/block/zram0/comp_algorithm + echo "4G" >/sys/block/zram0/disksize + mkfs.btrfs /dev/zram0 &>/dev/null + mount -o discard /dev/zram0 /sysroot &>/dev/null + rsync -aAXv --numeric-ids \ + --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/sysroot/*"} \ + "/" "/sysroot" / /sysroot &>/dev/null + touch /etc/initrd-release + systemctl start initrd-switch-root +fi } _enter_shell() { diff --git a/usr/share/archboot/base/init b/usr/share/archboot/base/init index 41025ded8..4a37bb673 100755 --- a/usr/share/archboot/base/init +++ b/usr/share/archboot/base/init @@ -35,7 +35,6 @@ setfont consolefont.psf.gz -C /dev/console echo -e "\e[1mStep 1/4:\e[m Creating /dev/zram0 with zstd compression..." modprobe zram &>/dev/null modprobe zstd &>/dev/null -read -r -t 3 echo "zstd" >/sys/block/zram0/comp_algorithm echo "4G" >/sys/block/zram0/disksize echo -e "\e[1mStep 2/4:\e[m Creating btrfs on /dev/zram0..."