mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
update initialize zram
This commit is contained in:
parent
947e852a31
commit
c987a4d4dc
1 changed files with 12 additions and 4 deletions
|
@ -116,6 +116,7 @@ _update_installer_check() {
|
||||||
|
|
||||||
_zram_initialize() {
|
_zram_initialize() {
|
||||||
_ZRAM_ALGORITHM=${_ZRAM_ALGORITHM:-"zstd"}
|
_ZRAM_ALGORITHM=${_ZRAM_ALGORITHM:-"zstd"}
|
||||||
|
_ZRAM_SIZE=${_ZRAM_SIZE:-"3500M"}
|
||||||
if ! grep -q zram /proc/mounts; then
|
if ! grep -q zram /proc/mounts; then
|
||||||
echo -e "Moving / to /dev/zram0 ..."
|
echo -e "Moving / to /dev/zram0 ..."
|
||||||
echo -e "This will need some time ..."
|
echo -e "This will need some time ..."
|
||||||
|
@ -124,14 +125,21 @@ _zram_initialize() {
|
||||||
echo ${_ZRAM_SIZE} > /sys/block/zram0/disksize
|
echo ${_ZRAM_SIZE} > /sys/block/zram0/disksize
|
||||||
mkfs.btrfs -q --mixed /dev/zram0 > /dev/tty7 2>&1
|
mkfs.btrfs -q --mixed /dev/zram0 > /dev/tty7 2>&1
|
||||||
mount -o discard /dev/zram0 /new_root
|
mount -o discard /dev/zram0 /new_root
|
||||||
echo "update-installer.sh ${_RUN_OPTION}" > /etc/profile.d/zz-01-archboot.sh
|
cat << EOF /etc/profile.d/zz-01-archboot.sh
|
||||||
|
[[ -z $TTY ]] && TTY=$(tty)
|
||||||
|
TTY=${TTY#/dev/}
|
||||||
|
clear
|
||||||
|
if [[ "${TTY}" == "tty1" ]]; then
|
||||||
|
update-installer.sh ${_RUN_OPTION}
|
||||||
|
rm /etc/profile.d/zz-01-archboot.sh
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
# copy running root to /new_root
|
||||||
tar -C / --exclude="./dev/*" --exclude="./proc/*" --exclude="./sys/*" --exclude="./tmp/*" --exclude="./run/*"\
|
tar -C / --exclude="./dev/*" --exclude="./proc/*" --exclude="./sys/*" --exclude="./tmp/*" --exclude="./run/*"\
|
||||||
--exclude="./mnt/*" --exclude="./media/*" --exclude="./lost+found" --exclude="./new_root/*" -clpf - . | tar -C /new_root -xlspf -
|
--exclude="./mnt/*" --exclude="./media/*" --exclude="./lost+found" --exclude="./new_root/*" -clpf - . | tar -C /new_root -xlspf -
|
||||||
|
# stop dbus before switching, else 90 seonds hang appaers
|
||||||
systemctl stop dbus
|
systemctl stop dbus
|
||||||
systemctl switch-root /new_root
|
systemctl switch-root /new_root
|
||||||
else
|
|
||||||
echo -e "/ already moved to /dev/zram0 ..."
|
|
||||||
rm /etc/profile.d/zz-01-archboot.sh
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue