finish-install: use in-target directly
This commit is contained in:
parent
91486041d0
commit
9b01ea21cd
2 changed files with 47 additions and 45 deletions
|
|
@ -5,61 +5,63 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# UEFI only
|
# UEFI only in installer env
|
||||||
[ -d /sys/firmware/efi ] || exit 0
|
[ -d /sys/firmware/efi ] || exit 0
|
||||||
|
|
||||||
# Check for desktop environmtn task selected
|
# Desktop detection (target): Trisquel desktop metas OR common DMs
|
||||||
SELECTION="$(debconf-get tasksel/first 2>/dev/null || true)"
|
if in-target dpkg -s trisquel-desktop-common >/dev/null 2>&1 \
|
||||||
if echo "$SELECTION" | grep -Eq '\b(trisquel-desktop|trisquel-gnome|trisquel-mini|triskel)\b'; then
|
|
||||||
: # desktop confirmed by tasksel
|
|
||||||
else
|
|
||||||
# Fallback: desktop present if any of these is installed in target
|
|
||||||
if in-target dpkg -s trisquel-desktop-common >/dev/null 2>&1 \
|
|
||||||
|| in-target dpkg -s triskel >/dev/null 2>&1 \
|
|| in-target dpkg -s triskel >/dev/null 2>&1 \
|
||||||
|| in-target dpkg -s trisquel-gnome >/dev/null 2>&1 \
|
|| in-target dpkg -s trisquel-gnome >/dev/null 2>&1 \
|
||||||
|| in-target dpkg -s trisquel-mini >/dev/null 2>&1 \
|
|| in-target dpkg -s trisquel-mini >/dev/null 2>&1 \
|
||||||
|| in-target dpkg -s lightdm >/dev/null 2>&1 \
|
|| in-target dpkg -s lightdm >/dev/null 2>&1 \
|
||||||
|| in-target dpkg -s gdm3 >/dev/null 2>&1 \
|
|| in-target dpkg -s gdm3 >/dev/null 2>&1 \
|
||||||
|| in-target dpkg -s sddm >/dev/null 2>&1; then
|
|| in-target dpkg -s sddm >/dev/null 2>&1; then
|
||||||
: # desktop detected by packages
|
logger -t trisquel-uefi-splash "desktop detected (packages)"
|
||||||
else
|
else
|
||||||
|
logger -t trisquel-uefi-splash "no desktop; skip"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for plymouth installed in target
|
# Plymouth present in target?
|
||||||
in-target dpkg -s plymouth >/dev/null 2>&1 || exit 0
|
in-target dpkg -s plymouth >/dev/null 2>&1 || { logger -t trisquel-uefi-splash "no plymouth; skip"; exit 0; }
|
||||||
|
|
||||||
# Debconf-first approach inside target; fallback to minimal edit if needed.
|
# Edit /etc/default/grub inside target: ensure GRUB_CMDLINE_LINUX_DEFAULT includes 'splash'
|
||||||
in-target sh -s <<'INCHROOT'
|
in-target sh -s <<'INCHROOT'
|
||||||
set -e
|
set -e
|
||||||
. /usr/share/debconf/confmodule
|
|
||||||
|
|
||||||
# Read current value; default to "quiet" if empty
|
|
||||||
db_get grub2/linux_cmdline_default || true
|
|
||||||
CURRENT_CMDLINE="${RET:-quiet}"
|
|
||||||
|
|
||||||
# If 'splash' already present, nothing to do
|
|
||||||
echo "$CURRENT_CMDLINE" | grep -qw splash && exit 0
|
|
||||||
|
|
||||||
# Set debconf value to include splash
|
|
||||||
db_set grub2/linux_cmdline_default "$CURRENT_CMDLINE splash" || true
|
|
||||||
|
|
||||||
# Reconfigure grub2-common (may or may not rewrite the conffile in d-i flows)
|
|
||||||
dpkg-reconfigure -f noninteractive grub2-common || true
|
|
||||||
|
|
||||||
# Fallback: minimally ensure GRUB_CMDLINE_LINUX_DEFAULT contains 'splash'
|
|
||||||
CFG="/etc/default/grub"
|
CFG="/etc/default/grub"
|
||||||
if ! grep -q '^GRUB_CMDLINE_LINUX_DEFAULT=' "$CFG"; then
|
[ -f "$CFG" ] || touch "$CFG"
|
||||||
printf 'GRUB_CMDLINE_LINUX_DEFAULT="%s"\n' "quiet splash" >> "$CFG"
|
|
||||||
else
|
awk -v key="GRUB_CMDLINE_LINUX_DEFAULT" '
|
||||||
GRUB_CMDLINE_VALUE="$(sed -n 's/^GRUB_CMDLINE_LINUX_DEFAULT="\{0,1\}\(.*\)"\{0,1\}$/\1/p' "$CFG" | head -n1)"
|
BEGIN{done=0}
|
||||||
echo "$GRUB_CMDLINE_VALUE" | grep -qw splash || \
|
# Match the variable (with or without quotes around value)
|
||||||
sed -i -E 's|^(GRUB_CMDLINE_LINUX_DEFAULT="[^"]*)(".*)?$|\1 splash"\2|; t; s|^(GRUB_CMDLINE_LINUX_DEFAULT=)(.*)$|\1"quiet splash"|' "$CFG"
|
($0 ~ "^"key"=") {
|
||||||
fi
|
line = $0
|
||||||
|
val = $0
|
||||||
|
sub("^"key"=","",val)
|
||||||
|
# strip surrounding double quotes if present
|
||||||
|
if (val ~ /^"/) sub(/^"/,"",val)
|
||||||
|
if (val ~ /"$/) sub(/"$/,"",val)
|
||||||
|
# normalize trailing spaces
|
||||||
|
gsub(/[[:space:]]+$/, "", val)
|
||||||
|
# check presence of splash
|
||||||
|
found=0
|
||||||
|
n=split(val, tok, /[[:space:]]+/)
|
||||||
|
for (i=1;i<=n;i++) if (tok[i]=="splash") { found=1; break }
|
||||||
|
if (!found) {
|
||||||
|
if (val == "") val = "quiet splash"; else val = val " splash"
|
||||||
|
}
|
||||||
|
print key "=\"" val "\""
|
||||||
|
done=1
|
||||||
|
next
|
||||||
|
}
|
||||||
|
{ print }
|
||||||
|
END{
|
||||||
|
if (!done) print key "=\"quiet splash\""
|
||||||
|
}
|
||||||
|
' "$CFG" > "$CFG.tmp" && mv "$CFG.tmp" "$CFG"
|
||||||
|
|
||||||
# Regenerate grub.cfg now; initramfs will be refreshed by 10update-initramfs next
|
|
||||||
update-grub || true
|
update-grub || true
|
||||||
INCHROOT
|
INCHROOT
|
||||||
|
|
||||||
|
logger -t trisquel-uefi-splash "splash ensured; update-grub called"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
# such packages from Debian in order to build the required udeb packages.
|
# such packages from Debian in order to build the required udeb packages.
|
||||||
##
|
##
|
||||||
|
|
||||||
VERSION=2.1
|
VERSION=2.2
|
||||||
EXTERNAL='deb-src http://ftp.debian.org/debian trixie main'
|
EXTERNAL='deb-src http://ftp.debian.org/debian trixie main'
|
||||||
REPOKEY=6ED0E7B82643E131
|
REPOKEY=6ED0E7B82643E131
|
||||||
NETINST=true
|
NETINST=true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue