1 |
sng |
62 |
############################################################################## |
2 |
|
|
# # |
3 |
|
|
# patch-clonezilla-sysresccd, (C) 2007-2010 S. Georgaras <sng@hellug.gr> # |
4 |
|
|
# # |
5 |
|
|
# This file is part of Clonezilla-SysRescCD. # |
6 |
|
|
# # |
7 |
|
|
# Clonezilla-SysRescCD is free software: you can redistribute it and/or # |
8 |
|
|
# modify it under the terms of the GNU General Public License as published # |
9 |
|
|
# by the Free Software Foundation, either version 2 of the License, or # |
10 |
|
|
# (at your option) any later version. # |
11 |
|
|
# # |
12 |
|
|
# Clonezilla-SysRescCD is distributed in the hope that it will be useful, # |
13 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of # |
14 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
15 |
|
|
# GNU General Public License for more details. # |
16 |
|
|
# # |
17 |
|
|
# You should have received a copy of the GNU General Public License along # |
18 |
|
|
# with Clonezilla-SysRescCD. If not, see <http://www.gnu.org/licenses/>. # |
19 |
|
|
# # |
20 |
|
|
############################################################################## |
21 |
|
|
function noRoot(){ |
22 |
|
|
echo " Error: You must be root to execute this script" |
23 |
|
|
exit 1 |
24 |
|
|
} |
25 |
|
|
|
26 |
|
|
function printHelp(){ |
27 |
|
|
printVersion |
28 |
|
|
echo "Usage: $(basename $0) [options] |
29 |
|
|
|
30 |
|
|
Available options are: |
31 |
|
|
i [file / device] input file or cdrom device |
32 |
|
|
o [iso file] outpup ISO file. If not specified, implies burn ISO file (-b) |
33 |
|
|
and delete ISO file (-d) |
34 |
|
|
s [png image] boot splash screen |
35 |
|
|
r [png image] restore splash screen |
36 |
|
|
t [title] boot screen title |
37 |
|
|
p [partition] partition to be used as temporary storage location and/or final |
38 |
|
|
ISO file creation location (e.g -p hda) |
39 |
|
|
l [language] Change default language to [language] |
40 |
|
|
k [keymap] Change default keymap to [keymap] |
41 |
|
|
n Do not create/burn the ISO file. Just make the modified files |
42 |
|
|
available for further customization (optional) |
43 |
|
|
b burn ISO file to CD (optional) |
44 |
|
|
f burn ISO file to CD on the fly (optional) |
45 |
|
|
w writter device to use (optional) |
46 |
|
|
d delete ISO file after burning to CD. |
47 |
|
|
Implies burn ISO file (-b) (optional) |
48 |
|
|
v print version and exit |
49 |
|
|
h print this screen and exit |
50 |
|
|
" |
51 |
|
|
} |
52 |
|
|
|
53 |
|
|
function printVersion(){ |
54 |
|
|
echo "$(basename $0) - v $version |
55 |
|
|
(C) 2008-2009, Spiros Georgaras <sng@hellug.gr> |
56 |
|
|
|
57 |
|
|
A utility to personalize Clonezilla-SysRescCD |
58 |
|
|
" |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
function rotate_line(){ |
62 |
|
|
INTERVAL=1 # Sleep time between “twirls" |
63 |
|
|
TCOUNT=0 # For each TCOUNT the line twirls one increment |
64 |
|
|
echo -n '(' |
65 |
|
|
while : # Loop forever...until this function is killed |
66 |
|
|
do |
67 |
|
|
TCOUNT=$((TCOUNT+1)) # Increment the TCOUNT |
68 |
|
|
case $TCOUNT in |
69 |
|
|
"1") echo -e '-)'"\b\b\c" |
70 |
|
|
COUNTER_ACTIVE='y' |
71 |
|
|
sleep $INTERVAL |
72 |
|
|
;; |
73 |
|
|
"2") echo -e '\\)'"\b\b\c" |
74 |
|
|
sleep $INTERVAL |
75 |
|
|
;; |
76 |
|
|
"3") echo -e "|)\b\b\c" |
77 |
|
|
sleep $INTERVAL |
78 |
|
|
;; |
79 |
|
|
"4") echo -e "/)\b\b\c" |
80 |
|
|
sleep $INTERVAL |
81 |
|
|
;; |
82 |
|
|
*) TCOUNT=0 ;; # Reset the TCOUNT to “0", zero. |
83 |
|
|
esac |
84 |
|
|
done |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
function isClonezillaSysRescCDRunning(){ |
88 |
|
|
if [ -e /live/image/README.txt ] || [ -e /mnt/livecd/README.txt ];then |
89 |
|
|
ClonezillaSysRescCDRunning='y' |
90 |
|
|
fi |
91 |
|
|
} |
92 |
|
|
|
93 |
|
|
|
94 |
|
|
function cleanUp(){ |
95 |
|
|
cd |
96 |
|
|
echo -n "Cleanning up... " |
97 |
|
|
[ -z "$inputFileMounted" ] || umount "$mountPoint" 2>/dev/null |
98 |
|
|
[ -z "$mountPointCreated" ] || rmdir "$mountPoint" 2>/dev/null |
99 |
|
|
[ -z "$savePartitionMounted" ] || umount "$savePartition" 2>/dev/null |
100 |
|
|
[ -z "$newIsoCreated" ] || { |
101 |
|
|
[ -z "$keepFiles" ] && rm -rf "$savePartitionMountPoint"/new-iso 2>/dev/null |
102 |
|
|
} |
103 |
|
|
[ -z "$savePartitionMountPointCreated" ] || { |
104 |
|
|
rmdir "$savePartitionMountPoint"/new-iso 2>/dev/null |
105 |
|
|
rmdir "$savePartitionMountPoint" 2>/dev/null |
106 |
|
|
} |
107 |
|
|
echo "done" |
108 |
|
|
} |
109 |
|
|
|
110 |
|
|
####### Script starts here ####### |
111 |
|
|
|
112 |
|
|
# set -x |
113 |
|
|
while getopts ":i:o:s:r:t:fp:bdwnvhl:k:" Option |
114 |
|
|
do |
115 |
|
|
case $Option in |
116 |
|
|
h) |
117 |
|
|
printHelp |
118 |
|
|
exit |
119 |
|
|
;; |
120 |
|
|
v) |
121 |
|
|
printVersion |
122 |
|
|
exit |
123 |
|
|
;; |
124 |
|
|
i) # input file or cdrom device |
125 |
|
|
test "$(whoami)" = "root" || noRoot |
126 |
|
|
[ -s "$OPTARG" ] || { |
127 |
|
|
echo " Error: The specified file \"$OPTARG\" cannot be found" |
128 |
|
|
exit 1 |
129 |
|
|
} |
130 |
|
|
inputFile="$OPTARG" |
131 |
|
|
if [ ! -z $(echo "$inputFile" | grep '/dev/') ];then |
132 |
|
|
workingFromCD=1 |
133 |
|
|
fi |
134 |
|
|
;; |
135 |
|
|
o) # output file |
136 |
|
|
test "$(whoami)" = "root" || noRoot |
137 |
|
|
touch "$OPTARG" 2>/dev/null || { |
138 |
|
|
echo " Error: The specified file \"$OPTARG\" cannot be created!!!" |
139 |
|
|
exit 1 |
140 |
|
|
} |
141 |
|
|
outputFile="$OPTARG" |
142 |
|
|
;; |
143 |
|
|
s) # boot splash screen |
144 |
|
|
test "$(whoami)" = "root" || noRoot |
145 |
|
|
[ -s "$OPTARG" ] || { |
146 |
|
|
echo " Error: The specified file \"$OPTARG\" cannot be found" |
147 |
|
|
exit 1 |
148 |
|
|
} |
149 |
|
|
mainSplash="$OPTARG" |
150 |
|
|
;; |
151 |
|
|
r) # restore splash screen |
152 |
|
|
test "$(whoami)" = "root" || noRoot |
153 |
|
|
[ -s "$OPTARG" ] || { |
154 |
|
|
echo " Error: The specified file \"$OPTARG\" cannot be found" |
155 |
|
|
exit 1 |
156 |
|
|
} |
157 |
|
|
restoreSplash="$OPTARG" |
158 |
|
|
;; |
159 |
|
|
t) # boot screen title (boot screen) |
160 |
|
|
test "$(whoami)" = "root" || noRoot |
161 |
|
|
mainTitle="$OPTARG" |
162 |
|
|
;; |
163 |
|
|
p) # storage partition |
164 |
|
|
if [ -z $(echo "$OPTARG" | grep '/dev/') ];then |
165 |
|
|
echo " Error: Parameter -c (storage partition) is not a valid partition" |
166 |
|
|
exit 1 |
167 |
|
|
fi |
168 |
|
|
if [ -z "$(fdisk -l "$OPTARG" 2>/dev/null)" ];then |
169 |
|
|
echo " Error: Parameter -c (storage partition) is not a a valid partition" |
170 |
|
|
exit 1 |
171 |
|
|
fi |
172 |
|
|
savePartition="$OPTARG" |
173 |
|
|
;; |
174 |
|
|
b) # burn image to CD |
175 |
|
|
test "$(whoami)" = "root" || noRoot |
176 |
|
|
burnISO='y' |
177 |
|
|
;; |
178 |
|
|
f) # burn ISO to CD on the fly |
179 |
|
|
test "$(whoami)" = "root" || noRoot |
180 |
|
|
onTheFly='y' |
181 |
|
|
;; |
182 |
|
|
d) # delete image after burning to CD |
183 |
|
|
test "$(whoami)" = "root" || noRoot |
184 |
|
|
deleteISO='y' |
185 |
|
|
burnISO='y' |
186 |
|
|
;; |
187 |
|
|
w) # CD writter device |
188 |
|
|
test "$(whoami)" = "root" || noRoot |
189 |
|
|
if [ -z $(echo "$OPTARG" | grep '/dev/') ];then |
190 |
|
|
echo " Error: Parameter -w (writter device) is not valid" |
191 |
|
|
exit 1 |
192 |
|
|
fi |
193 |
|
|
tmpDev=$(echo "$OPTARG" | sed 's|^/dev/||') |
194 |
|
|
if [ $(cat /proc/sys/dev/cdrom/info | grep "$tmpDev" | wc -l) -ne 0 ];then |
195 |
|
|
# not found as dev name |
196 |
|
|
# is it a link? |
197 |
|
|
tmpDev=$(ls -la "$OPTARG" | sed 's|.*-> ||') |
198 |
|
|
if [ $(cat /proc/sys/dev/cdrom/info | grep "$tmpDev" | wc -l) -eq 0 ];then |
199 |
|
|
echo " Error: Parameter -w (writter device) is not valid" |
200 |
|
|
exit 1 |
201 |
|
|
fi |
202 |
|
|
fi |
203 |
|
|
cdWritter="$OPTARG" |
204 |
|
|
;; |
205 |
|
|
t) # boot screen title (boot screen) |
206 |
|
|
test "$(whoami)" = "root" || noRoot |
207 |
|
|
mainTitle="$OPTARG" |
208 |
|
|
;; |
209 |
|
|
n) # boot screen title (boot screen) |
210 |
|
|
test "$(whoami)" = "root" || noRoot |
211 |
|
|
keepFiles='y' |
212 |
|
|
;; |
213 |
|
|
l) |
214 |
|
|
test "$(whoami)" = "root" || noRoot |
215 |
|
|
theLang="$OPTARG" |
216 |
|
|
;; |
217 |
|
|
k) |
218 |
|
|
test "$(whoami)" = "root" || noRoot |
219 |
|
|
theKeymap="$OPTARG" |
220 |
|
|
;; |
221 |
|
|
esac |
222 |
|
|
done |
223 |
|
|
shift $(($OPTIND - 1)) |
224 |
|
|
test "$(whoami)" = "root" || noRoot |
225 |
|
|
|
226 |
|
|
# Check parameters |
227 |
|
|
[ -z "$inputFile" ] && { |
228 |
|
|
echo " Error: Parameter -i (input file) not specified!!!" |
229 |
|
|
exit 1 |
230 |
|
|
} |
231 |
|
|
[ -z "$mainSplash" ] || { |
232 |
|
|
[ -z $(echo "$mainSplash" | grep -e '\.png$') ] && { |
233 |
|
|
echo " Error: Boot splash screen (parameter -s) is not a png file!!!" |
234 |
|
|
exit 1 |
235 |
|
|
} |
236 |
|
|
boot=1 |
237 |
|
|
} |
238 |
|
|
# } && { |
239 |
|
|
# echo " Error: Parameter -s (boot splash screen) not specified!!!" |
240 |
|
|
# exit 1 |
241 |
|
|
# } |
242 |
|
|
[ -z "$restoreSplash" ] || { |
243 |
|
|
[ -z $(echo "$restoreSplash" | grep -e '\.png$') ] && { |
244 |
|
|
echo " Error: Restore splash screen (parameter -r) is not a png file!!!" |
245 |
|
|
exit 1 |
246 |
|
|
} |
247 |
|
|
} && { |
248 |
|
|
if [-n "$boot" ];then |
249 |
|
|
echo " Error: Parameter -r (restore splash screen) not specified!!!" |
250 |
|
|
exit 1 |
251 |
|
|
fi |
252 |
|
|
} |
253 |
|
|
# [ -z "$mainTitle" ] && { |
254 |
|
|
# echo " Error: Parameter -t (boot screen title) not specified!!!" |
255 |
|
|
# exit 1 |
256 |
|
|
# } |
257 |
|
|
|
258 |
|
|
[ -z "$outputFile" ] && { |
259 |
|
|
outputFile=$(basename "$0").$$.iso |
260 |
|
|
burnISO='y' |
261 |
|
|
deleteISO='y' |
262 |
|
|
} |
263 |
|
|
|
264 |
|
|
[ -z "$savePartition" ] && { |
265 |
|
|
echo " Error: Parameter -c (storage partition) not specified!!!" |
266 |
|
|
exit 1 |
267 |
|
|
} |
268 |
|
|
|
269 |
|
|
[ -z "$burnISO" ] || { |
270 |
|
|
[ -z "$cdWritter" ] && { |
271 |
|
|
WHAT_CD=$(which what-cd) |
272 |
|
|
[ -z "$WHAT_CD" ] && { |
273 |
|
|
[ -e /root/.clonezilla-sysresccd/files/what-cd ] && { |
274 |
|
|
WHAT_CD=/root/.clonezilla-sysresccd/files/what-cd |
275 |
|
|
cdWritter=$(sh "$WHAT_CD" -bw) |
276 |
|
|
[ -z "$cdWritter" ] && { |
277 |
|
|
echo " Error: Cannot determine your writter device name!!!" |
278 |
|
|
exit 1 |
279 |
|
|
} |
280 |
|
|
} || { |
281 |
|
|
echo " Error: Parameter -w (writter device) not specified!!!" |
282 |
|
|
exit 1 |
283 |
|
|
} |
284 |
|
|
} |
285 |
|
|
} |
286 |
|
|
} |
287 |
|
|
|
288 |
|
|
printVersion |
289 |
|
|
|
290 |
|
|
echo -n "Mounting files... " |
291 |
|
|
isClonezillaSysRescCDRunning |
292 |
|
|
|
293 |
|
|
# umount "$inputFile" 2>/dev/null |
294 |
|
|
if [ -z $(mount | grep "$inputFile" | sed "s|\(^[^ ]*\).*|\1|" | uniq) ];then |
295 |
|
|
# mount the inputFile |
296 |
|
|
if [ -z "$ClonezillaSysRescCDRunning" ];then |
297 |
|
|
# working on host system |
298 |
|
|
mountPoint=/root/tmp/mountPoint.$$ |
299 |
|
|
else |
300 |
|
|
# working with ClonezillaSysRescCD |
301 |
|
|
mountPoint=/mountPoint.$$ |
302 |
|
|
fi |
303 |
|
|
if [ -z "$workingFromCD" ];then |
304 |
|
|
# working with ClonezillaSysRescCD image |
305 |
|
|
mountOptions="-oloop" |
306 |
|
|
fi |
307 |
|
|
mkdir -p "$mountPoint" && mountPointCreated='y' || { |
308 |
|
|
echo "failed" |
309 |
|
|
echo |
310 |
|
|
echo " Error: Temp folder \"$mountPoint\" cannot be created!!!" |
311 |
|
|
exit 1 |
312 |
|
|
} |
313 |
|
|
|
314 |
|
|
mount "$inputFile" "$mountPoint" "$mountOptions" 2>/dev/null && inputFileMounted='y' |
315 |
|
|
if [ -z "$inputFileMounted" ];then |
316 |
|
|
echo "failed" |
317 |
|
|
echo |
318 |
|
|
echo " Error: \"$inputFile\" cannot be mounted!!!" |
319 |
|
|
cleanUp |
320 |
|
|
exit 1 |
321 |
|
|
fi |
322 |
|
|
else |
323 |
|
|
# our inputFile is mounted!!! |
324 |
|
|
mountPoint=$(mount | grep "$inputFile" | grep 's|.* on \(.*\) type .*)|\1|') |
325 |
|
|
fi |
326 |
|
|
|
327 |
|
|
|
328 |
|
|
|
329 |
|
|
|
330 |
|
|
# set -x |
331 |
|
|
if [ -z $(mount | grep "$savePartition" | sed "s|\(^[^ ]*\).*|\1|" | uniq) ];then |
332 |
|
|
if [ -z "$workingFromCD" ];then |
333 |
|
|
savePartitionMountPoint=/root/tmp/savePartition.$$ |
334 |
|
|
else |
335 |
|
|
savePartitionMountPoint=/savePartition.$$ |
336 |
|
|
fi |
337 |
|
|
|
338 |
|
|
mkdir -p "$savePartitionMountPoint" 2>/dev/null && savePartitionMountPointCreated='y' || { |
339 |
|
|
echo "failed" |
340 |
|
|
echo |
341 |
|
|
echo " Error: Temp folder \"$savePartitionMountPoint\" cannot be created!!!" |
342 |
|
|
cleanUp |
343 |
|
|
exit 1 |
344 |
|
|
} |
345 |
|
|
|
346 |
|
|
ntfs-3g "$savePartition" "$savePartitionMountPoint" 2>/dev/null && savePartitionMounted='y' |
347 |
|
|
if [ -z "$savePartitionMounted" ];then |
348 |
|
|
savePartitionMounted='' |
349 |
|
|
mount "$savePartition" "$savePartitionMountPoint" 2>/dev/null && savePartitionMounted='y' |
350 |
|
|
if [ -z "$savePartitionMounted" ];then |
351 |
|
|
echo "failed" |
352 |
|
|
echo |
353 |
|
|
echo " Error: \"$savePartition\" cannot be mounted!!!" |
354 |
|
|
cleanUp |
355 |
|
|
exit 1 |
356 |
|
|
fi |
357 |
|
|
fi |
358 |
|
|
else |
359 |
|
|
savePartitionMountPoint=$(mount | grep "$savePartition" | uniq | sed 's|.*on \(.*\) type.*|\1|') |
360 |
|
|
fi |
361 |
|
|
|
362 |
|
|
|
363 |
|
|
mkdir "$savePartitionMountPoint"/new-iso 2>/dev/null && newIsoCreated='y' || { |
364 |
|
|
[ -z "$savePartitionMounted" ] || umount "$savePartition" 2>/dev/null |
365 |
|
|
savePartitionMounted='' |
366 |
|
|
echo "failed" |
367 |
|
|
echo |
368 |
|
|
echo " Error: Partition \"$savePartition\ is mounted read-only!!!" |
369 |
|
|
cleanUp |
370 |
|
|
exit 1 |
371 |
|
|
} |
372 |
|
|
echo "done" |
373 |
|
|
|
374 |
|
|
# set +x |
375 |
|
|
echo -n "Copying files... " |
376 |
|
|
|
377 |
|
|
cp -r "$mountPoint"/* "$savePartitionMountPoint"/new-iso 2>/dev/null && { |
378 |
|
|
echo "done" |
379 |
|
|
} || { |
380 |
|
|
echo "failed" |
381 |
|
|
echo |
382 |
|
|
cleanUp |
383 |
|
|
exit 1 |
384 |
|
|
} |
385 |
|
|
|
386 |
|
|
|
387 |
|
|
# echo |
388 |
|
|
# echo -n "Press ENTER to continue... " |
389 |
|
|
# read |
390 |
|
|
# cleanUp |
391 |
|
|
# exit |
392 |
|
|
|
393 |
|
|
|
394 |
|
|
|
395 |
|
|
echo -n "Installing new files... " |
396 |
|
|
if [ ! -z "$mainTitle" ];then |
397 |
|
|
for n in $(find "$savePartitionMountPoint"/new-iso -iname "*.cfg");do |
398 |
|
|
sed "s|^MENU TITLE.*|MENU TITLE $mainTitle|" "$n" > "$n".$$ |
399 |
|
|
mv "$n".$$ "$n" |
400 |
|
|
done |
401 |
|
|
fi |
402 |
|
|
if [ -e "$mainSplash" ];then |
403 |
|
|
cp "$mainSplash" "$savePartitionMountPoint"/new-iso/isolinux/ocswp.png |
404 |
|
|
fi |
405 |
|
|
if [ -e "$restoreSplash" ];then |
406 |
|
|
cp "$restoreSplash" "$savePartitionMountPoint"/new-iso/restorecd/default-restore-ocswp.png |
407 |
|
|
cp "$restoreSplash" "$savePartitionMountPoint"/new-iso/restorecd/ocswp.png |
408 |
|
|
fi |
409 |
|
|
|
410 |
|
|
cd "$savePartitionMountPoint"/new-iso |
411 |
|
|
|
412 |
|
|
if [ ! -z "$theLang" ];then |
413 |
|
|
if [ "$theLang" = " " ];then theLang="";fi |
414 |
|
|
if [ "$theLang" = "ASK" ];then theLang="";fi |
415 |
|
|
for files in `find . -iname "*.cfg"`;do |
416 |
|
|
sed "s|ocs_lang=[^ ]*|ocs_lang=\"$theLang\"|" "$files" > "$files".$$ |
417 |
|
|
mv "$files".$$ "$files" |
418 |
|
|
done |
419 |
|
|
fi |
420 |
|
|
|
421 |
|
|
if [ ! -z "$theKeymap" ];then |
422 |
|
|
if [ "$theKeymap" = "ASK" ];then theKeymap="";fi |
423 |
|
|
for files in `find . -iname "*.cfg"`;do |
424 |
|
|
sed "s|ocs_live_keymap=[^ ]*|ocs_live_keymap=\"$theKeymap\"|" "$files" > "$files".$$ |
425 |
|
|
mv "$files".$$ "$files" |
426 |
|
|
done |
427 |
|
|
fi |
428 |
|
|
|
429 |
|
|
tar czf menu-iso.tar.gz $(find . -iname "*.cfg") |
430 |
|
|
mv menu-iso.tar.gz restorecd |
431 |
|
|
echo "done" |
432 |
|
|
|
433 |
|
|
[ -z "$keepFiles" ] || { |
434 |
|
|
echo "The modified files can be found at: \"$savePartitionMountPoint/new-iso\"" |
435 |
|
|
cleanUp |
436 |
|
|
exit |
437 |
|
|
} |
438 |
|
|
|
439 |
|
|
|
440 |
|
|
echo |
441 |
|
|
echo |
442 |
|
|
echo -n "Press ENTER to create the ISO file... " |
443 |
|
|
read |
444 |
|
|
|
445 |
|
|
outputFile="$savePartitionMountPoint"/"$outputFile" |
446 |
|
|
|
447 |
|
|
mkisofs -r -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat \ |
448 |
|
|
-no-emul-boot -boot-load-size 4 -boot-info-table \ |
449 |
|
|
"$savePartitionMountPoint"/new-iso \ |
450 |
|
|
| \ |
451 |
|
|
( |
452 |
|
|
case "$onTheFly" in |
453 |
|
|
"y") |
454 |
|
|
echo "Ready to burn your ISO file to CD" |
455 |
|
|
echo "Place an empty disk in the writter and" |
456 |
|
|
echo -n "press ENTER to continue... " |
457 |
|
|
umount "$cdWritter" 2>/dev/null |
458 |
|
|
eject "$cdWritter" 2>/dev/null |
459 |
|
|
sleep 1 |
460 |
|
|
read |
461 |
|
|
cdrecord dev="$cdWritter" -data -eject -v - |
462 |
|
|
rc=$? |
463 |
|
|
if [ "$rc" -gt 0 ]; then |
464 |
|
|
echo " Error: CD burning failed!!!" |
465 |
|
|
echo |
466 |
|
|
cleanUp |
467 |
|
|
exit 1 |
468 |
|
|
fi |
469 |
|
|
echo |
470 |
|
|
cleanUp |
471 |
|
|
exit |
472 |
|
|
;; |
473 |
|
|
*) |
474 |
|
|
# use /dev/stdout as the bridge |
475 |
|
|
cat - > "$outputFile" |
476 |
|
|
rc=$? |
477 |
|
|
if [ "$rc" -gt 0 ]; then |
478 |
|
|
echo " Error: ISO file creation failed!!!" |
479 |
|
|
cleanUp |
480 |
|
|
exit 1 |
481 |
|
|
fi |
482 |
|
|
[ -z "$deleteISO" ] && { |
483 |
|
|
echo |
484 |
|
|
echo "ISO file: \"$outputFile\"" |
485 |
|
|
};; |
486 |
|
|
esac |
487 |
|
|
|
488 |
|
|
) |
489 |
|
|
|
490 |
|
|
|
491 |
|
|
[ -z "$burnISO" ] || { |
492 |
|
|
echo "Ready to burn your ISO file to CD" |
493 |
|
|
echo "Place an empty disk in the writter and" |
494 |
|
|
echo -n "press ENTER to continue... " |
495 |
|
|
umount "$cdWritter" 2>/dev/null |
496 |
|
|
eject "$cdWritter" 2>/dev/null |
497 |
|
|
sleep 1 |
498 |
|
|
read |
499 |
|
|
cdrecord dev="$cdWritter" -data -eject -v "$outputFile" |
500 |
|
|
rc=$? |
501 |
|
|
if [ "$rc" -gt 0 ]; then |
502 |
|
|
echo " Error: CD burning failed!!!" |
503 |
|
|
echo |
504 |
|
|
cleanUp |
505 |
|
|
exit 1 |
506 |
|
|
fi |
507 |
|
|
} |
508 |
|
|
[ -z "$deleteISO" ] || { |
509 |
|
|
echo -n "Deleting ISO file... " |
510 |
|
|
rm -rf "$outputFile" 2>/dev/null && echo "done" || echo "failed" |
511 |
|
|
} |
512 |
|
|
echo |
513 |
|
|
echo -n "Press ENTER to continue... " |
514 |
|
|
read |
515 |
|
|
cleanUp |