/[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 95 - (hide annotations)
Fri Aug 13 14:09:29 2010 UTC (13 years, 7 months ago) by sng
File size: 10010 byte(s)
Updating site and the following files:
trunk/www/working/download.html
  added download links
trunk/www/working/.template.html
  added link to download.html
trunk/www/working/index.html
  removed download section
files/*
  fixes for restore ZIP creation

1 sng 47 #!/bin/bash
2     ##############################################################################
3     # #
4     # cust-menu, (C) 2007-2010 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 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     SYSLINUX_FILE=`echo $finalCFG | sed 's{isolinux{syslinux{g'`
78     SYS=`dirname $finalCFG`
79     sed 's{noprompt {{g' $finalCFG > $SYSLINUX_FILE
80     cp /restorecd/ocswp.png $SYS
81     cp /restorecd/ocswp.png `echo $SYS | sed 's{isolinux{syslinux{g'`
82     }
83    
84    
85     type=ISO
86    
87 sng 47 # Parse command-line options
88     while [ $# -gt 0 ]; do
89     case "$1" in
90     -publisher)
91     shift
92     if [ -z "$(echo $1 |grep ^-.)" ]; then
93     # skip the -xx option, in case
94     isoPublisher="$1"
95     shift
96     fi
97     # [ -z "$target_iso_prefix" ] && USAGE && exit 1
98     ;;
99     -V)
100     shift
101     if [ -z "$(echo $1 |grep ^-.)" ]; then
102     # skip the -xx option, in case
103     isoLabel="$1"
104     shift
105     fi
106     # [ -z "$target_iso_prefix" ] && USAGE && exit 1
107     ;;
108 sng 93 -z)
109     type=ZIP
110     shift
111     ;;
112     -o)
113     ORIGINAL_INSERT_MODE=y
114     shift
115     ;;
116 sng 47 *)
117     break;
118     ;;
119     esac
120     done
121    
122    
123    
124    
125    
126     # # #
127     # # #
128     # # # the CFG file can be found as
129 sng 93 # # # /tmp/ocs_isosys*/isolinux/isolinux.cfg
130 sng 47 # # # or
131 sng 93 # # # /home/partimag/ocs_isosys*/isolinux/isolinux.cfg
132 sng 47 # # #
133     # # #
134 sng 84
135 sng 93 if [ "$type" = ISO ];then
136 sng 47 type=ISO
137 sng 95 # finalCFG=/tmp/ocs_isosys*/isolinux/isolinux.cfg
138 sng 93 finalCFG=`find /tmp -name isolinux.cfg`
139 sng 47 else
140     type=ZIP
141 sng 95 # finalCFG=/home/partimag/ocs_isosys*/isolinux/isolinux.cfg
142 sng 93 finalCFG=`find /home/partimag -name isolinux.cfg`
143 sng 47 fi
144    
145 sng 93 if [ ! -e $finalCFG ];then
146     dialog --backtitle Clonezilla-SysRescCD --title " File not found " --msgbox " The original cfg file ($finalCFG) does not exit!!!
147    
148     This script will terminate now" 0 0
149 sng 47
150 sng 93 exit 1
151     fi
152    
153     # Check if -s has been used (only iso)
154     if [ -n "$ORIGINAL_INSERT_MODE" ];then
155 sng 95 # When -s is used, do nothing
156     # findCFGfile
157     # import_parameters_to_cfg $templateCFG $finalCFG
158     # copy_PNG_SYSLINUX
159 sng 93 exit
160     fi
161    
162    
163 sng 47 whiptail --backtitle Clonezilla-SysRescCD --title ' Customization section ' --yesno "Do you want to further customize the $type file?
164    
165     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
166    
167     if [ $? -eq 1 ];then
168 sng 93 CUSTOMIZE=no
169 sng 47 fi
170    
171    
172     if [ "$1" = "prog_only" ];then
173 sng 93 find2RamCFGfile
174 sng 47 else
175 sng 93 findCFGfile
176 sng 47 fi
177 sng 93
178    
179     import_parameters_to_cfg $templateCFG $finalCFG
180    
181    
182     ##############################################################################
183     #
184     # Menu Customization
185     #
186     ##############################################################################
187    
188     if [ -z "$CUSTOMIZE" ];then
189    
190 sng 47 # DVD Title
191 sng 93 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
192 sng 47 menuTitle=`cat /tmp/answer`
193    
194     rm /tmp/answer 2>/dev/null
195    
196    
197    
198     # Item caption
199     whiptail --backtitle Clonezilla-SysRescCD --title ' Menu Items Caption ' --inputbox 'Insert the Caption for each manu item' 8 60 'Clonezilla Live' 2>/tmp/answer
200     itemCaption=`cat /tmp/answer`
201    
202     rm /tmp/answer 2>/dev/null
203    
204    
205     #
206     whiptail --backtitle Clonezilla-SysRescCD --title ' Boot delay ' --inputbox 'Insert the boot delay in seconds' 8 60 30 2>/tmp/answer
207     bootDelay=`cat /tmp/answer`
208     if [ "$bootDelay" = "30" ];then
209     bootDelay=''
210     fi
211     rm /tmp/answer 2>/dev/null
212    
213    
214    
215    
216     #
217     # Default boot item
218     #
219    
220    
221    
222     echo "whiptail --backtitle Clonezilla-SysRescCD --title ' Default Boot Item ' --menu 'Select
223     Item 6 - Boot from the first hard disk
224     to maintain current setting
225     ' 0 60 0 \\" > /tmp/q.$$
226    
227 sng 93 grep 'MENU LABEL' "$templateCFG" | sed '/---/d' | sed 's|^.*MENU LABEL *||' | sed "s|^|'|" | sed "s|$|'|" | awk '{print NR " " ""$0"" " "}' | tr -d '\n$' > /tmp/qq.$$
228 sng 47
229     oldCaption=`sed 's|^1 *.||' /tmp/qq.$$ | sed "s| *-.*||"`
230    
231     if [ -n "$itemCaption" ];then
232     sed "s/$oldCaption/$itemCaption/g" /tmp/qq.$$ >> /tmp/q.$$
233     else
234     cat /tmp/qq.$$ >> /tmp/q.$$
235     fi
236    
237     echo "2>/tmp/answer" >> /tmp/q.$$
238     rm /tmp/qq.$$
239     . /tmp/q.$$
240     rm /tmp/q.$$
241    
242     defItem=`cat /tmp/answer`
243     if [ $defItem -gt 6 ];then ((defItem++));fi
244 sng 93 ((defItem++))
245     #if [ $defItem -eq 6 ];then defItem='';fi
246     if [ $defItem -eq 7 ];then defItem='';fi
247 sng 47 rm /tmp/answer 2>/dev/null
248    
249    
250     # Boot Screen Image
251     whiptail --backtitle Clonezilla-SysRescCD --title ' Boot Screen Image ' --inputbox 'Insert the Image to be displayed on the Boot Screen
252    
253     The file must be a 640x480 32-bit png image' 0 60 ocswp.png 2>/tmp/answer
254     bootImage=`cat /tmp/answer`
255     if [ "$bootImage" = "ocswp.png" ];then
256     bootImage=''
257     fi
258     rm /tmp/answer 2>/dev/null
259    
260    
261    
262    
263     if [ "$type" = "ISO" ];then
264     # ISO Label
265     whiptail --backtitle Clonezilla-SysRescCD --title ' ISO Label ' --inputbox 'Insert the Volume Label of the ISO file' 0 60 "$isoLabel" 2>/tmp/answer
266     isoLabelTMP=`cat /tmp/answer`
267     if [ -z "$isoLabelTMP" ];then
268     isoLabelTMP="$isoLabel"
269     fi
270     rm /tmp/answer 2>/dev/null
271    
272    
273    
274     # Publisher ID
275     whiptail --backtitle Clonezilla-SysRescCD --title ' Publisher ID ' --inputbox 'Insert the Publisher ID of the ISO file' 0 60 "$isoPublisher" 2>/tmp/answer
276     isoPublisherTMP=`cat /tmp/answer`
277     if [ -z "$isoPublisherTMP" ];then
278     isoPublisherTMP="$isoPublisher"
279     fi
280     rm /tmp/answer 2>/dev/null
281    
282     echo "$isoLabelTMP" > /tmp/isodata
283     echo "$isoPublisherTMP" >> /tmp/isodata
284     fi
285    
286    
287    
288    
289    
290 sng 93 ############################################################################
291     #
292     # Insert user data to file
293     #
294     ############################################################################
295 sng 47
296    
297    
298     if [ -n "$menuTitle" ];then
299 sng 93 sed "s|^ *MENU TITLE .*|MENU TITLE $menuTitle|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
300 sng 47 fi
301    
302     if [ -n "$itemCaption" ];then
303 sng 93 sed "s|MENU LABEL *$oldCaption *-|MENU LABEL $itemCaption -|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
304 sng 47 fi
305    
306     if [ -n "$bootDelay" ];then
307 sng 93 sed "s|[tT][iI][mM][eE][oO][uU][tT] .*| timeout "$bootDelay"0|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
308 sng 47 fi
309    
310     if [ -n "$defItem" ];then
311 sng 93 sed 's|^ *MENU DEFAULT| # MENU DEFAULT|' $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
312     addIt=`grep -n 'MENU DEFAULT' $finalCFG | sed 's|:.*||' | sed -n ""$defItem"p"`
313     sed ""$addIt"s|# *MENU *DEFAULT|MENU DEFAULT|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
314 sng 47 fi
315    
316    
317     if [ -n "$bootImage" ] && [ -e "$bootImage" ] ;then
318     bootImg="$bootImage"
319     fi
320    
321    
322 sng 93 fi
323 sng 47
324 sng 93 copy_PNG_SYSLINUX
325 sng 47

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26