/[clonezilla-sysresccd]/trunk/create-clonezilla-sysresccd/files/cust-menu
ViewVC logotype

Contents of /trunk/create-clonezilla-sysresccd/files/cust-menu

Parent Directory Parent Directory | Revision Log Revision Log


Revision 178 - (show annotations)
Fri Jun 3 17:27:54 2011 UTC (10 years, 4 months ago) by sng
File size: 11522 byte(s)
- fixing splashscreen (adding Jyrki)
- updating screenshots
- changing splashscreen color (png and cfg files)
- making restore splashscreens correspond to architecture
- making png files in syslinux/ same as isolinux/ in the CD
- fixing typo in cust-menu

1 #!/bin/bash
2 ##############################################################################
3 # #
4 # cust-menu, (C) 2007-2011 S. Georgaras <sng@hellug.gr> #
5 # #
6 # This file is part of Clonezilla-SysRescCD. #
7 # #
8 # Clonezilla-SysRescCD is free software: you can redistribute it and/or #
9 # modify it under the terms of the GNU General Public License as published #
10 # by the Free Software Foundation, either version 2 of the License, or #
11 # (at your option) any later version. #
12 # #
13 # Clonezilla-SysRescCD is distributed in the hope that it will be useful, #
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16 # GNU General Public License for more details. #
17 # #
18 # You should have received a copy of the GNU General Public License along #
19 # with Clonezilla-SysRescCD. If not, see <http://www.gnu.org/licenses/>. #
20 # #
21 ##############################################################################
22
23 function findCFGfile(){
24 if [ -e isolinux-restore-cd.cfg ];then
25 templateCFG="./isolinux-restore-cd.cfg"
26 elif [ -r /live/image/restorecd/isolinux-restore-cd.cfg ];then
27 templateCFG="/live/image/restorecd/isolinux-restore-cd.cfg"
28 elif [ -r /tmp/restorecd/isolinux-restore-cd.cfg ];then
29 templateCFG="/tmp/restorecd/isolinux-restore-cd.cfg"
30 elif [ -r /restorecd/isolinux-restore-cd.cfg ];then
31 templateCFG="/restorecd/isolinux-restore-cd.cfg"
32 else
33 whiptail --backtitle Clonezilla-SysRescCD --title " Execution Error " --msgbox "This is not a stand-alone script and should not be executed by the command line
34
35 This script will terminate now" 0 0
36 exit 1
37 fi
38 }
39
40 function find2RamCFGfile(){
41 if [ -e isolinux-restore-cd-ram.cfg ];then
42 templateCFG="./isolinux-restore-cd-ram.cfg"
43 elif [ -r /live/image/restorecd/isolinux-restore-cd-ram.cfg ];then
44 templateCFG="/live/image/restorecd/isolinux-restore-cd-ram.cfg"
45 elif [ -r /tmp/restorecd/isolinux-restore-cd-ram.cfg ];then
46 templateCFG="/tmp/restorecd/isolinux-restore-cd-ram.cfg"
47 elif [ -r /restorecd/isolinux-restore-cd-ram.cfg ];then
48 templateCFG="/restorecd/isolinux-restore-cd-ram.cfg"
49 else
50 whiptail --backtitle Clonezilla-SysRescCD --title " Execution Error " --msgbox "This is not a stand-alone script and should not be executed by the command line
51
52 This script will terminate now" 0 0
53 exit 1
54 fi
55 }
56
57 function import_parameters_to_cfg(){
58 # -> $1 - template cfg file
59 # <- $2 - final cfg file
60 local outCFG="$2".tmp
61 # read parameters inserted by the user
62 # they are found in the isolinux.cfg file
63 # created by Clonezilla Live
64 local paramLine=`grep 'append' $2 | sed '2,$d'`
65 local ocs_live_extra_param="$(echo "$paramLine" | sed 's|.*ocs_live_extra_param="\([^"]*\)".*|\1|')"
66 local ocs_live_keymap="$(echo "$paramLine" | sed 's|.*ocs_live_keymap="\([^"]*\)".*|\1|')"
67 local ocs_lang="$(echo "$paramLine" | sed 's|.*ocs_lang="\([^"]*\)".*|\1|')"
68
69 # replace with current values
70 sed "s|ocs_live_extra_param=\"[^\"]*\"|ocs_live_extra_param=\"$ocs_live_extra_param\"|
71 s|ocs_live_keymap=\"[^\"]*\"|ocs_live_keymap=\"$ocs_live_keymap\"|
72 s|ocs_lang=\"[^\"]*\"|ocs_lang=\"$ocs_lang\"|
73 " $1 > $outCFG && mv $outCFG $2
74 }
75
76 function copy_PNG_SYSLINUX(){
77 local targetPNG=/restorecd/ocswp.png
78 if [ -n "$bootImg" ];then targetPNG="$bootImg";fi
79 SYSLINUX_FILE=`echo $finalCFG | sed 's{isolinux{syslinux{g'`
80 SYS=`dirname $finalCFG`
81 sed 's{noprompt {{g' $finalCFG > $SYSLINUX_FILE
82 cp "$targetPNG" $SYS
83 cp "$targetPNG" `echo $SYS | sed 's{isolinux{syslinux{g'`
84 }
85
86
87 type=ISO
88
89 # Parse command-line options
90 while [ $# -gt 0 ]; do
91 case "$1" in
92 -publisher)
93 shift
94 if [ -z "$(echo $1 |grep ^-.)" ]; then
95 # skip the -xx option, in case
96 isoPublisher="$1"
97 shift
98 fi
99 # [ -z "$target_iso_prefix" ] && USAGE && exit 1
100 ;;
101 -V)
102 shift
103 if [ -z "$(echo $1 |grep ^-.)" ]; then
104 # skip the -xx option, in case
105 isoLabel="$1"
106 shift
107 fi
108 # [ -z "$target_iso_prefix" ] && USAGE && exit 1
109 ;;
110 -z)
111 type=ZIP
112 shift
113 ;;
114 -o)
115 ORIGINAL_INSERT_MODE=y
116 shift
117 ;;
118 *)
119 break;
120 ;;
121 esac
122 done
123
124
125
126
127
128 # # #
129 # # #
130 # # # the CFG file can be found as
131 # # # /tmp/ocs_isosys*/isolinux/isolinux.cfg
132 # # # or
133 # # # /home/partimag/ocs_isosys*/isolinux/isolinux.cfg
134 # # #
135 # # #
136
137 if [ "$type" = ISO ];then
138 type=ISO
139 # finalCFG=/tmp/ocs_isosys*/isolinux/isolinux.cfg
140 finalCFG=`find /tmp -name isolinux.cfg`
141 else
142 type=ZIP
143 # finalCFG=/home/partimag/ocs_isosys*/isolinux/isolinux.cfg
144 finalCFG=`find /home/partimag -name isolinux.cfg`
145 fi
146
147 if [ ! -e $finalCFG ];then
148 dialog --backtitle Clonezilla-SysRescCD --title " File not found " --msgbox " The original cfg file ($finalCFG) does not exit!!!
149
150 This script will terminate now" 0 0
151
152 exit 1
153 fi
154
155 # Check if -s has been used (only iso)
156 if [ -n "$ORIGINAL_INSERT_MODE" ];then
157 # When -s is used, do nothing
158 # findCFGfile
159 # import_parameters_to_cfg $templateCFG $finalCFG
160 # copy_PNG_SYSLINUX
161 exit
162 fi
163
164
165 whiptail --backtitle Clonezilla-SysRescCD --title ' Customization section ' --yesno "Do you want to further customize the $type file?
166
167 You will have the chance to change the Title and Text of the Boot Screen, and set the Default menu item and Boot Delay" 11 60
168
169 if [ $? -eq 1 ];then
170 CUSTOMIZE=no
171 fi
172
173
174 if [ "$1" = "prog_only" ];then
175 find2RamCFGfile
176 else
177 findCFGfile
178 fi
179
180
181 import_parameters_to_cfg $templateCFG $finalCFG
182
183
184 ##############################################################################
185 #
186 # Menu Customization
187 #
188 ##############################################################################
189
190 if [ -z "$CUSTOMIZE" ];then
191
192 if [ -e $HOME/.last-cust-menu-values ];then
193
194 whiptail --backtitle Clonezilla-SysRescCD --title ' Config found!!!' --yesno 'You can use the same values you inserted on a previous customization.
195
196 Do you want to use these values?' 11 45
197 if [ $? -eq 0 ];then
198 . $HOME/.last-cust-menu-values
199 useOldCustomizationValues=yes
200 fi
201 fi
202
203 # DVD Title
204 if [ -z "$useOldCustomizationValues" ];then
205 whiptail --backtitle Clonezilla-SysRescCD --title ' Menu Title ' --inputbox 'Insert the Title for the menu' 8 60 "$(grep 'MENU TITLE' $finalCFG | sed 's|^ *MENU TITLE *||' | sed 's| *||g')" 2>/tmp/answer
206 menuTitle=`cat /tmp/answer`
207 echo "menuTitle=$menuTitle" | sed 's/ /\\ /g' >> $HOME/.last-cust-menu-values
208 rm /tmp/answer 2>/dev/null
209
210
211
212 # Item caption
213 whiptail --backtitle Clonezilla-SysRescCD --title ' Menu Items Caption ' --inputbox 'Insert the Caption for each menu item' 8 60 'Clonezilla Live' 2>/tmp/answer
214 itemCaption=`cat /tmp/answer`
215 echo "itemCaption=$itemCaption" | sed 's/ /\\ /g' >> $HOME/.last-cust-menu-values
216
217 rm /tmp/answer 2>/dev/null
218
219
220 #
221 whiptail --backtitle Clonezilla-SysRescCD --title ' Boot delay ' --inputbox 'Insert the boot delay in seconds' 8 60 30 2>/tmp/answer
222 bootDelay=`cat /tmp/answer`
223 if [ "$bootDelay" = "30" ];then
224 bootDelay=''
225 fi
226 echo "bootDelay=$bootDelay" | sed 's/ /\\ /g' >> $HOME/.last-cust-menu-values
227 rm /tmp/answer 2>/dev/null
228
229
230
231
232 #
233 # Default boot item
234 #
235
236
237
238 echo "whiptail --backtitle Clonezilla-SysRescCD --title ' Default Boot Item ' --menu 'Select
239 Item 6 - Boot from the first hard disk
240 to maintain current setting
241 ' 0 60 0 \\" > /tmp/q.$$
242
243 grep 'MENU LABEL' "$templateCFG" | sed '/---/d' | sed 's|^.*MENU LABEL *||' | sed "s|^|'|" | sed "s|$|'|" | awk '{print NR " " ""$0"" " "}' | tr -d '\n$' > /tmp/qq.$$
244
245 oldCaption=`sed 's|^1 *.||' /tmp/qq.$$ | sed "s| *-.*||"`
246 echo "oldCaption=$oldCaption" | sed 's/ /\\ /g' >> $HOME/.last-cust-menu-values
247
248 if [ -n "$itemCaption" ];then
249 sed "s/$oldCaption/$itemCaption/g" /tmp/qq.$$ >> /tmp/q.$$
250 else
251 cat /tmp/qq.$$ >> /tmp/q.$$
252 fi
253
254 echo "2>/tmp/answer" >> /tmp/q.$$
255 rm /tmp/qq.$$
256 . /tmp/q.$$
257 rm /tmp/q.$$
258
259 defItem=`cat /tmp/answer`
260 if [ $defItem -gt 6 ];then ((defItem++));fi
261 ((defItem++))
262 #if [ $defItem -eq 6 ];then defItem='';fi
263 if [ $defItem -eq 7 ];then defItem='';fi
264 rm /tmp/answer 2>/dev/null
265 echo "defItem=$defItem" | sed 's/ /\\ /g' >> $HOME/.last-cust-menu-values
266
267
268 # Boot Screen Image
269 whiptail --backtitle Clonezilla-SysRescCD --title ' Boot Screen Image ' --inputbox 'Insert the Image to be displayed on the Boot Screen
270
271 The file must be a 640x480 32-bit png image' 0 60 ocswp.png 2>/tmp/answer
272 bootImage=`cat /tmp/answer`
273 if [ "$bootImage" = "ocswp.png" ];then
274 bootImage=''
275 fi
276 echo "bootImage=$bootImage" | sed 's/ /\\ /g' >> $HOME/.last-cust-menu-values
277 rm /tmp/answer 2>/dev/null
278
279
280
281
282 if [ "$type" = "ISO" ];then
283 # ISO Label
284 whiptail --backtitle Clonezilla-SysRescCD --title ' ISO Label ' --inputbox 'Insert the Volume Label of the ISO file' 0 60 "$isoLabel" 2>/tmp/answer
285 isoLabelTMP=`cat /tmp/answer`
286 if [ -z "$isoLabelTMP" ];then
287 isoLabelTMP="$isoLabel"
288 fi
289 echo "isoLabelTMP=$isoLabelTMP" | sed 's/ /\\ /g' >> $HOME/.last-cust-menu-values
290 rm /tmp/answer 2>/dev/null
291
292
293
294 # Publisher ID
295 whiptail --backtitle Clonezilla-SysRescCD --title ' Publisher ID ' --inputbox 'Insert the Publisher ID of the ISO file' 0 60 "$isoPublisher" 2>/tmp/answer
296 isoPublisherTMP=`cat /tmp/answer`
297 if [ -z "$isoPublisherTMP" ];then
298 isoPublisherTMP="$isoPublisher"
299 fi
300 echo "isoPublisherTMP=$isoPublisherTMP" | sed 's/ /\\ /g' >> $HOME/.last-cust-menu-values
301 rm /tmp/answer 2>/dev/null
302
303 echo "$isoLabelTMP" > /tmp/isodata
304 echo "$isoPublisherTMP" >> /tmp/isodata
305 fi
306
307
308 fi
309
310
311 ############################################################################
312 #
313 # Insert user data to file
314 #
315 ############################################################################
316
317
318
319 if [ -n "$menuTitle" ];then
320 sed "s|^ *MENU TITLE .*|MENU TITLE $menuTitle|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
321 fi
322
323 if [ -n "$itemCaption" ];then
324 sed "s|MENU LABEL *$oldCaption *-|MENU LABEL $itemCaption -|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
325 fi
326
327 if [ -n "$bootDelay" ];then
328 sed "s|[tT][iI][mM][eE][oO][uU][tT] .*| timeout "$bootDelay"0|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
329 fi
330
331 if [ -n "$defItem" ];then
332 sed 's|^ *MENU DEFAULT| # MENU DEFAULT|' $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
333 addIt=`grep -n 'MENU DEFAULT' $finalCFG | sed 's|:.*||' | sed -n ""$defItem"p"`
334 sed ""$addIt"s|# *MENU *DEFAULT|MENU DEFAULT|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
335 fi
336
337
338 if [ -n "$bootImage" ];then
339 if [ -e "$bootImage" ] || [ -e /home/partimag/"$bootImage" ] ;then
340 bootImg="$bootImage"
341 fi
342 fi
343
344 fi
345
346 copy_PNG_SYSLINUX
347
348

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26