From d0c11466b4afa70d688a6e4da365d8c4c5b427e4 Mon Sep 17 00:00:00 2001 From: LinuxSquare Date: Sun, 31 Dec 2023 14:34:09 +0100 Subject: [PATCH] Add efivarfs module, Add check if iso booted in uefi mode --- Makefile | 2 +- airootfs/root/install.sh | 36 +++++++++++++++++++++++++++++++++++- customize-airootfs.sh | 1 + 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 78db4e8..bb84458 100644 --- a/Makefile +++ b/Makefile @@ -2,4 +2,4 @@ iso: sudo mkteaiso -o ${PWD}/out -p ${PWD} clean: - rm -f ${PWD}/out/*.iso + sudo rm -f ${PWD}/out/*.iso diff --git a/airootfs/root/install.sh b/airootfs/root/install.sh index 7037cc6..77b2b78 100644 --- a/airootfs/root/install.sh +++ b/airootfs/root/install.sh @@ -106,6 +106,39 @@ function preChecks() { esac fi + # Check if booted in UEFI + if [ ! -d /sys/firmware/efi ]; then + dialog --stdout --clear --no-collapse --yes-label "Shutdown" --nolabel "Alpine shell" --yesno "The ISO hasn't been booted in UEFI mode. Please boot the ISO in UEFI to proceed installation" 6 50 + case $? in + 0) + clear + COUNTER=5 + echo "NoveriaOS is shutting down in: " + while [ 1 ]; do + if [ ${COUNTER} -eq 0 ]; then + break + fi + echo -n "${COUNTER}" + COUNTER=$( echo "${COUNTER}-1" | bc ) + sleep 0.2 + for (( i=0; i<4; i++ )); do + echo -n "." + sleep 0.2 + done + done + poweroff + ;; + 1) + clear + exit 0 + ;; + 255) + clear + exit + ;; + esac + fi + introDialogue } @@ -300,7 +333,7 @@ function installation() { installationSubtaskTitle "Mount extra mounts for chroot" mount -t proc /proc "${INSTALLATION_MOUNTPOINT}/proc" || installationFailed mount -t sysfs /sys "${INSTALLATION_MOUNTPOINT}/sys" || installationFailed - mount -o bind /sys/firmware/efi/efivars "${INSTALLATION_MOUNTPOINT}/sys/firmware/efi/efivars/" || __installationFailed + mount -t efivarfs efivarfs "${INSTALLATION_MOUNTPOINT}/sys/firmware/efi/efivars" || installationFailed mount -o bind /dev "${INSTALLATION_MOUNTPOINT}/dev" || installationFailed mount -o bind /run "${INSTALLATION_MOUNTPOINT}/run" || installationFailed @@ -336,6 +369,7 @@ function installation() { installationSubtaskTitle "Enable btrfs module" chroot "${INSTALLATION_MOUNTPOINT}" /bin/ash -c "echo 'btrfs' >> /etc/modules" + chroot "${INSTALLATION_MOUNTPOINT}" /bin/ash -c "echo 'efivarfs' >> /etc/modules" echo "" echo "┌──────────────────────────────────────────┐" diff --git a/customize-airootfs.sh b/customize-airootfs.sh index c65d2ee..e0bcde9 100755 --- a/customize-airootfs.sh +++ b/customize-airootfs.sh @@ -26,3 +26,4 @@ sed -i 's~/sbin/getty 38400~/sbin/mingetty --autologin root --noclear~' /etc/ini # Add btrfs module echo "btrfs" | tee -a /etc/modules +echo "efivarfs" | tee -a /etc/modules