1
# Functions to convert isolinux config to allow selection of desktop
2
# environment for certain images.
4
# All config file names need to be in 8.3 format!
5
# For that reason files that get a "desktop" postfix are renamed as
6
# follows: adtxt->at, adgtk->ag.
7
# With two characters (dt) for the postfix this will leave as maximum
8
# for example: amdtxtdt.cfg or amdatdt.cfg.
10
make_desktop_template() {
11
# Split rescue labels out of advanced options files
12
for file in boot$N/isolinux/*ad*.cfg; do
13
rq_file="$(echo "$file" | sed -r "s:/(amd)?ad:/\1rq:")"
14
sed -rn "s:desktop=[^ ]*::
15
/^label (amd64-)?rescue/,+3 p" $file >$rq_file
16
sed -ri "/^label (amd64-)?rescue/ i\include $(basename $rq_file)
17
/^label (amd64-)?rescue/,+3 d" $file
20
mkdir -p boot$N/isolinux/desktop
22
cp boot$N/isolinux/menu.cfg boot$N/isolinux/desktop/menu.cfg
23
sed -i "/^menu hshift/,/^include stdmenu/ d
24
s:include :include %desktop%/:
25
/include .*stdmenu/ s:%desktop%/::
26
s:config :config %desktop%/:" \
27
boot$N/isolinux/desktop/menu.cfg
28
cp boot$N/isolinux/desktop/menu.cfg boot$N/isolinux/desktop/prmenu.cfg
29
sed -ri "s:(include.*(txt|gtk))(\.cfg):\1dt\3:
30
/include.*(txt|gtk)/ {s:adtxt:at:; s:adgtk:ag:}" \
31
boot$N/isolinux/desktop/menu.cfg
32
sed -i "/menu begin advanced/ s:ced:ced-%desktop%:
33
/Advanced options/ i\ menu label Advanced options
34
/label mainmenu/ s:mainmenu:dtmenu-%desktop%:
35
/label help/ s:help:help-%desktop%:" \
36
boot$N/isolinux/desktop/menu.cfg
37
sed -i "/^[[:space:]]*menu/ d
42
boot$N/isolinux/desktop/prmenu.cfg
44
cp boot$N/isolinux/prompt.cfg boot$N/isolinux/desktop/prompt.cfg
45
sed -i "/include menu/ a\default install
46
s:include menu:include %desktop%/prmenu:" \
47
boot$N/isolinux/desktop/prompt.cfg
49
for file in boot$N/isolinux/*txt.cfg boot$N/isolinux/*gtk.cfg; do
50
[ -e "$file" ] || continue
51
# Skip rescue include files
52
if $(echo $file | grep -Eq "/(amd)?rq"); then
56
# Create two types of desktop include files: for vesa menu and
57
# for prompt; the latter keep the original name, the former
58
# get a 'dt' postfix and the name is shortened if needed
59
dt_prfile="$(dirname "$file")/desktop/$(basename "$file")"
60
dt_file="${dt_prfile%.cfg}dt.cfg"
61
dt_file="$(echo "$dt_file" | \
65
sed -ri "/^default/ s:^:#:
67
s:desktop=[^ ]*:desktop=%desktop%:" \
69
cp $dt_file $dt_prfile
70
sed -i "/^label/ s:[[:space:]]*$:-%desktop%:" \
75
modify_for_light_desktop() {
78
cp -r boot$N/isolinux/desktop boot$N/isolinux/xfce
79
sed -i "s:%desktop%:xfce:g" boot$N/isolinux/xfce/*.cfg
80
sed -i "/Advanced options/ s:title:title Xfce:" \
81
boot$N/isolinux/xfce/menu.cfg
83
cp -r boot$N/isolinux/desktop boot$N/isolinux/lxde
84
sed -i "s:%desktop%:lxde:g" boot$N/isolinux/lxde/*.cfg
85
sed -i "/Advanced options/ s:title:title LXDE:" \
86
boot$N/isolinux/lxde/menu.cfg
89
rm -r boot$N/isolinux/desktop
90
for file in boot$N/isolinux/*txt.cfg boot$N/isolinux/*gtk.cfg \
91
boot$N/isolinux/prompt.cfg; do
92
[ -e "$file" ] || continue
93
# Skip rescue include files
94
if $(echo $file | grep -q "/rq"); then
101
# Create new "top level" menu file
102
cat >boot$N/isolinux/menu.cfg <<EOF
107
menu title Desktop environment menu
108
menu begin lxde-desktop
111
menu title LXDE desktop boot menu
113
Select the 'Lightweight X11 Desktop Environment' for the Desktop task
118
include lxde/menu.cfg
120
menu begin xfce-desktop
123
menu title Xfce desktop boot menu
125
Select the 'Xfce lightweight desktop environment' for the Desktop task
130
include xfce/menu.cfg
134
menu label ^System rescue
135
menu title System rescue boot menu
136
label mainmenu-rescue
147
modify_for_all_desktop() {
148
make_desktop_template
150
# Remove desktop option in root config files (for GNOME)
151
sed -i "s:desktop=[^ ]*::" boot$N/isolinux/*.cfg
153
cp -r boot$N/isolinux/desktop boot$N/isolinux/kde
154
sed -i "s:%desktop%:kde:g" boot$N/isolinux/kde/*.cfg
155
sed -i "/Advanced options/ s:title:title KDE:" \
156
boot$N/isolinux/kde/menu.cfg
158
cp -r boot$N/isolinux/desktop boot$N/isolinux/xfce
159
sed -i "s:%desktop%:xfce:g" boot$N/isolinux/xfce/*.cfg
160
sed -i "/Advanced options/ s:title:title Xfce:" \
161
boot$N/isolinux/xfce/menu.cfg
163
cp -r boot$N/isolinux/desktop boot$N/isolinux/lxde
164
sed -i "s:%desktop%:lxde:g" boot$N/isolinux/lxde/*.cfg
165
sed -i "/Advanced options/ s:title:title LXDE:" \
166
boot$N/isolinux/lxde/menu.cfg
169
rm -r boot$N/isolinux/desktop
171
# Create desktop menu file
172
cat >boot$N/isolinux/dtmenu.cfg <<EOF
177
menu label Alternative desktop environments
178
menu title Desktop environment menu
182
Higher level options install the GNOME desktop environment
185
menu begin kde-desktop
188
menu title KDE desktop boot menu
190
Select the 'K Desktop Environment' for the Desktop task
197
menu begin lxde-desktop
200
menu title LXDE desktop boot menu
202
Select the 'Lightweight X11 Desktop Environment' for the Desktop task
207
include lxde/menu.cfg
209
menu begin xfce-desktop
212
menu title Xfce desktop boot menu
214
Select the 'Xfce lightweight desktop environment' for the Desktop task
219
include xfce/menu.cfg
224
# Include desktop submenu in Advanced options submenu
225
sed -i "/menu end/ i\\\tinclude dtmenu.cfg" \
226
boot$N/isolinux/menu.cfg