mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
only rune one switch_root process
This commit is contained in:
parent
4462268f58
commit
d5ffaa60ab
2 changed files with 17 additions and 16 deletions
|
@ -26,21 +26,23 @@ _local_mode () {
|
|||
# fstrim <mountpoint> 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() {
|
||||
|
|
|
@ -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..."
|
||||
|
|
Loading…
Reference in a new issue