summaryrefslogtreecommitdiff
path: root/raveos-calamares-theme
diff options
context:
space:
mode:
Diffstat (limited to 'raveos-calamares-theme')
-rw-r--r--raveos-calamares-theme/PKGBUILD2
-rw-r--r--raveos-calamares-theme/etc/calamares/modules/calamares-fix-bootentry.sh51
2 files changed, 30 insertions, 23 deletions
diff --git a/raveos-calamares-theme/PKGBUILD b/raveos-calamares-theme/PKGBUILD
index 1357438..3b6e7ab 100644
--- a/raveos-calamares-theme/PKGBUILD
+++ b/raveos-calamares-theme/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: nippy <nippy@tuta.io>
pkgname=raveos-calamares-theme
pkgver=2.0.0
-pkgrel=67
+pkgrel=68
pkgdesc="RaveOS Calamares Theme"
arch=('any')
url="https://git.rp1.hu/RaveOS"
diff --git a/raveos-calamares-theme/etc/calamares/modules/calamares-fix-bootentry.sh b/raveos-calamares-theme/etc/calamares/modules/calamares-fix-bootentry.sh
index f49e1d0..3735524 100644
--- a/raveos-calamares-theme/etc/calamares/modules/calamares-fix-bootentry.sh
+++ b/raveos-calamares-theme/etc/calamares/modules/calamares-fix-bootentry.sh
@@ -6,45 +6,52 @@ echo ">>> [fix-bootentry] Running INSIDE target system"
ENTRYDIR="/boot/loader/entries"
[ -d "${ENTRYDIR}" ] || { echo ">>> [fix-bootentry] No ${ENTRYDIR}, skipping."; exit 0; }
-# 95-raveos.install (kernel-install hook, fired during pacstrap/mkinitcpio)
-# detects the root device via findmnt at hook-time. Depending on the
-# chroot/mount-namespace context that detection can silently come back
-# empty, producing a loader entry with no "root=" in its options line
-# (system then drops to an emergency shell on boot: "Failed to mount ''
-# on real root"). On btrfs it can also come back in findmnt's bracket form
-# ("/dev/vda2[/@]"), which blkid cannot resolve -- that produces a
-# syntactically present but unusable root= (emergency shell: "Failed to
-# mount '/dev/vda2[/@]' on real root"). By this point in the install
-# sequence /etc/fstab is already correctly generated, so use it as the
-# authoritative source and patch both the missing and malformed cases.
-
ROOT_UUID="$(findmnt -no UUID / || true)"
if [ -z "${ROOT_UUID}" ]; then
ROOT_UUID="$(awk '$2 == "/" && $1 ~ /^UUID=/ {print $1; exit}' /etc/fstab | sed 's/^UUID=//')"
fi
if [ -z "${ROOT_UUID}" ]; then
- echo ">>> [fix-bootentry] Could not determine root UUID from findmnt or fstab, leaving entries untouched."
+ echo ">>> [fix-bootentry] Could not determine root UUID, leaving entries untouched."
exit 0
fi
-echo ">>> [fix-bootentry] Root UUID: ${ROOT_UUID}"
+SWAP_UUID="$(awk '$3 == "swap" && $1 ~ /^UUID=/ {print $1; exit}' /etc/fstab | sed 's/^UUID=//')"
+ROOT_OPTS="$(awk '$2 == "/" {print $4; exit}' /etc/fstab)"
+SUBVOL="$(echo "$ROOT_OPTS" | tr ',' '\n' | grep '^subvol=' | head -1 || true)"
+
+echo ">>> [fix-bootentry] root UUID: ${ROOT_UUID} | swap UUID: ${SWAP_UUID:-nincs} | subvol: ${SUBVOL:-nincs}"
for f in "${ENTRYDIR}"/*.conf; do
[ -f "$f" ] || continue
+ grep -qE '^options[[:space:]]' "$f" || continue
if grep -qE '^options[[:space:]].*\broot=' "$f"; then
- if grep -qE 'root=[^[:space:]]*\[' "$f"; then
- echo ">>> [fix-bootentry] Fixing malformed (findmnt-style) root= in: $f"
- sed -i -E "s#root=[^[:space:]]*\[[^]]*\]#root=UUID=${ROOT_UUID}#" "$f"
- continue
+ sed -i -E "s#root=[^[:space:]]*#root=UUID=${ROOT_UUID}#" "$f"
+ else
+ sed -i -E "s#^options[[:space:]]+#options root=UUID=${ROOT_UUID} #" "$f"
+ fi
+
+ if [ -n "${SWAP_UUID}" ]; then
+ if grep -qE '\bresume=' "$f"; then
+ sed -i -E "s#resume=[^[:space:]]*#resume=UUID=${SWAP_UUID}#" "$f"
+ else
+ sed -i -E "s#^(options[[:space:]].*)#\1 resume=UUID=${SWAP_UUID}#" "$f"
+ fi
+ else
+ sed -i -E "s#[[:space:]]+resume=[^[:space:]]*##g" "$f"
+ fi
+
+ if [ -n "${SUBVOL}" ]; then
+ if grep -qE '\brootflags=subvol=' "$f"; then
+ sed -i -E "s#rootflags=subvol=[^[:space:]]*#rootflags=${SUBVOL}#" "$f"
+ else
+ sed -i -E "s#^(options[[:space:]].*)#\1 rootflags=${SUBVOL}#" "$f"
fi
- echo ">>> [fix-bootentry] Already has root=, skipping: $f"
- continue
fi
- echo ">>> [fix-bootentry] Patching missing root= in: $f"
- sed -i -E "s#^options[[:space:]]+#options root=UUID=${ROOT_UUID} #" "$f"
+ echo ">>> [fix-bootentry] Fixed: $f"
done
echo ">>> [fix-bootentry] Done."
+exit 0