/[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 95 - (show 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 #!/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 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 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 # 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 -z)
109 type=ZIP
110 shift
111 ;;
112 -o)
113 ORIGINAL_INSERT_MODE=y
114 shift
115 ;;
116 *)
117 break;
118 ;;
119 esac
120 done
121
122
123
124
125
126 # # #
127 # # #
128 # # # the CFG file can be found as
129 # # # /tmp/ocs_isosys*/isolinux/isolinux.cfg
130 # # # or
131 # # # /home/partimag/ocs_isosys*/isolinux/isolinux.cfg
132 # # #
133 # # #
134
135 if [ "$type" = ISO ];then
136 type=ISO
137 # finalCFG=/tmp/ocs_isosys*/isolinux/isolinux.cfg
138 finalCFG=`find /tmp -name isolinux.cfg`
139 else
140 type=ZIP
141 # finalCFG=/home/partimag/ocs_isosys*/isolinux/isolinux.cfg
142 finalCFG=`find /home/partimag -name isolinux.cfg`
143 fi
144
145 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
150 exit 1
151 fi
152
153 # Check if -s has been used (only iso)
154 if [ -n "$ORIGINAL_INSERT_MODE" ];then
155 # When -s is used, do nothing
156 # findCFGfile
157 # import_parameters_to_cfg $templateCFG $finalCFG
158 # copy_PNG_SYSLINUX
159 exit
160 fi
161
162
163 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 CUSTOMIZE=no
169 fi
170
171
172 if [ "$1" = "prog_only" ];then
173 find2RamCFGfile
174 else
175 findCFGfile
176 fi
177
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 # DVD Title
191 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 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 grep 'MENU LABEL' "$templateCFG" | sed '/---/d' | sed 's|^.*MENU LABEL *||' | sed "s|^|'|" | sed "s|$|'|" | awk '{print NR " " ""$0"" " "}' | tr -d '\n$' > /tmp/qq.$$
228
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 ((defItem++))
245 #if [ $defItem -eq 6 ];then defItem='';fi
246 if [ $defItem -eq 7 ];then defItem='';fi
247 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 ############################################################################
291 #
292 # Insert user data to file
293 #
294 ############################################################################
295
296
297
298 if [ -n "$menuTitle" ];then
299 sed "s|^ *MENU TITLE .*|MENU TITLE $menuTitle|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
300 fi
301
302 if [ -n "$itemCaption" ];then
303 sed "s|MENU LABEL *$oldCaption *-|MENU LABEL $itemCaption -|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
304 fi
305
306 if [ -n "$bootDelay" ];then
307 sed "s|[tT][iI][mM][eE][oO][uU][tT] .*| timeout "$bootDelay"0|" $finalCFG > $finalCFG.$$ && mv $finalCFG.$$ $finalCFG
308 fi
309
310 if [ -n "$defItem" ];then
311 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 fi
315
316
317 if [ -n "$bootImage" ] && [ -e "$bootImage" ] ;then
318 bootImg="$bootImage"
319 fi
320
321
322 fi
323
324 copy_PNG_SYSLINUX
325

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26