preserve basic setup with kexec

This commit is contained in:
Tobias Powalowski 2023-07-17 21:33:52 +02:00
parent ac8c8a9c63
commit 51c28a215e
5 changed files with 39 additions and 7 deletions

View file

@ -25,7 +25,7 @@ _localize_menu() {
_localize() { _localize() {
_dialog --infobox "Localization set to ${_LOCALE}.UTF-8..." 3 50 _dialog --infobox "Localization set to ${_LOCALE}.UTF-8..." 3 50
echo "LANG=${_LOCALE}.UTF-8" > /etc/locale.conf echo "LANG=${_LOCALE}.UTF-8" > /etc/locale.conf
echo "LANG=${_LOCALE}.UTF-8" > /tmp/.localize echo "LANG=${_LOCALE}.UTF-8" > /.localize
echo LC_COLLATE=C >> /etc/locale.conf echo LC_COLLATE=C >> /etc/locale.conf
localectl set-locale "${_LOCALE}.UTF-8" &>/dev/null localectl set-locale "${_LOCALE}.UTF-8" &>/dev/null
sed -i -e "s:^[a-z]:#&:g" /etc/locale.gen sed -i -e "s:^[a-z]:#&:g" /etc/locale.gen

View file

@ -174,6 +174,8 @@ _network() {
else else
for i in ${_PROXIES}; do for i in ${_PROXIES}; do
export "${i}"="${_PROXY}" export "${i}"="${_PROXY}"
echo "export ${i}=${_PROXY}" >> /etc/profile.d/proxy.sh
chmod a+x "${_DESTDIR}"/etc/profile.d/proxy.sh
done done
fi fi
if [[ -e /etc/systemd/network/10-wired-auto-dhcp.network ]]; then if [[ -e /etc/systemd/network/10-wired-auto-dhcp.network ]]; then

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
# created by Tobias Powalowski <tpowa@archlinux.org> # created by Tobias Powalowski <tpowa@archlinux.org>
LANG=C LANG=C
_ANSWER="/tmp/.$(basename ${0})" _ANSWER="/.$(basename ${0})"
_RUNNING_ARCH="$(uname -m)" _RUNNING_ARCH="$(uname -m)"
_LOG="/dev/tty7" _LOG="/dev/tty7"
_NO_LOG="/dev/null" _NO_LOG="/dev/null"

View file

@ -69,11 +69,8 @@ _auto_network()
chroot "${_DESTDIR}" systemctl enable systemd-resolved &>"${_NO_LOG}" chroot "${_DESTDIR}" systemctl enable systemd-resolved &>"${_NO_LOG}"
fi fi
# copy proxy settings # copy proxy settings
if [[ -n "${_PROXY}" ]]; then if [[ -e "/etc/profile.d/proxy.sh" ]]; then
for i in ${_PROXIES}; do cp /etc/profile.d/proxy.sh "${_DESTDIR}"/etc/profile.d/proxy.sh
echo "export ${i}=${_PROXY}" >> "${_DESTDIR}"/etc/profile.d/proxy.sh
chmod a+x "${_DESTDIR}"/etc/profile.d/proxy.sh
done
fi fi
sleep 2 sleep 2
} }

View file

@ -401,6 +401,39 @@ _new_environment() {
systemctl start initrd-cleanup.service systemctl start initrd-cleanup.service
systemctl start initrd-switch-root.target systemctl start initrd-switch-root.target
fi fi
# copy configs to new container
if [[ -e '/.localize' ]]; then
cp /etc/locale.gen "${_W_DIR}"/tmp/etc
cp /etc/locale.conf "${_W_DIR}"/tmp/etc
cp /.localize "${_W_DIR}"/tmp/
${_NSPAWN} "${_W_DIR}" /bin/bash -c "locale-gen"
fi
if [[ -e '/.vconsole' ]]; then
cp /etc/vconsole "${_W_DIR}"/tmp/etc
cp /.vconsole "${_W_DIR}"/tmp/
fi
if [[ -e '/.clock' ]]; then
cp -a /etc/{adjtime,localtime} "${_W_DIR}"/tmp/etc
${_NSPAWN} "${_W_DIR}" /bin/bash -c "systemctl enable systemd-timesyncd.service;timedatectl set-ntp 1"
cp /.vconsole "${_W_DIR}"/tmp/
fi
if [[ -e '/.network' ]]; then
cp -r /var/lib/iwd "${_W_DIR}"/tmp/var/lib
${_NSPAWN} "${_W_DIR}" /bin/bash -c "systemctl enable iwd"
cp /etc/systemd/network/* "${_W_DIR}"/tmp//etc/systemd/network/
${_NSPAWN} "${_W_DIR}" /bin/bash -c "systemctl enable systemd-networkd"
${_NSPAWN} "${_W_DIR}" /bin/bash -c "systemctl enable systemd-resolved"
rm "${_W_DIR}"/tmp/etc/systemd/network/10-wired-auto-dhcp.network
[[ -e '/etc/profile.d/proxy.sh' ]] && cp /etc/profile.d/proxy.sh "${_W_DIR}"/tmp/etc/profile.d/proxy.sh
cp /.network "${_W_DIR}"/tmp/
fi
if [[ -e '/.pacsetup' ]]; then
cp /etc/pacman.conf "${_W_DIR}"/tmp/etc
cp /etc/pacman.d/mirrorlist "${_W_DIR}"/tmp/etc/pacman.d/
cp -ar /etc/pacman.d/gnupg "${_W_DIR}"/tmp/etc/pacman.d
rm "${_W_DIR}"/tmp/etc/systemd/system/pacman-init.service
cp /.pacsetup "${_W_DIR}"/tmp/
fi
echo -e "\e[1mStep ${_S_APPEND}7/${_STEPS}:\e[m Creating initramfs ${_RAM}/${_INITRD}..." echo -e "\e[1mStep ${_S_APPEND}7/${_STEPS}:\e[m Creating initramfs ${_RAM}/${_INITRD}..."
echo " This will need some time..." echo " This will need some time..."
_create_initramfs _create_initramfs