limine-snapper.sh: skip harvest dance when /etc/default/limine is pre-populated
The ISO orchestrator now writes /etc/default/limine directly from the install config (with the real cmdline already substituted) before the chroot phase runs. The previous unconditional find+harvest+copy+sed sequence would (a) find our orchestrator-staged /boot/limine.conf which has no `cmdline:` line and (b) exit 1 on "failed to extract kernel cmdline". Skip the harvest entirely when /etc/default/limine already exists without the @@CMDLINE@@ placeholder. Parse CMDLINE from the existing file so the downstream cryptdevice= validation still has it to compare. The harvest path remains as a fallback for online reinstalls and any flow where /etc/default/limine wasn't pre-populated by the orchestrator.
This commit is contained in:
@@ -9,35 +9,45 @@ EOF
|
|||||||
# Detect boot mode
|
# Detect boot mode
|
||||||
[[ -d /sys/firmware/efi ]] && EFI=true
|
[[ -d /sys/firmware/efi ]] && EFI=true
|
||||||
|
|
||||||
# Find config location
|
# If /etc/default/limine is already populated with a real cmdline (the ISO
|
||||||
if [[ -f /boot/EFI/arch-limine/limine.conf ]]; then
|
# orchestrator pre-writes it from the live install config), skip the
|
||||||
limine_config="/boot/EFI/arch-limine/limine.conf"
|
# find+harvest+template-copy dance — we already have what we need. The
|
||||||
elif [[ -f /boot/EFI/BOOT/limine.conf ]]; then
|
# harvest path stays as a fallback for online reinstalls and any flow where
|
||||||
limine_config="/boot/EFI/BOOT/limine.conf"
|
# /etc/default/limine wasn't pre-populated.
|
||||||
elif [[ -f /boot/EFI/limine/limine.conf ]]; then
|
if [[ -f /etc/default/limine ]] && ! grep -q "@@CMDLINE@@" /etc/default/limine; then
|
||||||
limine_config="/boot/EFI/limine/limine.conf"
|
CMDLINE=$(grep '^KERNEL_CMDLINE\[default\]+=' /etc/default/limine | head -1 |
|
||||||
elif [[ -f /boot/limine/limine.conf ]]; then
|
sed 's|^KERNEL_CMDLINE\[default\]+="||; s|"$||')
|
||||||
limine_config="/boot/limine/limine.conf"
|
|
||||||
elif [[ -f /boot/limine.conf ]]; then
|
|
||||||
limine_config="/boot/limine.conf"
|
|
||||||
else
|
else
|
||||||
echo "Error: Limine config not found" >&2
|
# Find config location written by archinstall (legacy harvest path)
|
||||||
exit 1
|
if [[ -f /boot/EFI/arch-limine/limine.conf ]]; then
|
||||||
fi
|
limine_config="/boot/EFI/arch-limine/limine.conf"
|
||||||
|
elif [[ -f /boot/EFI/BOOT/limine.conf ]]; then
|
||||||
|
limine_config="/boot/EFI/BOOT/limine.conf"
|
||||||
|
elif [[ -f /boot/EFI/limine/limine.conf ]]; then
|
||||||
|
limine_config="/boot/EFI/limine/limine.conf"
|
||||||
|
elif [[ -f /boot/limine/limine.conf ]]; then
|
||||||
|
limine_config="/boot/limine/limine.conf"
|
||||||
|
elif [[ -f /boot/limine.conf ]]; then
|
||||||
|
limine_config="/boot/limine.conf"
|
||||||
|
else
|
||||||
|
echo "Error: Limine config not found" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
CMDLINE=$(grep "^[[:space:]]*cmdline:" "$limine_config" | head -1 | sed 's/^[[:space:]]*cmdline:[[:space:]]*//')
|
CMDLINE=$(grep "^[[:space:]]*cmdline:" "$limine_config" | head -1 | sed 's/^[[:space:]]*cmdline:[[:space:]]*//')
|
||||||
|
|
||||||
if [[ -z ${CMDLINE// } ]]; then
|
if [[ -z ${CMDLINE// } ]]; then
|
||||||
echo "Error: failed to extract kernel cmdline from $limine_config" >&2
|
echo "Error: failed to extract kernel cmdline from $limine_config" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ $CMDLINE != *root=* ]]; then
|
if [[ $CMDLINE != *root=* ]]; then
|
||||||
echo "Error: extracted kernel cmdline has no root=: $CMDLINE" >&2
|
echo "Error: extracted kernel cmdline has no root=: $CMDLINE" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo cp $OMARCHY_PATH/default/limine/default.conf /etc/default/limine
|
sudo cp $OMARCHY_PATH/default/limine/default.conf /etc/default/limine
|
||||||
sudo sed -i "s|@@CMDLINE@@|$CMDLINE|g" /etc/default/limine
|
sudo sed -i "s|@@CMDLINE@@|$CMDLINE|g" /etc/default/limine
|
||||||
|
fi
|
||||||
|
|
||||||
# Append any drop-in kernel cmdline configs (from hardware fix scripts, etc.)
|
# Append any drop-in kernel cmdline configs (from hardware fix scripts, etc.)
|
||||||
for dropin in /etc/limine-entry-tool.d/*.conf; do
|
for dropin in /etc/limine-entry-tool.d/*.conf; do
|
||||||
|
|||||||
Reference in New Issue
Block a user