better logic in switch root

This commit is contained in:
Tobias Powalowski 2022-06-02 16:23:39 +02:00
parent 81a3b4476d
commit 84cedb6317
2 changed files with 5 additions and 5 deletions

View file

@ -9,7 +9,6 @@
. /usr/lib/archboot/gnome-wayland.sh
. /usr/lib/archboot/kde.sh
. /usr/lib/archboot/kde-wayland.sh
_W_DIR="/archboot"
[[ -z "${1}" ]] && usage
_RUN_OPTION="$1"
@ -41,7 +40,7 @@ _zram_initialize
if [[ "${_L_COMPLETE}" == "1" || "${_L_INSTALL_COMPLETE}" == "1" ]]; then
_update_installer_check
touch /.update-installer
if ! [[ -e /etc/profile.d/zz-00-archboot ]]; then
if ! [[ -e /.archboot_container ]]; then
echo -e "\033[1mStep 1/2:\033[0m Removing not necessary files from / ..."
_clean_archboot
echo -e "\033[1mStep 2/3:\033[0m Generating archboot container in ${_W_DIR} ..."
@ -49,10 +48,10 @@ if [[ "${_L_COMPLETE}" == "1" || "${_L_INSTALL_COMPLETE}" == "1" ]]; then
_create_container || exit 1
cp -r /etc ${_W_DIR}/
cp /usr/bin/update-installer.sh ${_W_DIR}/usr/bin/
echo "update-installer.sh ${_RUN_OPTION}" > ${_W_DIR}/etc/profile.d/zz-00-archboot.sh
touch ${_W_DIR}/.archboot_container
systemctl stop dbus
echo -e "\033[1mStep 3/3:\033[0m Switching to new root ${_W_DIR} ..."
#mount -o bind ${_W_DIR} ${_W_DIR}
mount -o bind ${_W_DIR} ${_W_DIR}
systemctl switch-root ${_W_DIR}
fi
[[ ${_RUNNING_ARCH} == "x86_64" ]] && _kver_x86

View file

@ -138,9 +138,10 @@ _zram_initialize() {
if [[ "\$(tty)" == "$(tty)" ]]; then
clear
update-installer.sh ${_RUN_OPTION}
rm /etc/profile.d/zz-01-archboot.sh
fi
EOF
# motd not needed anymore
rm /etc/motd
echo -e "\033[1mStep 5/7:\033[0m Copying initramfs to /new_root ..."
echo -e " This takes some time ..."
tar -C / --exclude="./dev/*" --exclude="./proc/*" --exclude="./sys/*" --exclude="./tmp/*" --exclude="./run/*"\