x86: update syslinux config manipulation for version 2.0

Adjust x86 boot scripts for new version (2.0) of framework in D-I for
creation of syslinux configuration files. Essentially the new version
is a backport of what was already implemented in debian-cd before the
release of Lenny and allows a significant simplification.

There are no significant changes in generated CD/DVD images.
This commit is contained in:
Frans Pop 2009-05-31 22:45:05 +00:00
parent 31a18757f2
commit d15cc10746
3 changed files with 65 additions and 185 deletions

10
debian/changelog vendored
View File

@ -1,3 +1,13 @@
debian-cd (3.1.3) UNRELEASED; urgency=low
* Adjust x86 boot scripts for new version (2.0) of framework in D-I for
creation of syslinux configuration files. Essentially the new version
is a backport of what was already implemented in debian-cd before the
release of Lenny and allows a significant simplification.
There are no significant changes in generated CD/DVD images.
-- Frans Pop <fjp@debian.org> Mon, 01 Jun 2009 00:15:59 +0200
debian-cd (3.1.2) unstable; urgency=low
[ Frans Pop ]

View File

@ -154,8 +154,6 @@ case "$DESKTOP" in
gnome)
# gnome is default in tasksel
DESKTOP=
KERNEL_PARAMS="$(echo "$KERNEL_PARAMS" | \
sed -r "s/desktop=[^ ]* ?//")"
;;
all)
ORIG_DESKTOP=$DESKTOP
@ -166,6 +164,8 @@ case "$DESKTOP" in
DESKTOP=xfce
;;
esac
# desktop boot parameter gets set separately through DESKTOP variable
KERNEL_PARAMS="$(echo "$KERNEL_PARAMS" | sed -r "s/desktop=[^ ]* ?//")"
if [ "$THISTYPE" = "isolinux" ]; then
echo " Using ISOLINUX boot-disks image on CD$N"
@ -221,14 +221,6 @@ if [ "$THISTYPE" = "isolinux" ]; then
if [ -e boot$N/isolinux/isolinux.cfg.withgtk ]; then
mv boot$N/isolinux/isolinux.cfg.withgtk boot$N/isolinux/isolinux.cfg
fi
else
# Remove gtk isolinux config files.
# FJP: AFAICT this is redundant: if f3.txt.withgtk is not
# included then the *gtk* files will not be either.
rm -f boot$N/isolinux/gtk.cfg
rm -f boot$N/isolinux/amdgtk.cfg
rm -f boot$N/isolinux/adgtk.cfg
rm -f boot$N/isolinux/amdadgtk.cfg
fi
rm -f boot$N/isolinux/isolinux.cfg.with*
@ -245,27 +237,17 @@ if [ "$THISTYPE" = "isolinux" ]; then
if [ -z "$MULTIARCH" ]; then
# Set up isolinux dir for only the current arch
for f in txt.cfg gtk.cfg adtxt.cfg adgtk.cfg; do
if [ -e boot$N/isolinux/$f ]; then
sed -i "s|/install/|/$INSTALLDIR/|" boot$N/isolinux/$f
fi
done
sed -i "s|%install%|$INSTALLDIR|" \
boot$N/isolinux/*.cfg boot$N/isolinux/desktop/*.cfg
# Remove the amd*.cfg files to avoid them being loaded on a
# disc that does not have both amd64 and i386 dirs.
rm -f boot$N/isolinux/amd*.cfg
rm -f boot$N/isolinux/amd*.cfg boot$N/isolinux/desktop/amd*.cfg
else
# Set up isolinux dir for multi-arch
for f in txt.cfg gtk.cfg adtxt.cfg adgtk.cfg; do
if [ -e boot$N/isolinux/$f ]; then
sed -i "s|/install/|/$INSTALLDIR_i386/|" boot$N/isolinux/$f
fi
done
for f in amdtxt.cfg amdgtk.cfg amdadtxt.cfg amdadgtk.cfg; do
if [ -e boot$N/isolinux/$f ]; then
sed -i "s|/install/|/$INSTALLDIR_amd64/|" boot$N/isolinux/$f
fi
done
sed -i "s|%install%|$INSTALLDIR_i386|
s|%install-amd%|$INSTALLDIR_amd64|" \
boot$N/isolinux/*.cfg boot$N/isolinux/desktop/*.cfg
for file in boot$N/isolinux/f3.txt* boot$N/isolinux/f4.txt*; do
sed -i "4 s/^$/(note: i386 is default; prepend 'amd64-' to use an amd64 kernel instead)/" $file
@ -294,6 +276,8 @@ if [ "$THISTYPE" = "isolinux" ]; then
boot$N/isolinux/amdtxt.cfg || true
sed -i "/^include menu.cfg/ a\include instsel.cfg" \
boot$N/isolinux/prompt.cfg
sed -i "/^default install/ a\include instsel.cfg" \
boot$N/isolinux/desktop/prompt.cfg
cat >boot$N/isolinux/instsel.cfg <<EOF
default install-select
label install-select
@ -316,7 +300,7 @@ EOF
if [ -n "$KERNEL_PARAMS" ]; then
# Substitute custom kernel params into the isolinux config
# file(s)
for file in boot$N/isolinux/*.cfg; do
for file in boot$N/isolinux/*.cfg boot$N/isolinux/desktop/*.cfg; do
case "$(basename $file)" in
instsel.cfg)
continue ;;
@ -331,6 +315,8 @@ EOF
modify_for_all_desktop ;;
light)
modify_for_light_desktop ;;
*)
modify_for_single_desktop ;;
esac
else
if [ -n "$THISTYPE" ]; then

View File

@ -1,102 +1,50 @@
# Functions to convert isolinux config to allow selection of desktop
# environment for certain images.
# All config file names need to be in 8.3 format!
# For that reason files that get a "desktop" postfix are renamed as
# follows: adtxt->at, adgtk->ag.
# With two characters (dt) for the postfix this will leave as maximum
# for example: amdtxtdt.cfg or amdatdt.cfg.
create_desktop_dir() {
local desktop=$1 title
make_desktop_template() {
# Split rescue labels out of advanced options files
for file in boot$N/isolinux/*ad*.cfg; do
rq_file="$(echo "$file" | sed -r "s:/(amd)?ad:/\1rq:")"
sed -rn "s:desktop=[^ ]*::
/^label (amd64-)?rescue/,+3 p" $file >$rq_file
sed -ri "/^label (amd64-)?rescue/ i\include $(basename $rq_file)
/^label (amd64-)?rescue/,+3 d" $file
done
case $desktop in
kde) title=KDE ;;
xfce) title=Xfce ;;
lxde) title=LXDE ;;
esac
mkdir -p boot$N/isolinux/desktop
cp -r boot$N/isolinux/desktop boot$N/isolinux/$desktop
sed -i "s:%desktop%:$desktop:
s:%dt-name%:$title:" boot$N/isolinux/$desktop/*.cfg
}
cp boot$N/isolinux/menu.cfg boot$N/isolinux/desktop/menu.cfg
sed -i "/^menu hshift/,/^include stdmenu/ d
s:include :include %desktop%/:
/include .*stdmenu/ s:%desktop%/::
s:config :config %desktop%/:" \
boot$N/isolinux/desktop/menu.cfg
cp boot$N/isolinux/desktop/menu.cfg boot$N/isolinux/desktop/prmenu.cfg
sed -ri "s:(include.*(txt|gtk))(\.cfg):\1dt\3:
/include.*(txt|gtk)/ {s:adtxt:at:; s:adgtk:ag:}" \
boot$N/isolinux/desktop/menu.cfg
sed -i "/menu begin advanced/ s:ced:ced-%desktop%:
/Advanced options/ i\ menu label Advanced options
/label mainmenu/ s:mainmenu:dtmenu-%desktop%:
/label help/ s:help:help-%desktop%:" \
boot$N/isolinux/desktop/menu.cfg
sed -i "/^[[:space:]]*menu/ d
/label mainmenu/ d
/include stdmenu/ d
s:^[[:space:]]*::
/label help/,+5 d" \
boot$N/isolinux/desktop/prmenu.cfg
modify_for_single_desktop() {
# Cleanup
rm boot$N/isolinux/dtmenu.cfg
rm -r boot$N/isolinux/desktop
cp boot$N/isolinux/prompt.cfg boot$N/isolinux/desktop/prompt.cfg
sed -i "/include menu/ a\default install
s:include menu:include %desktop%/prmenu:" \
boot$N/isolinux/desktop/prompt.cfg
for file in boot$N/isolinux/*txt.cfg boot$N/isolinux/*gtk.cfg; do
[ -e "$file" ] || continue
# Skip rescue include files
if $(echo $file | grep -Eq "/(amd)?rq"); then
continue
fi
# Create two types of desktop include files: for vesa menu and
# for prompt; the latter keep the original name, the former
# get a 'dt' postfix and the name is shortened if needed
dt_prfile="$(dirname "$file")/desktop/$(basename "$file")"
dt_file="${dt_prfile%.cfg}dt.cfg"
dt_file="$(echo "$dt_file" | \
sed -r "s:adtxt:at:
s:adgtk:ag:")"
cp $file $dt_file
sed -ri "/^default/ s:^:#:
/include (amd)?rq/ d
s:desktop=[^ ]*:desktop=%desktop%:" \
$dt_file
cp $dt_file $dt_prfile
sed -i "/^label/ s:[[:space:]]*$:-%desktop%:" \
$dt_file
done
# Set default desktop, or remove if not applicable
if [ "$DESKTOP" ]; then
sed -i "s:%desktop%:$DESKTOP:g" boot$N/isolinux/*.cfg
else
sed -i "s/desktop=%desktop% //" boot$N/isolinux/*.cfg
fi
}
modify_for_light_desktop() {
make_desktop_template
local desktop
cp -r boot$N/isolinux/desktop boot$N/isolinux/xfce
sed -i "s:%desktop%:xfce:g" boot$N/isolinux/xfce/*.cfg
sed -i "/Advanced options/ s:title:title Xfce:" \
boot$N/isolinux/xfce/menu.cfg
for file in boot$N/isolinux/{,amd}{,ad}{txt,gtk}.cfg; do
if [ -e $file ]; then
mv $file boot$N/isolinux/desktop
fi
done
sed -i "s/desktop=%desktop% //" boot$N/isolinux/*.cfg
cp -r boot$N/isolinux/desktop boot$N/isolinux/lxde
sed -i "s:%desktop%:lxde:g" boot$N/isolinux/lxde/*.cfg
sed -i "/Advanced options/ s:title:title LXDE:" \
boot$N/isolinux/lxde/menu.cfg
for desktop in xfce lxde; do
create_desktop_dir $desktop
done
# Cleanup
rm -r boot$N/isolinux/desktop
for file in boot$N/isolinux/*txt.cfg boot$N/isolinux/*gtk.cfg \
boot$N/isolinux/prompt.cfg; do
[ -e "$file" ] || continue
# Skip rescue include files
if $(echo $file | grep -q "/rq"); then
continue
fi
rm $file
done
rm boot$N/isolinux/prompt.cfg boot$N/isolinux/dtmenu.cfg
# Create new "top level" menu file
cat >boot$N/isolinux/menu.cfg <<EOF
@ -145,83 +93,19 @@ EOF
}
modify_for_all_desktop() {
make_desktop_template
local desktop
# Remove desktop option in root config files (for GNOME)
sed -i "s:desktop=[^ ]*::" boot$N/isolinux/*.cfg
for file in boot$N/isolinux/{,amd}{,ad}{txt,gtk}.cfg; do
if [ -e $file ]; then
cp $file boot$N/isolinux/desktop
fi
done
sed -i "s/desktop=%desktop% //" boot$N/isolinux/*.cfg
cp -r boot$N/isolinux/desktop boot$N/isolinux/kde
sed -i "s:%desktop%:kde:g" boot$N/isolinux/kde/*.cfg
sed -i "/Advanced options/ s:title:title KDE:" \
boot$N/isolinux/kde/menu.cfg
cp -r boot$N/isolinux/desktop boot$N/isolinux/xfce
sed -i "s:%desktop%:xfce:g" boot$N/isolinux/xfce/*.cfg
sed -i "/Advanced options/ s:title:title Xfce:" \
boot$N/isolinux/xfce/menu.cfg
cp -r boot$N/isolinux/desktop boot$N/isolinux/lxde
sed -i "s:%desktop%:lxde:g" boot$N/isolinux/lxde/*.cfg
sed -i "/Advanced options/ s:title:title LXDE:" \
boot$N/isolinux/lxde/menu.cfg
for desktop in kde xfce lxde; do
create_desktop_dir $desktop
done
# Cleanup
rm -r boot$N/isolinux/desktop
# Create desktop menu file
cat >boot$N/isolinux/dtmenu.cfg <<EOF
menu begin desktop
include stdmenu.cfg
menu hshift 13
menu width 49
menu label Alternative desktop environments
menu title Desktop environment menu
label mainmenu-kde
menu label ^Back..
text help
Higher level options install the GNOME desktop environment
endtext
menu exit
menu begin kde-desktop
include stdmenu.cfg
menu label ^KDE
menu title KDE desktop boot menu
text help
Select the 'K Desktop Environment' for the Desktop task
endtext
label mainmenu-kde
menu label ^Back..
menu exit
include kde/menu.cfg
menu end
menu begin lxde-desktop
include stdmenu.cfg
menu label ^LXDE
menu title LXDE desktop boot menu
text help
Select the 'Lightweight X11 Desktop Environment' for the Desktop task
endtext
label mainmenu-lxde
menu label ^Back..
menu exit
include lxde/menu.cfg
menu end
menu begin xfce-desktop
include stdmenu.cfg
menu label ^Xfce
menu title Xfce desktop boot menu
text help
Select the 'Xfce lightweight desktop environment' for the Desktop task
endtext
label mainmenu-xfce
menu label ^Back..
menu exit
include xfce/menu.cfg
menu end
menu end
EOF
# Include desktop submenu in Advanced options submenu
sed -i "/menu end/ i\\\tinclude dtmenu.cfg" \
boot$N/isolinux/menu.cfg
}