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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 178 - (hide annotations)
Fri Jun 3 17:27:54 2011 UTC (9 years, 10 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 sng 47 #!/bin/bash
2     ##############################################################################
3     # #
4 sng 177 # cust-menu, (C) 2007-2011 S. Georgaras <sng@hellug.gr> #
5 sng 47 # #
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 sng 93 function findCFGfile(){
24 sng 47 if [ -e isolinux-restore-cd.cfg ];then
25 sng 93 templateCFG="./isolinux-restore-cd.cfg"
26 sng 47 elif [ -r /live/image/restorecd/isolinux-restore-cd.cfg ];then
27 sng 93 templateCFG="/live/image/restorecd/isolinux-restore-cd.cfg"
28 sng 47 elif [ -r /tmp/restorecd/isolinux-restore-cd.cfg ];then
29 sng 93 templateCFG="/tmp/restorecd/isolinux-restore-cd.cfg"
30     elif [ -r /restorecd/isolinux-restore-cd.cfg ];then
31     templateCFG="/restorecd/isolinux-restore-cd.cfg"
32 sng 47 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 sng 93 function find2RamCFGfile(){
41 sng 47 if [ -e isolinux-restore-cd-ram.cfg ];then
42 sng 93 templateCFG="./isolinux-restore-cd-ram.cfg"
43 sng 47 elif [ -r /live/image/restorecd/isolinux-restore-cd-ram.cfg ];then
44 sng 93 templateCFG="/live/image/restorecd/isolinux-restore-cd-ram.cfg"
45 sng 47 elif [ -r /tmp/restorecd/isolinux-restore-cd-ram.cfg ];then
46 sng 93 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 sng 47 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 sng 93 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 sng 47
69 sng 93 # 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 sng 134 local targetPNG=/restorecd/ocswp.png
78     if [ -n "$bootImg" ];then targetPNG="$bootImg";fi
79 sng 93 SYSLINUX_FILE=`echo $finalCFG | sed 's{isolinux{syslinux{g'`
80     SYS=`dirname $finalCFG`
81     sed 's{noprompt {{g' $finalCFG > $SYSLINUX_FILE
82 sng 134 cp "$targetPNG" $SYS
83     cp "$targetPNG" `echo $SYS | sed 's{isolinux{syslinux{g'`
84 sng 93 }
85    
86    
87     type=ISO
88    
89 sng 47 # 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 sng 93 -z)
111     type=ZIP
112     shift
113     ;;
114     -o)
115     ORIGINAL_INSERT_MODE=y
116     shift
117     ;;
118 sng 47 *)
119     break;
120     ;;
121     esac
122     done
123    
124    
125    
126    
127    
128     # # #
129     # # #
130     # # # the CFG file can be found as
131 sng 93 # # # /tmp/ocs_isosys*/isolinux/isolinux.cfg
132 sng 47 # # # or
133 sng 93 # # # /home/partimag/ocs_isosys*/isolinux/isolinux.cfg
134 sng 47 # # #
135     # # #
136 sng 84
137 sng 93 if [ "$type" = ISO ];then
138 sng 47 type=ISO
139 sng 95 # finalCFG=/tmp/ocs_isosys*/isolinux/isolinux.cfg
140 sng 93 finalCFG=`find /tmp -name isolinux.cfg`
141 sng 47 else
142     type=ZIP
143 sng 95 # finalCFG=/home/partimag/ocs_isosys*/isolinux/isolinux.cfg
144 sng 93 finalCFG=`find /home/partimag -name isolinux.cfg`
145 sng 47 fi
146    
147 sng 93 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 sng 47
152 sng 93 exit 1
153     fi
154    
155     # Check if -s has been used (only iso)
156     if [ -n "$ORIGINAL_INSERT_MODE" ];then
157 sng 95 # When -s is used, do nothing
158     # findCFGfile
159     # import_parameters_to_cfg $templateCFG $finalCFG
160     # copy_PNG_SYSLINUX
161 sng 93 exit
162     fi
163    
164    
165 sng 47 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 sng 93 CUSTOMIZE=no
171 sng 47 fi
172    
173    
174     if [ "$1" = "prog_only" ];then
175 sng 93 find2RamCFGfile
176 sng 47 else
177 sng 93 findCFGfile
178 sng 47 fi
179 sng 93
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 sng 177 if [ -e $HOME/.last-cust-menu-values ];then
193    
194 sng 178 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 sng 177 if [ $? -eq 0 ];then
198     . $HOME/.last-cust-menu-values
199     useOldCustomizationValues=yes
200     fi
201     fi
202 sng 47
203 sng 177 # 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 sng 47
219    
220 sng 177 #
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 sng 47
229    
230    
231    
232 sng 177 #
233     # Default boot item
234     #
235    
236    
237    
238     echo "whiptail --backtitle Clonezilla-SysRescCD --title ' Default Boot Item ' --menu 'Select
239 sng 47 Item 6 - Boot from the first hard disk
240     to maintain current setting
241     ' 0 60 0 \\" > /tmp/q.$$
242 sng 177
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 sng 47
267    
268 sng 177 # 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 sng 47
279    
280    
281    
282 sng 177 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 sng 47
307    
308     fi
309    
310    
311 sng 93 ############################################################################
312     #
313     # Insert user data to file
314     #
315     ############################################################################
316 sng 47
317    
318    
319     if [ -n "$menuTitle" ];then
320 sng 93 sed "s|^ *MENU TITLE .*|MENU TITLE $menuTitle|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
321 sng 47 fi
322    
323     if [ -n "$itemCaption" ];then
324 sng 93 sed "s|MENU LABEL *$oldCaption *-|MENU LABEL $itemCaption -|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
325 sng 47 fi
326    
327     if [ -n "$bootDelay" ];then
328 sng 93 sed "s|[tT][iI][mM][eE][oO][uU][tT] .*| timeout "$bootDelay"0|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
329 sng 47 fi
330    
331     if [ -n "$defItem" ];then
332 sng 93 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 sng 47 fi
336    
337    
338 sng 134 if [ -n "$bootImage" ];then
339     if [ -e "$bootImage" ] || [ -e /home/partimag/"$bootImage" ] ;then
340     bootImg="$bootImage"
341     fi
342 sng 47 fi
343    
344 sng 93 fi
345 sng 47
346 sng 93 copy_PNG_SYSLINUX
347 sng 47
348 sng 177

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26