/[clonezilla-sysresccd]/trunk/create-clonezilla-sysresccd/create-clonezilla-sysresccd.sh
ViewVC logotype

Contents of /trunk/create-clonezilla-sysresccd/create-clonezilla-sysresccd.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 61 - (show annotations)
Wed May 26 12:15:58 2010 UTC (10 years, 10 months ago) by sng
File MIME type: application/x-sh
File size: 22637 byte(s)
adding auto mode to create-clonezilla-sysresccd, and hopefully fixing svn:externals issues

Please add
Hostname svn.hellug.gr
User <your user name>
to ~/.ssh/config to get it working

1 ##############################################################################
2 # #
3 # create-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 getScript(){
27 if [ -n "$auto" ];then return;fi
28 echo 'Insert script to be executed'
29 echo -n '> '
30 read exScript
31 }
32
33 function getSysCD(){
34 echo 'Insert "System Rescue CD" ISO file name'
35 until [ ! -z "$sysCD" ];do
36 echo -n '> '
37 read sysCD
38 done
39
40 if [ ! -s "$sysCD" ];then
41 echo -n " Error: File not found. Press ENTER to continue... "
42 sysCD=''
43 read
44 getSysCD
45 fi
46 }
47
48 function getCloneCD(){
49 echo 'Insert "Clonezilla Live" ISO file name'
50 until [ ! -z "$cloneCD" ];do
51 echo -n '> '
52 read cloneCD
53 done
54
55 if [ ! -s "$cloneCD" ];then
56 echo -n " Error: File not found. Press ENTER to continue... "
57 cloneCD=''
58 read
59 getCloneCD
60 fi
61 }
62
63 function getcfgFile(){
64 echo 'Insert "isolinux.cfg" file to use'
65 until [ ! -z "$cfgFile" ];do
66 echo -n '> '
67 read cfgFile
68 done
69 if [ ! -s "$cfgFile" ];then
70 echo -n " Error: File not found. Press ENTER to continue... "
71 cfgFile=''
72 read
73 getcfgFile
74 fi
75 }
76
77 function getPreparer(){
78 echo 'Insert Preparer ID'
79 until [ ! -z "$preparerID" ];do
80 echo -n '> '
81 read preparerID
82 done
83 }
84
85 function getPublisher(){
86 echo 'Insert Publisher ID'
87 until [ ! -z "$publisher" ];do
88 echo -n '> '
89 read publisher
90 done
91 }
92
93 function getvolLabel(){
94 echo 'Insert CD Volume label'
95 until [ ! -z "$volLabel" ];do
96 echo -n '> '
97 read volLabel
98 done
99 }
100
101 function getDebianLiveFolder(){
102 echo 'Insert Debian Live folder'
103 until [ ! -z "$DebianLiveFolder" ];do
104 echo -n '> '
105 read DebianLiveFolder
106 done
107 }
108
109
110
111 function createTempFolders(){
112 echo -n "Creating /root/tmp folder... "
113 mkdir /root/tmp 2>/dev/null
114 if [ ! -d /root/tmp ];then
115 echo
116 echo " Error creating folder: /root/tmp"
117 echo " This shouldn't be happening..."
118 exit 1
119 fi
120 echo 'done'
121
122 echo -n "Creating temp folders... "
123 rm -rf /root/tmp/clonezilla-sysresccd-"$version".iso 2>/dev/null
124 rm -rf /root/tmp/syscd 2>/dev/null
125 rm -rf /root/tmp/clonecd 2>/dev/null
126 rm -rf /root/tmp/clonezilla-sysresccd 2>/dev/null
127 mkdir /root/tmp/syscd /root/tmp/clonecd /root/tmp/clonezilla-sysresccd 2>/dev/null
128 if [ ! -d /root/tmp/syscd ];then
129 echo
130 echo " Error creating temp folder: /root/tmp/syscd"
131 exit 1
132 fi
133 if [ ! -d /root/tmp/clonecd ];then
134 echo
135 echo " Error creating temp folder: /root/tmp/clonecd"
136 exit 1
137 fi
138
139
140 if [ ! -d /root/tmp/clonezilla-sysresccd ];then
141 echo
142 echo " Error creating temp folder: /root/tmp/clonezilla-sysresccd"
143 exit 1
144 fi
145 echo 'done'
146 }
147
148 function errorMount(){
149 echo "$1"
150 cleanUp
151 exit 1
152 }
153
154 function errorISO(){
155 echo " Error creating new ISO file: /root/tmp/output.iso"
156 rm /root/tmp/clonezilla-sysresccd-"$outName""$version".iso 2>/dev/null
157 cleanUp
158 exit 1
159 }
160
161 function cleanUp(){
162 echo -n "
163 Cleaning up... "
164 umount /root/tmp/clonecd 2>/dev/null
165 umount /root/tmp/syscd 2>/dev/null
166 if [ -z "$cleanUpValue" ];then
167 rm -rf /root/tmp/clonezilla-sysresccd 2>/dev/null
168 fi
169 rm -rf /root/tmp/clonecd /root/tmp/syscd 2>/dev/null
170 echo 'done'
171 echo
172 exit $exitStatus
173 }
174
175 function isnumber(){
176 if [ "$1" = "0" ];then return 0;fi
177 local n="$1"
178 (( n ++ )) 2>/dev/null || return 1
179 return 0
180 }
181
182 function readProfiles(){
183 local n=0
184 local tmpName=${profile[0]}
185 until [ -z "$tmpName" ];do
186 (( n ++ ))
187 tmpName=${profile[$n]}
188 done
189 numOfProfiles=$(( n - 1 ))
190 }
191
192 function applyProfile(){
193 test -z "${sysCDP[$1]}" || sysCD="${sysCDP[$1]}"
194 test -z "${cloneCDP[$1]}" || cloneCD="${cloneCDP[$1]}"
195 test -z "${cfgFileP[$1]}" || cfgFile="${cfgFileP[$1]}"
196 test -z "${splashP[$1]}" || splash="${splashP[$1]}"
197 test -z "${outNameP[$1]}" || outName="${outNameP[$1]}"
198 test -z "${preparerIDP[$1]}" || preparerID="${preparerIDP[$1]}"
199 test -z "${publisherP[$1]}" || publisher="${publisherP[$1]}"
200 test -z "${volLabelP[$1]}" || volLabel="${volLabelP[$1]}"
201 test -z "${exScriptP[$1]}" || exScript="${exScriptP[$1]}"
202 # test -z "${DebianLiveFolderP[$1]}" || DebianLiveFolder="${DebianLiveFolderP[$1]}"
203 }
204
205 function printHelp(){
206 echo "$(basename $0) - v $version - Spiros Georgaras <sng@hellug.gr>
207 A utility to create a multi boot CD containing
208 Clonezilla Live CD and
209 System Rescue CD
210 (they have to be downloaded seperately)
211
212 Usage: $(basename $0) [options]
213 Available options are:
214 a run in auto mode (no confirmation, assume yes to
215 all questions asked, no ISO burning to disk)
216 s show profiles and let user select profile to use
217 p [number] use profile number
218 f copy files only. Don't create ISO file and don't
219 burn anything on CD
220 nf don't copy files. Use files existing in folder
221 \"/root/tmp/clonezilla-sysresccd\".
222 *** Caution: Dangerous!!! ***
223 i only create ISO file. Don't burn anything on CD
224 b burn a previously created ISO file
225 x [script] A user defined and written BASH script
226 to be executed just before mastering the CD
227 v print version and exit
228 h print this screen and exit
229
230 More information on available customization in file
231 /root/.clonezilla-sysresccd/clonezilla-sysresccd.conf"
232 }
233
234 function printVersion(){
235 echo "$(basename $0) - v $version - Spiros Georgaras <sng@hellug.gr>
236 A utility to create a multi boot CD containing
237 Clonezilla Live CD and
238 System Rescue CD
239 (they have to be downloaded seperately)"
240 exit
241 }
242
243 # function decectDVDWriter(){
244 # local z
245 # # local DEV0 DEV1
246 # local CDW0 CDW1
247 # local DVDW0 DVDW1
248 #
249 # z=`cat /proc/sys/dev/cdrom/info 2>/dev/null | grep name | sed 's/.*name://' | sed 's/[ ][ ]*/ /g'| sed 's/^[ ][ ]*//' `
250 # DEV0=`echo "$z" | sed 's/\([^ ]*\).*/\1/'`
251 # DEV1=`echo "$z" | sed 's/[^ ]* *\([^ ]*\)/\1/'`
252 #
253 # z=`cat /proc/sys/dev/cdrom/info 2>/dev/null| grep 'write' | grep 'DVD-R:'| sed 's/.*DVD-R://' | sed 's/[ ][ ]*/ /g'| sed 's/^[ ][ ]*//' `
254 # # echo z=$z
255 # DVDW0=`echo "$z" | sed 's/\([^ ]*\).*/\1/'`
256 # DVDW1=`echo "$z" | sed 's/[^ ]* *\([^ ]*\)/\1/'`
257 #
258 #
259 # z=`cat /proc/sys/dev/cdrom/info 2>/dev/null| grep 'write' | grep 'CD-R:'| sed 's/.*CD-R://' | sed 's/[ ][ ]*/ /g'| sed 's/^[ ][ ]*//' `
260 # # echo z=$z
261 # CDW0=`echo "$z" | sed 's/\([^ ]*\).*/\1/'`
262 # CDW1=`echo "$z" | sed 's/[^ ]* *\([^ ]*\)/\1/'`
263 #
264 # if ! test -z "$DEV0";then
265 # if [ "$DVDW0" = "1" ];then DVDRECORDER=/dev/"$DEV0";fi
266 # if [ "$CDW0" = "1" ];then CDRECORDER=/dev/"$DEV0";fi
267 # fi
268 #
269 # if ! test -z "$DEV1";then
270 # if test -z "$DVDRECORDER"; then
271 # if [ "$DVDW1" = "1" ];then
272 # DVDRECORDER=/dev/"$DEV1"
273 # fi
274 # fi
275 # if test -z "$CDRECORDER"; then
276 # if [ "$CDW1" = "1" ];then
277 # CDRECORDER=/dev/"$DEV1"
278 # fi
279 # fi
280 # fi
281 #
282 # }
283
284 function sourceProfiles(){
285 if [ -r /root/.clonezilla-sysresccd/profiles.conf ];then
286 . /root/.clonezilla-sysresccd/profiles.conf 2>/dev/null || profilesError=1
287 profilesExist=1
288 fi
289 if [ $profilesError -eq 1 ];then
290 echo " Error: Your profiles configuration file \"/root/.clonezilla-sysresccd/profiles.conf\""
291 echo " has errors and cannot be used. Please fix the problem and try again"
292 exit 1
293 fi
294 }
295
296
297 function readConfig(){
298 if [ -n "$configAlreadyRead" ];then return; fi
299 test "$(whoami)" = "root" || noRoot
300 [ -r /root/.clonezilla-sysresccd/clonezilla-sysresccd.conf ] || {
301 echo " Error: Your configuration file \"/root/.clonezilla-sysresccd/clonezilla-sysresccd.conf\""
302 echo " does not exist or can not be read. Please fix the problem and try again"
303 exit 1
304 }
305
306 . /root/.clonezilla-sysresccd/clonezilla-sysresccd.conf 2>/dev/null
307 if [ $? -ne 0 ];then
308 echo " Error: Your configuration file \"/root/.clonezilla-sysresccd/clonezilla-sysresccd.conf\""
309 echo " has errors and cannot be used. Please fix the problem and try again"
310 exit 1
311 fi
312 configAlreadyRead='true'
313 }
314
315 ####### Script starts here #######
316 onlyBurnISO=0
317 onlyCopyFiles=0
318 onlyCreateISO=0
319 noFileCopy=0
320 exitStatus=0
321
322 profilesExist=0
323 profilesError=0
324
325
326 while getopts ":asp:bfihvn:x:" Option
327 do
328 case $Option in
329 a)
330 auto=yes
331 ;;
332 s)
333 readConfig
334 sourceProfiles
335 if [ $profilesExist -eq 1 ];then
336 readProfiles
337 until [ ! -z "$prN" ];do
338 clear
339 echo "Available profiles"
340 for i in `seq 0 $numOfProfiles`;do
341 echo " Profile[$i]: ${profile[$i]}"
342 done
343 echo -n "Insert profile number ([0]-$numOfProfiles): "
344 read prN
345 test -z "$prN" && prN=0
346 isnumber "$prN" || prN=''
347 if [ $prN -gt $numOfProfiles ] 2>/dev/null; then prN='';fi
348 done
349 applyProfile $prN
350 else
351 echo " Error: You have requested to use profiles but your profiles configuration file"
352 echo " \"/root/.clonezilla-sysresccd/profiles.conf\" does not exist or cannot be read"
353 exit 1
354 fi
355 ;;
356 p)
357 readConfig
358 sourceProfiles
359 if [ $profilesExist -eq 1 ];then
360 if $(isnumber "$OPTARG");then
361 applyProfile $OPTARG
362 usingProfile=yes
363 else
364 echo " Error in parameter: -p $OPTARG"
365 exit 1
366 fi
367 else
368 echo " Error: You have requested to use profile No $OPTARG but your profiles configuration file"
369 echo " \"/root/.clonezilla-sysresccd/profiles.conf\" does not exist or cannot be read"
370 exit 1
371 fi
372 ;;
373 b)
374 readConfig
375 onlyBurnISO=1;;
376 f)
377 readConfig
378 onlyCopyFiles=1;;
379 i)
380 readConfig
381 onlyCreateISO=1;;
382 x)
383 readConfig
384 [ -s "OPTARG" ] || {
385 echo " Error: The specified script \"$OPTARG\" cannot be found"
386 exit 1
387 }
388 [ -r "$OPTARG" ] && exScript="$OPTARG" || {
389 echo " Error: The specified script \"$OPTARG\" cannot be read"
390 exit 1
391 };;
392 h)
393 printHelp
394 exit
395 ;;
396 v)
397 printVersion
398 ;;
399 n)
400 readConfig
401 if [ "$OPTARG" != "f" ] ;then
402 echo "Error: Not a valid parameter -n$OPTARG"
403 exit 1
404 fi
405 noFileCopy=1
406 ;;
407 esac
408 done
409 shift $(($OPTIND - 1))
410
411 test "$(whoami)" = "root" || noRoot
412
413 # chack auto mode
414 if [ -n "$auto" ];then
415 if [ -z "$usingProfile" ];then
416 echo ' Error: Parameter -a used without -p'
417 exit 1
418 fi
419 fi
420
421 # Check input parameters
422 checkInParms=0
423 checkInParms=$(( onlyBurnISO + onlyCreateISO + onlyCopyFiles + noFileCopy ))
424 if [ $noFileCopy -eq 1 ] && [ $onlyCreateISO -eq 1 ];then
425 okToContinue=1
426 elif [ $checkInParms -gt 1 ];then
427 echo " Error: Conflicting input parameters detected..."
428 exit 1
429 fi
430 if [ "$outName" = "" ];then
431 outFile=/root/tmp/clonezilla-sysresccd-"$version".iso
432 else
433 outFile=/root/tmp/clonezilla-sysresccd-"$outName"-"$version".iso
434 fi
435
436 if [ $onlyBurnISO -eq 0 ];then
437 if [ $noFileCopy -eq 0 ];then
438 while [ "$ans" != "y" ] || [ "$ans" = "Y" ];do
439 test -z "$sysCD" && getSysCD
440 test -z "$cloneCD" && getCloneCD
441 test -z "$cfgFile" && getcfgFile
442 test -z "$exScript" && getScript
443 # test -z "$DebianLiveFolder" && getDebianLiveFolder
444 clear
445 # echo -n "Current settings:
446 # System Rescue CD: $sysCD
447 # Clonezilla Live CD: $cloneCD
448 # isolinux.cfg to use: $cfgFile
449 # Debian Live folder: $DebianLiveFolder
450 # script to execute: $exScript
451 #
452 # Is this correct? (y/[n]): "
453
454 if [ -n "$auto" ]; then
455 ans=y
456 else
457 echo -n "Current settings:
458 System Rescue CD: $sysCD
459 Clonezilla Live CD: $cloneCD
460 isolinux.cfg to use: $cfgFile
461 script to execute: $exScript
462
463 Is this correct? (y/[n]): "
464
465 read ans
466 fi
467 if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then
468 sysCD=''
469 cloneCD=''
470 cfgFile=''
471 fi
472 done
473 ans=''
474 while [ 1 ];do
475 test -z "$preparerID" && getPreparer
476 test -z "$publisher" && getPublisher
477 test -z "$volLabel" && getvolLabel
478
479 if [ -n "$auto" ]; then
480 ans=y
481 else
482 clear
483 echo -n "Current CD info:
484 Preparer: $preparerID
485 Publisher: $publisher
486 Volume label: $volLabel
487
488 Is this correct? (y/[n]): "
489 read ans
490 fi
491 if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then
492 preparerID=''
493 publisher=''
494 volLabel=''
495 fi
496 if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then break;fi
497 done
498 trap cleanUp 2
499 clear
500 echo "$(basename $0) - v $version - Spiros Georgaras <sng@hellug.gr>
501 "
502 createTempFolders
503
504 echo -n "Mounting ISO files... "
505 mount "$sysCD" /root/tmp/syscd -o loop || errorMount ' Error mounting "System Rescue CD" file'
506 mount "$cloneCD" /root/tmp/clonecd -o loop || errorMount ' Error mounting Clonezilla" file'
507 echo 'done'
508 echo -n "Copying files... "
509 cp -RL /root/tmp/syscd/* /root/tmp/clonezilla-sysresccd
510 cp -RL /root/tmp/clonecd/* /root/tmp/clonezilla-sysresccd
511 echo 'done'
512
513
514 # echo -n "Extracting boot programs... "
515 echo "Extracting boot programs... "
516 cd /root/tmp/clonezilla-sysresccd/bootprog
517 mkdir tmp
518 cp *zip tmp
519 unzip -x sys*zip win32/syslinux.exe
520 mv win32/* .
521 rmdir win32
522 unzip -x gr* gr*/grub.exe
523 mv gr*/grub.exe .
524 rm -rf grub4dos*
525 cp tmp/* .
526 rm -rf tmp
527 # echo 'done'
528
529 if [ ! -z "$splash" ];then
530 echo -n "Copying new spalsh screen... "
531 cp -L "$splash" /root/tmp/clonezilla-sysresccd/isolinux/ocswp.png
532 echo 'done'
533 else
534 cp -L /root/.clonezilla-sysresccd/files/default-ocswp.png /root/tmp/clonezilla-sysresccd/isolinux/ocswp.png
535 fi
536
537 echo -n "Copying Super Grub Disk... "
538 cp -L /root/.clonezilla-sysresccd/files/sgd.img /root/tmp/clonezilla-sysresccd/bootdisk/sgd.img && echo 'done' || {
539 echo
540 echo
541 echo
542 echo " Error: Copying Super Grub Disk failed!!!"
543 echo
544 echo " Please make sure that the image file exists"
545 echo " Image file: /root/tmp/clonezilla-sysresccd/bootdisk/sgd.img"
546 echo
547 echo
548 cleanUp
549 exit 1
550 }
551 if [ -e /root/.clonezilla-sysresccd/files/sgd2.img ];then
552 echo -n "Copying Super Grub Disk 2... "
553 cp -L /root/.clonezilla-sysresccd/files/sgd2.img /root/tmp/clonezilla-sysresccd/bootdisk/grubdisk.img && echo 'done' || {
554 echo
555 echo
556 echo
557 echo " Error: Copying Super Grub Disk 2 failed!!!"
558 echo
559 echo " Please make sure that the image file exists"
560 echo " Image file: /root/tmp/clonezilla-sysresccd/bootdisk/sgd2.img"
561 echo
562 echo
563 cleanUp
564 exit 1
565 }
566 fi
567 echo -n "Copying new cfg file(s)... "
568 if [ -z $(echo "$cfgFile" | grep 'cfg$') ];then
569 tar -C /root/tmp/clonezilla-sysresccd -xzhf /root/.clonezilla-sysresccd/files/menu-iso.tar.gz
570 else
571 cp -L "$cfgFile" /root/tmp/clonezilla-sysresccd/isolinux/isolinux.cfg
572 fi
573 echo 'done'
574
575 echo -n "Creating folder restorecd... "
576 WHERE="$(pwd)"
577 mkdir /root/tmp/clonezilla-sysresccd/restorecd 2>/dev/null
578 cd /root/.clonezilla-sysresccd/files
579 cp -L pre* ocs-iso what-cd continue-multi-cd isolinux-restore-cd.cfg \
580 isolinux-restore-cd-ram.cfg menu-iso.tar.gz doc.tar.gz imginfo imgconvert cust-menu /root/tmp/clonezilla-sysresccd/restorecd
581 cp -L default-restore-ocswp.png /root/tmp/clonezilla-sysresccd/restorecd/ocswp.png
582 cp sbminst /root/tmp/clonezilla-sysresccd/restorecd
583
584 # Copy Smart Boot Manager and rawrite-fdimage to bootdisk
585 mkdir /root/tmp/clonezilla-sysresccd/rawrite
586 cp raw* fd* *dll /root/tmp/clonezilla-sysresccd/rawrite
587 cp sbm.img /root/tmp/clonezilla-sysresccd/bootdisk
588 cd "$DebianLiveFolder" 2>/dev/null || debFilesError=yes
589 # if [ -s files.tar.gz ];then
590 # cp -L files.tar.gz /root/tmp/clonezilla-sysresccd/restorecd/ 2>/dev/null || debFilesError=yes
591 # else
592 # [ -e "$DebianLiveFolder"/unifont.bgf ] || {
593 # uniFontCopied=yes
594 # cp -L /root/.clonezilla-sysresccd/files/unifont.bgf "$DebianLiveFolder"
595 # }
596 # tar chzf /root/tmp/clonezilla-sysresccd/restorecd/files.tar.gz unifont.bgf debian-live-for-ocs.iso 2>/dev/null || debFilesError=yes
597 # [ -z "$uniFontCopied" ] || rm "$DebianLiveFolder"/unifont.bgf
598 # fi
599 # [ -z "$debFilesError" ] || {
600 # echo
601 # echo
602 # echo
603 # echo " Error: Copying files.tar.gz failed!!!"
604 # echo
605 # echo " Please make sure that the variable DebianLiveFolder points either to"
606 # echo " the folder where the files unifont.bgf and debian-live-for-ocs.iso"
607 # echo " reside, or the files files.tar.gz (which contains unifont.bgf and"
608 # echo " debian-live-for-ocs.iso) can be found"
609 # echo
610 # echo
611 # echo
612 # cleanUp
613 # exit 1
614 # }
615 cd "$WHERE"
616 echo "done"
617
618 echo -n "Copying documentation files... "
619 cd /root/tmp/clonezilla-sysresccd
620 tar xzhf /root/tmp/clonezilla-sysresccd/restorecd/doc.tar.gz
621 echo 'done'
622
623 if [ ! -z "$exScript" ];then
624 # echo -n "Executing external script: \"$exScript\"... "
625 echo -n "Executing external script... "
626 . "$exScript" || {
627 echo
628 echo
629 echo
630 echo " Error: The execution of the script failed!!!"
631 echo " Please correct it and try again"
632 echo
633 echo " Script: \"$exScript\""
634 cleanUp
635 exit 1
636 }
637 echo 'done'
638 fi
639 # echo
640 # echo
641 # echo
642 else
643 trap cleanUp 2
644 cleanUpValue=1
645 if [ ! -d /root/tmp/clonezilla-sysresccd ];then
646 echo " Error accessing folder \"/root/tmp/clonezilla-sysresccd\""
647 exitStatus=1
648 cleanUp
649 fi
650 fi
651
652 # move extra folders into utils
653 mv /root/tmp/clonezilla-sysresccd/rawrite /root/tmp/clonezilla-sysresccd/bootprog /root/tmp/clonezilla-sysresccd/utils
654 mv /root/tmp/clonezilla-sysresccd/version /root/tmp/clonezilla-sysresccd/SystemRescueCD-Version
655
656 if [ $onlyCopyFiles -eq 1 ];then
657 cleanUpValue=1
658 # echo
659 # echo
660 echo "Both CDs have been copyied in: /root/tmp/clonezilla-sysresccd"
661 cleanUp
662 fi
663 echo
664 if [ -z "$auto" ]; then
665 echo -n "Ready to create new ISO file.
666
667 ************************************************************************
668 Ready to master your CD. If you want to alter any files contained
669 in the CD, now is the right time.
670 CD root is \"/root/tmp/clonezilla-sysresccd\"
671
672 When you are done
673 ***********************************************************************
674
675 Press ENTER to continue... "
676 read
677 else
678 echo "Creating new ISO file."
679 fi
680 find /root/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';'
681 # mkisofs -quiet -f -r -J -o "$outFile" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -iso-level 3 -joliet-long -input-charset utf-8 -output-charset utf-8 -V "$volLabel" -publisher "$publisher" -p "$preparerID" /root/tmp/clonezilla-sysresccd || errorISO
682 mkisofs -quiet -f -r -J -o "$outFile" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V "$volLabel" -publisher "$publisher" -p "$preparerID" /root/tmp/clonezilla-sysresccd || errorISO
683 echo "
684 Done creating new ISO file
685 The file is saved as $outFile"
686 ans=c
687 chIsoHyb=`type isohybrid 2>/dev/null`
688 if [ -n "$chIsoHyb" ];then
689 echo -n "Isohybriding $outFile... "
690 isohybrid "$outFile"
691 echo 'done'
692 fi
693
694 if [ -z "$auto" ];then
695 echo '
696
697 '
698 fi
699 else
700 while [ ! -r "$outFile" ];do
701 echo 'Insert "clonezilla-resccd" ISO file name'
702 echo -n "> "
703 read outFile
704 done
705 ans=y
706 fi
707
708 if [ $onlyCreateISO -eq 1 ];then ans=n;fi
709
710 while [ 1 ];do
711 if [ "$ans" = "" ];then ans=y;fi
712 if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "n" ] || [ "$ans" = "N" ];then break;fi
713 if [ -n "$auto" ]; then
714 ans=n
715 else
716 echo -n "Do you want to burn this ISO file? ([y]/n): "
717 read ans
718 fi
719 done
720 burnISO=0
721 if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
722 echo
723 echo "File to burn: $outFile"
724 echo
725 burnISO=1
726 # decectDVDWriter
727
728 # CDRECORDER=$(sh /root/.clonezilla-sysresccd/files/what-cd -wb)
729 chmod +x /root/.clonezilla-sysresccd/files/what-cd
730 CDRECORDER=$(/root/.clonezilla-sysresccd/files/what-cd -wb)
731 chmod -x /root/.clonezilla-sysresccd/files/what-cd
732
733 echo CD redorder found: "$CDRECORDER"
734 ans=''
735 until [ "$ans" = "y" ] || [ "$ans" = "Y" ];do
736 echo -n "Is this correct? ([y]/n): "
737 read ans
738 if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "" ];then
739 ans='y'
740 cdW="$CDRECORDER"
741 else
742 echo -n "Insert your CD redorder device name ($CDRECORDER): "
743 read cdW
744 if [ "$cdW" = "" ];then cdW="$CDRECORDER";fi
745 echo CD redorder: "$cdW"
746 fi
747 done
748 fi
749
750 if [ $burnISO -eq 1 ];then
751 ans=c
752 while [ 1 ];do
753 if [ "$ans" = "" ];then ans="y";fi
754 if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "n" ] || [ "$ans" = "N" ];then break;fi
755 echo -n "Does the CD need blanking (RW-CD)? ([y]/n): "
756 read ans
757 done
758 if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
759 blankCD=1
760 else
761 blankCD=0
762 fi
763 ans=c
764 while [ 1 ];do
765 if [ "$ans" = "" ];then ans="y";fi
766 if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "n" ] || [ "$ans" = "N" ];then break;fi
767 echo -n "Do you wan to to start a multi-session CD? ([y]/n): "
768 read ans
769 done
770 if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
771 MULTI='-multi'
772 else
773 MULTI=''
774 fi
775
776 clear
777 echo "Ready to burn the ISO file to CD. Please load a (re)writable CD
778 in $cdW and Press ENTER to continue... "
779 read
780 echo -n "Unmounting CD... "
781 while [ $(mount |grep "$cdW" | wc -l) -gt 0 ] ;do
782 umount "$cdW" 2>/dev/null
783 done
784 echo 'done'
785 if [ $blankCD -eq 1 ];then
786 echo "Blanking CD...
787 -----------"
788 cdrecord dev="$cdW" blank=fast -eject || errorMount '
789
790 Error: Blanking procedure failed...
791
792
793 '
794 fi
795 echo
796 echo "Burinng ISO file
797 ----------------"
798 cdrecord -v dev="$cdW" driveropts=burnfree "$MULTI" -eject "$outFile" || errorMount '
799
800 Error: Burning procedure failed...
801
802
803 '
804 fi
805 cleanUp

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26