clean up everything correctly
This commit is contained in:
parent
6a3cecda84
commit
46be773a1d
29
bootstrap
29
bootstrap
@ -99,10 +99,7 @@ open_luks() {
|
||||
local install_dev
|
||||
install_dev="$(get_value "install_dev" "installation device")"
|
||||
|
||||
|
||||
if ! dmsetup ls | grep "void\s"; then
|
||||
cryptsetup open "$install_dev"p2 void
|
||||
fi
|
||||
}
|
||||
|
||||
create_lvm() {
|
||||
@ -133,13 +130,11 @@ ensure_mount() {
|
||||
rbind="--rbind"
|
||||
fi
|
||||
|
||||
if grep -qs "$dest " /proc/mounts; then
|
||||
mount "$rbind" "$src" "$dest"
|
||||
mount $rbind "$src" "$dest"
|
||||
|
||||
if [ ! -z "$with_rbind"]; then
|
||||
if [ ! -z "$with_rbind" ]; then
|
||||
mount --make-rslave "$dest"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
mount_filesystems() {
|
||||
@ -151,9 +146,7 @@ mount_filesystems() {
|
||||
mkdir -p /mnt/boot
|
||||
ensure_mount "$install_dev"p1 "/mnt/boot"
|
||||
|
||||
if [ "$(cat /proc/swaps | wc -l)" == 1 ]; then
|
||||
swapon /dev/void/swap
|
||||
fi
|
||||
}
|
||||
|
||||
install_basesystem() {
|
||||
@ -245,7 +238,7 @@ set_base_conf() {
|
||||
local locale
|
||||
locale="$(get_value "locale" "locale")"
|
||||
|
||||
echo "$locale" >> /etc/default/libc-locales
|
||||
echo "$locale" >> /mnt/etc/default/libc-locales
|
||||
|
||||
chroot /mnt /bin/env -i \
|
||||
timezone="$timezone" \
|
||||
@ -302,11 +295,17 @@ EOF
|
||||
}
|
||||
|
||||
tidy_up() {
|
||||
sync
|
||||
|
||||
if grep -qe "/mnt " /proc/mounts; then
|
||||
umount -R /mnt
|
||||
lvchange -an void/root
|
||||
lvchange -an void/swap
|
||||
vgchange -an void
|
||||
cryptsetup close void
|
||||
fi
|
||||
|
||||
swapoff /dev/void/swap > /dev/null 2>&1 || true
|
||||
|
||||
vgchange --activate n
|
||||
|
||||
cryptsetup close void > /dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
full_install() {
|
||||
@ -404,6 +403,8 @@ cmd_loop() {
|
||||
done
|
||||
}
|
||||
|
||||
trap tidy_up 0 SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
|
||||
|
||||
if [ "$1" == "full" ]; then
|
||||
full_install
|
||||
else
|
||||
|
@ -83,6 +83,7 @@ build_img() {
|
||||
sudo chroot "$TMP_DIR_MOUNT" qemu-aarch64-static /bin/bash <<"EOT"
|
||||
ln -s /etc/sv/dbus /etc/runit/runsvdir/default/
|
||||
ln -s /etc/sv/NetworkManager /etc/runit/runsvdir/default/
|
||||
ln -s /etc/sv/sshd /etc/runit/runsvdir/default/
|
||||
EOT
|
||||
|
||||
sudo rm "$TMP_DIR_MOUNT/usr/bin/qemu-aarch64-static"
|
||||
|
Loading…
Reference in New Issue
Block a user