/[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 47 - (show annotations)
Thu May 20 12:12:53 2010 UTC (13 years, 10 months ago) by sng
File size: 8873 byte(s)
adding release scripts

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 copyCFGfile(){
24 if [ -e isolinux-restore-cd.cfg ];then
25 inFile="./isolinux-restore-cd.cfg"
26 elif [ -r /live/image/restorecd/isolinux-restore-cd.cfg ];then
27 inFile="/live/image/restorecd/isolinux-restore-cd.cfg"
28 elif [ -r /tmp/restorecd/isolinux-restore-cd.cfg ];then
29 inFile="/tmp/restorecd/isolinux-restore-cd.cfg"
30 else
31 whiptail --backtitle Clonezilla-SysRescCD --title " Execution Error " --msgbox "This is not a stand-alone script and should not be executed by the command line
32
33 This script will terminate now" 0 0
34 exit 1
35 fi
36 cp "$inFile" /tmp/isolinux-mine.cfg
37 bootImg="$(dirname "$inFile")"/ocswp.png
38 inFile='/tmp/isolinux-mine.cfg'
39 }
40
41 function copy2RamCFGfile(){
42 if [ -e isolinux-restore-cd-ram.cfg ];then
43 inFile="./isolinux-restore-cd-ram.cfg"
44 elif [ -r /live/image/restorecd/isolinux-restore-cd-ram.cfg ];then
45 inFile="/live/image/restorecd/isolinux-restore-cd-ram.cfg"
46 elif [ -r /tmp/restorecd/isolinux-restore-cd-ram.cfg ];then
47 inFile="/tmp/restorecd/isolinux-restore-cd-ram.cfg"
48 else
49 whiptail --backtitle Clonezilla-SysRescCD --title " Execution Error " --msgbox "This is not a stand-alone script and should not be executed by the command line
50
51 This script will terminate now" 0 0
52 exit 1
53 fi
54 cp "$inFile" /tmp/isolinux-mine.cfg
55 bootImg="$(dirname "$inFile")"/ocswp.png
56 inFile='/tmp/isolinux-mine.cfg'
57 }
58
59
60 # Parse command-line options
61 while [ $# -gt 0 ]; do
62 case "$1" in
63 -publisher)
64 shift
65 if [ -z "$(echo $1 |grep ^-.)" ]; then
66 # skip the -xx option, in case
67 isoPublisher="$1"
68 shift
69 fi
70 # [ -z "$target_iso_prefix" ] && USAGE && exit 1
71 ;;
72 -V)
73 shift
74 if [ -z "$(echo $1 |grep ^-.)" ]; then
75 # skip the -xx option, in case
76 isoLabel="$1"
77 shift
78 fi
79 # [ -z "$target_iso_prefix" ] && USAGE && exit 1
80 ;;
81 *)
82 break;
83 ;;
84 esac
85 done
86
87
88
89
90
91 # # #
92 # # #
93 # # # the CFG file can be found as
94 # # # /tmp/isolnx.*/isolinux/isolinux.cfg
95 # # # or
96 # # # /home/partimag/usb-dev.*/syslinux/syslinux.cfg
97 # # #
98 # # #
99 if [ -e /tmp/isolnx.*/isolinux/isolinux.cfg ];then
100 type=ISO
101 origCFG="/tmp/isolnx.*/isolinux/isolinux.cfg"
102 elif [ -e /home/partimag/usb-dev.*/syslinux/syslinux.cfg ];then
103 type=ZIP
104 origCFG="/home/partimag/usb-dev.*/syslinux/syslinux.cfg"
105 else
106 origCFG=''
107 type=ZIP
108
109 # dialog --backtitle Clonezilla-SysRescCD --title " Execution Error " --msgbox "This is not a stand-alone script and should not be executed by the command line
110 #
111 # This script will terminate now" 0 0
112 # exit 1
113 fi
114
115
116 whiptail --backtitle Clonezilla-SysRescCD --title ' Customization section ' --yesno "Do you want to further customize the $type file?
117
118 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
119
120 if [ $? -eq 1 ];then
121 exit
122 fi
123
124
125 if [ "$1" = "prog_only" ];then
126 copy2RamCFGfile
127 else
128 copyCFGfile
129 fi
130 # DVD Title
131 whiptail --backtitle Clonezilla-SysRescCD --title ' DVD Title ' --inputbox 'Insert the Title for the menu' 8 60 "$(grep 'MENU TITLE' "$inFile" | sed 's|^ *MENU TITLE *||' | sed 's| *||g')" 2>/tmp/answer
132 menuTitle=`cat /tmp/answer`
133
134 rm /tmp/answer 2>/dev/null
135
136
137
138 # Item caption
139 whiptail --backtitle Clonezilla-SysRescCD --title ' Menu Items Caption ' --inputbox 'Insert the Caption for each manu item' 8 60 'Clonezilla Live' 2>/tmp/answer
140 itemCaption=`cat /tmp/answer`
141
142 rm /tmp/answer 2>/dev/null
143
144
145 #
146 whiptail --backtitle Clonezilla-SysRescCD --title ' Boot delay ' --inputbox 'Insert the boot delay in seconds' 8 60 30 2>/tmp/answer
147 bootDelay=`cat /tmp/answer`
148 if [ "$bootDelay" = "30" ];then
149 bootDelay=''
150 fi
151 rm /tmp/answer 2>/dev/null
152
153
154
155
156 #
157 # Default boot item
158 #
159
160
161
162 echo "whiptail --backtitle Clonezilla-SysRescCD --title ' Default Boot Item ' --menu 'Select
163 Item 6 - Boot from the first hard disk
164 to maintain current setting
165 ' 0 60 0 \\" > /tmp/q.$$
166
167 grep 'MENU LABEL' "$inFile" | sed '/---/d' | sed 's|^.*MENU LABEL *||' | sed "s|^|'|" | sed "s|$|'|" | awk '{print NR " " ""$0"" " "}' | tr -d '\n$' > /tmp/qq.$$
168
169 oldCaption=`sed 's|^1 *.||' /tmp/qq.$$ | sed "s| *-.*||"`
170
171 if [ -n "$itemCaption" ];then
172 sed "s/$oldCaption/$itemCaption/g" /tmp/qq.$$ >> /tmp/q.$$
173 else
174 cat /tmp/qq.$$ >> /tmp/q.$$
175 fi
176
177 echo "2>/tmp/answer" >> /tmp/q.$$
178 rm /tmp/qq.$$
179 . /tmp/q.$$
180 rm /tmp/q.$$
181
182 defItem=`cat /tmp/answer`
183 if [ $defItem -gt 6 ];then ((defItem++));fi
184 if [ $defItem -eq 6 ];then defItem='';fi
185 rm /tmp/answer 2>/dev/null
186
187
188 # Boot Screen Image
189 whiptail --backtitle Clonezilla-SysRescCD --title ' Boot Screen Image ' --inputbox 'Insert the Image to be displayed on the Boot Screen
190
191 The file must be a 640x480 32-bit png image' 0 60 ocswp.png 2>/tmp/answer
192 bootImage=`cat /tmp/answer`
193 if [ "$bootImage" = "ocswp.png" ];then
194 bootImage=''
195 fi
196 rm /tmp/answer 2>/dev/null
197
198
199
200
201 if [ "$type" = "ISO" ];then
202 # ISO Label
203 whiptail --backtitle Clonezilla-SysRescCD --title ' ISO Label ' --inputbox 'Insert the Volume Label of the ISO file' 0 60 "$isoLabel" 2>/tmp/answer
204 isoLabelTMP=`cat /tmp/answer`
205 if [ -z "$isoLabelTMP" ];then
206 isoLabelTMP="$isoLabel"
207 fi
208 rm /tmp/answer 2>/dev/null
209
210
211
212 # Publisher ID
213 whiptail --backtitle Clonezilla-SysRescCD --title ' Publisher ID ' --inputbox 'Insert the Publisher ID of the ISO file' 0 60 "$isoPublisher" 2>/tmp/answer
214 isoPublisherTMP=`cat /tmp/answer`
215 if [ -z "$isoPublisherTMP" ];then
216 isoPublisherTMP="$isoPublisher"
217 fi
218 rm /tmp/answer 2>/dev/null
219
220 echo "$isoLabelTMP" > /tmp/isodata
221 echo "$isoPublisherTMP" >> /tmp/isodata
222 fi
223
224
225
226
227
228
229
230
231
232 if [ -n "$menuTitle" ];then
233 sed "s|^ *MENU TITLE .*|MENU TITLE $menuTitle|" "$inFile" > "$inFile".$$ && mv "$inFile".$$ "$inFile"
234 fi
235
236 if [ -n "$itemCaption" ];then
237 sed "s|MENU LABEL *$oldCaption *-|MENU LABEL $itemCaption -|" "$inFile" > "$inFile".$$ && mv "$inFile".$$ "$inFile"
238 fi
239
240 if [ -n "$bootDelay" ];then
241 sed "s|[tT][iI][mM][eE][oO][uU][tT] .*| timeout "$bootDelay"0|" "$inFile" > "$inFile".$$ && mv "$inFile".$$ "$inFile"
242 fi
243
244 if [ -n "$defItem" ];then
245 sed 's|^ *MENU DEFAULT| # MENU DEFAULT|' "$inFile" > "$inFile".$$
246 addIt=`grep -n 'MENU DEFAULT' "$inFile".$$ | sed 's|:.*||' | sed -n ""$defItem"p"`
247 sed ""$addIt"s|# *MENU *DEFAULT|MENU DEFAULT|" "$inFile".$$ > "$inFile"
248 fi
249
250
251 if [ -n "$bootImage" ] && [ -e "$bootImage" ] ;then
252 bootImg="$bootImage"
253 fi
254
255
256 # read parameters inserted by the user
257 # they are found in the isolinux.cfg file
258 # created by Clonezilla Live
259 paramLine=`grep 'append' $origCFG | sed '2,$d'`
260 ocs_live_extra_param="$(echo "$paramLine" | sed 's|.*ocs_live_extra_param="\([^"]*\)".*|\1|')"
261 ocs_live_keymap="$(echo "$paramLine" | sed 's|.*ocs_live_keymap="\([^"]*\)".*|\1|')"
262 ocs_lang="$(echo "$paramLine" | sed 's|.*ocs_lang="\([^"]*\)".*|\1|')"
263
264
265 # replace with current values
266 sed "s|ocs_live_extra_param=\"[^\"]*\"|ocs_live_extra_param=\"$ocs_live_extra_param\"|
267 s|ocs_live_keymap=\"[^\"]*\"|ocs_live_keymap=\"$ocs_live_keymap\"|
268 s|ocs_lang=\"[^\"]*\"|ocs_lang=\"$ocs_lang\"|
269 " "$inFile" > "$inFile".$$ && mv "$inFile".$$ "$inFile"
270
271
272
273
274 if [ "$type" = "ISO" ];then
275 cp "$inFile" /tmp/isolnx.*/isolinux/isolinux.cfg
276 cp "$bootImg" /tmp/isolnx.*/isolinux
277 else
278 cp "$inFile" /home/partimag/usb-dev.*/syslinux/syslinux.cfg
279 cp "$bootImg" /home/partimag/usb-dev.*
280 fi
281
282 rm "$inFile"

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26