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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 93 - (hide annotations)
Fri Aug 13 08:30:37 2010 UTC (13 years, 7 months ago) by sng
File MIME type: application/x-sh
File size: 23206 byte(s)
updating stuff for latest Clonezilla release

1 sng 47 ##############################################################################
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 sng 61 if [ -n "$auto" ];then return;fi
28 sng 47 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 sng 61 echo " Error creating new ISO file: /root/tmp/output.iso"
156 sng 47 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 sng 61 a run in auto mode (no confirmation, assume yes to
215     all questions asked, no ISO burning to disk)
216 sng 47 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 sng 93 MKISOFS=genisoimage
317 sng 47 onlyBurnISO=0
318     onlyCopyFiles=0
319     onlyCreateISO=0
320     noFileCopy=0
321     exitStatus=0
322    
323     profilesExist=0
324     profilesError=0
325    
326    
327 sng 61 while getopts ":asp:bfihvn:x:" Option
328 sng 47 do
329     case $Option in
330 sng 61 a)
331     auto=yes
332     ;;
333 sng 47 s)
334     readConfig
335     sourceProfiles
336     if [ $profilesExist -eq 1 ];then
337     readProfiles
338     until [ ! -z "$prN" ];do
339     clear
340     echo "Available profiles"
341     for i in `seq 0 $numOfProfiles`;do
342     echo " Profile[$i]: ${profile[$i]}"
343     done
344     echo -n "Insert profile number ([0]-$numOfProfiles): "
345     read prN
346     test -z "$prN" && prN=0
347     isnumber "$prN" || prN=''
348     if [ $prN -gt $numOfProfiles ] 2>/dev/null; then prN='';fi
349     done
350     applyProfile $prN
351     else
352     echo " Error: You have requested to use profiles but your profiles configuration file"
353     echo " \"/root/.clonezilla-sysresccd/profiles.conf\" does not exist or cannot be read"
354     exit 1
355     fi
356     ;;
357     p)
358     readConfig
359     sourceProfiles
360     if [ $profilesExist -eq 1 ];then
361     if $(isnumber "$OPTARG");then
362     applyProfile $OPTARG
363 sng 61 usingProfile=yes
364 sng 47 else
365     echo " Error in parameter: -p $OPTARG"
366     exit 1
367     fi
368     else
369     echo " Error: You have requested to use profile No $OPTARG but your profiles configuration file"
370     echo " \"/root/.clonezilla-sysresccd/profiles.conf\" does not exist or cannot be read"
371     exit 1
372     fi
373     ;;
374     b)
375     readConfig
376     onlyBurnISO=1;;
377     f)
378     readConfig
379     onlyCopyFiles=1;;
380     i)
381     readConfig
382     onlyCreateISO=1;;
383     x)
384     readConfig
385     [ -s "OPTARG" ] || {
386     echo " Error: The specified script \"$OPTARG\" cannot be found"
387     exit 1
388     }
389     [ -r "$OPTARG" ] && exScript="$OPTARG" || {
390     echo " Error: The specified script \"$OPTARG\" cannot be read"
391     exit 1
392     };;
393     h)
394     printHelp
395     exit
396     ;;
397     v)
398     printVersion
399     ;;
400     n)
401     readConfig
402     if [ "$OPTARG" != "f" ] ;then
403     echo "Error: Not a valid parameter -n$OPTARG"
404     exit 1
405     fi
406     noFileCopy=1
407     ;;
408     esac
409     done
410     shift $(($OPTIND - 1))
411    
412     test "$(whoami)" = "root" || noRoot
413 sng 61
414     # chack auto mode
415     if [ -n "$auto" ];then
416     if [ -z "$usingProfile" ];then
417     echo ' Error: Parameter -a used without -p'
418     exit 1
419     fi
420 sng 64 if [ "$onlyBurnISO" -eq 1 ];then
421 sng 63 echo " Error: Conflicting parameters -a and -b used"
422     exit 1
423     fi
424 sng 61 fi
425    
426 sng 47 # Check input parameters
427     checkInParms=0
428     checkInParms=$(( onlyBurnISO + onlyCreateISO + onlyCopyFiles + noFileCopy ))
429     if [ $noFileCopy -eq 1 ] && [ $onlyCreateISO -eq 1 ];then
430     okToContinue=1
431     elif [ $checkInParms -gt 1 ];then
432     echo " Error: Conflicting input parameters detected..."
433     exit 1
434     fi
435     if [ "$outName" = "" ];then
436     outFile=/root/tmp/clonezilla-sysresccd-"$version".iso
437     else
438     outFile=/root/tmp/clonezilla-sysresccd-"$outName"-"$version".iso
439     fi
440    
441     if [ $onlyBurnISO -eq 0 ];then
442     if [ $noFileCopy -eq 0 ];then
443     while [ "$ans" != "y" ] || [ "$ans" = "Y" ];do
444     test -z "$sysCD" && getSysCD
445     test -z "$cloneCD" && getCloneCD
446     test -z "$cfgFile" && getcfgFile
447     test -z "$exScript" && getScript
448     # test -z "$DebianLiveFolder" && getDebianLiveFolder
449     clear
450     # echo -n "Current settings:
451     # System Rescue CD: $sysCD
452     # Clonezilla Live CD: $cloneCD
453     # isolinux.cfg to use: $cfgFile
454     # Debian Live folder: $DebianLiveFolder
455     # script to execute: $exScript
456     #
457     # Is this correct? (y/[n]): "
458    
459 sng 61 if [ -n "$auto" ]; then
460     ans=y
461     else
462 sng 47 echo -n "Current settings:
463     System Rescue CD: $sysCD
464     Clonezilla Live CD: $cloneCD
465     isolinux.cfg to use: $cfgFile
466     script to execute: $exScript
467    
468     Is this correct? (y/[n]): "
469    
470 sng 61 read ans
471     fi
472 sng 47 if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then
473     sysCD=''
474     cloneCD=''
475     cfgFile=''
476     fi
477     done
478     ans=''
479     while [ 1 ];do
480     test -z "$preparerID" && getPreparer
481     test -z "$publisher" && getPublisher
482     test -z "$volLabel" && getvolLabel
483 sng 61
484     if [ -n "$auto" ]; then
485     ans=y
486     else
487     clear
488 sng 47 echo -n "Current CD info:
489     Preparer: $preparerID
490     Publisher: $publisher
491     Volume label: $volLabel
492    
493     Is this correct? (y/[n]): "
494 sng 61 read ans
495     fi
496 sng 47 if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then
497     preparerID=''
498     publisher=''
499     volLabel=''
500     fi
501     if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then break;fi
502     done
503     trap cleanUp 2
504     clear
505     echo "$(basename $0) - v $version - Spiros Georgaras <sng@hellug.gr>
506     "
507     createTempFolders
508    
509     echo -n "Mounting ISO files... "
510     mount "$sysCD" /root/tmp/syscd -o loop || errorMount ' Error mounting "System Rescue CD" file'
511     mount "$cloneCD" /root/tmp/clonecd -o loop || errorMount ' Error mounting Clonezilla" file'
512     echo 'done'
513     echo -n "Copying files... "
514     cp -RL /root/tmp/syscd/* /root/tmp/clonezilla-sysresccd
515     cp -RL /root/tmp/clonecd/* /root/tmp/clonezilla-sysresccd
516     echo 'done'
517    
518    
519     # echo -n "Extracting boot programs... "
520     echo "Extracting boot programs... "
521     cd /root/tmp/clonezilla-sysresccd/bootprog
522     mkdir tmp
523     cp *zip tmp
524     unzip -x sys*zip win32/syslinux.exe
525     mv win32/* .
526     rmdir win32
527     unzip -x gr* gr*/grub.exe
528     mv gr*/grub.exe .
529     rm -rf grub4dos*
530     cp tmp/* .
531     rm -rf tmp
532     # echo 'done'
533    
534     if [ ! -z "$splash" ];then
535     echo -n "Copying new spalsh screen... "
536     cp -L "$splash" /root/tmp/clonezilla-sysresccd/isolinux/ocswp.png
537     echo 'done'
538     else
539     cp -L /root/.clonezilla-sysresccd/files/default-ocswp.png /root/tmp/clonezilla-sysresccd/isolinux/ocswp.png
540     fi
541    
542     echo -n "Copying Super Grub Disk... "
543     cp -L /root/.clonezilla-sysresccd/files/sgd.img /root/tmp/clonezilla-sysresccd/bootdisk/sgd.img && echo 'done' || {
544     echo
545     echo
546     echo
547     echo " Error: Copying Super Grub Disk failed!!!"
548     echo
549     echo " Please make sure that the image file exists"
550     echo " Image file: /root/tmp/clonezilla-sysresccd/bootdisk/sgd.img"
551     echo
552     echo
553     cleanUp
554     exit 1
555     }
556     if [ -e /root/.clonezilla-sysresccd/files/sgd2.img ];then
557     echo -n "Copying Super Grub Disk 2... "
558     cp -L /root/.clonezilla-sysresccd/files/sgd2.img /root/tmp/clonezilla-sysresccd/bootdisk/grubdisk.img && echo 'done' || {
559     echo
560     echo
561     echo
562     echo " Error: Copying Super Grub Disk 2 failed!!!"
563     echo
564     echo " Please make sure that the image file exists"
565     echo " Image file: /root/tmp/clonezilla-sysresccd/bootdisk/sgd2.img"
566     echo
567     echo
568     cleanUp
569     exit 1
570     }
571     fi
572     echo -n "Copying new cfg file(s)... "
573     if [ -z $(echo "$cfgFile" | grep 'cfg$') ];then
574 sng 93 tar -C /root/tmp/clonezilla-sysresccd -xzhf /root/.clonezilla-sysresccd/files/menu-for-iso.tar.gz
575 sng 47 else
576     cp -L "$cfgFile" /root/tmp/clonezilla-sysresccd/isolinux/isolinux.cfg
577     fi
578     echo 'done'
579    
580     echo -n "Creating folder restorecd... "
581     WHERE="$(pwd)"
582     mkdir /root/tmp/clonezilla-sysresccd/restorecd 2>/dev/null
583     cd /root/.clonezilla-sysresccd/files
584 sng 64 cp -L pre* ocs-iso what-cd patch-clonezilla-sysresccd continue-multi-cd isolinux-restore-cd.cfg \
585 sng 93 isolinux-restore-cd-ram.cfg menu-for-iso.tar.gz doc.tar.gz imginfo imgconvert cust-menu /root/tmp/clonezilla-sysresccd/restorecd
586 sng 47 cp -L default-restore-ocswp.png /root/tmp/clonezilla-sysresccd/restorecd/ocswp.png
587     cp sbminst /root/tmp/clonezilla-sysresccd/restorecd
588    
589     # Copy Smart Boot Manager and rawrite-fdimage to bootdisk
590     mkdir /root/tmp/clonezilla-sysresccd/rawrite
591     cp raw* fd* *dll /root/tmp/clonezilla-sysresccd/rawrite
592     cp sbm.img /root/tmp/clonezilla-sysresccd/bootdisk
593     cd "$DebianLiveFolder" 2>/dev/null || debFilesError=yes
594     # if [ -s files.tar.gz ];then
595     # cp -L files.tar.gz /root/tmp/clonezilla-sysresccd/restorecd/ 2>/dev/null || debFilesError=yes
596     # else
597     # [ -e "$DebianLiveFolder"/unifont.bgf ] || {
598     # uniFontCopied=yes
599     # cp -L /root/.clonezilla-sysresccd/files/unifont.bgf "$DebianLiveFolder"
600     # }
601     # tar chzf /root/tmp/clonezilla-sysresccd/restorecd/files.tar.gz unifont.bgf debian-live-for-ocs.iso 2>/dev/null || debFilesError=yes
602     # [ -z "$uniFontCopied" ] || rm "$DebianLiveFolder"/unifont.bgf
603     # fi
604     # [ -z "$debFilesError" ] || {
605     # echo
606     # echo
607     # echo
608     # echo " Error: Copying files.tar.gz failed!!!"
609     # echo
610     # echo " Please make sure that the variable DebianLiveFolder points either to"
611     # echo " the folder where the files unifont.bgf and debian-live-for-ocs.iso"
612     # echo " reside, or the files files.tar.gz (which contains unifont.bgf and"
613     # echo " debian-live-for-ocs.iso) can be found"
614     # echo
615     # echo
616     # echo
617     # cleanUp
618     # exit 1
619     # }
620     cd "$WHERE"
621     echo "done"
622    
623     echo -n "Copying documentation files... "
624     cd /root/tmp/clonezilla-sysresccd
625     tar xzhf /root/tmp/clonezilla-sysresccd/restorecd/doc.tar.gz
626     echo 'done'
627    
628     if [ ! -z "$exScript" ];then
629     # echo -n "Executing external script: \"$exScript\"... "
630     echo -n "Executing external script... "
631     . "$exScript" || {
632     echo
633     echo
634     echo
635     echo " Error: The execution of the script failed!!!"
636     echo " Please correct it and try again"
637     echo
638     echo " Script: \"$exScript\""
639     cleanUp
640     exit 1
641     }
642 sng 61 echo 'done'
643 sng 47 fi
644     # echo
645     # echo
646     # echo
647     else
648     trap cleanUp 2
649     cleanUpValue=1
650     if [ ! -d /root/tmp/clonezilla-sysresccd ];then
651     echo " Error accessing folder \"/root/tmp/clonezilla-sysresccd\""
652     exitStatus=1
653     cleanUp
654     fi
655     fi
656    
657     # move extra folders into utils
658     mv /root/tmp/clonezilla-sysresccd/rawrite /root/tmp/clonezilla-sysresccd/bootprog /root/tmp/clonezilla-sysresccd/utils
659     mv /root/tmp/clonezilla-sysresccd/version /root/tmp/clonezilla-sysresccd/SystemRescueCD-Version
660    
661 sng 68 #
662     # re-build clonezilla filesystem.squashfs
663     #
664     echo -n "Rebuilding Clonezilla squashfs... "
665     cd /root/tmp/clonezilla-sysresccd/live
666     unsquashfs filesystem.squashfs 2>/dev/null 1>&2
667     cp -r ../README* ../doc ../restorecd squashfs-root
668     mksquashfs squashfs-root aa.squashfs -always-use-fragments -no-duplicates -all-root 2>/dev/null 1>&2
669     mv aa.squashfs filesystem.squashfs
670     rm -rf squashfs-root
671     cd
672     echo 'done'
673    
674 sng 47 if [ $onlyCopyFiles -eq 1 ];then
675     cleanUpValue=1
676     # echo
677     # echo
678     echo "Both CDs have been copyied in: /root/tmp/clonezilla-sysresccd"
679     cleanUp
680     fi
681     echo
682 sng 61 if [ -z "$auto" ]; then
683     echo -n "Ready to create new ISO file.
684 sng 47
685     ************************************************************************
686     Ready to master your CD. If you want to alter any files contained
687     in the CD, now is the right time.
688     CD root is \"/root/tmp/clonezilla-sysresccd\"
689    
690     When you are done
691     ***********************************************************************
692    
693     Press ENTER to continue... "
694     read
695 sng 61 else
696     echo "Creating new ISO file."
697     fi
698 sng 47 find /root/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';'
699 sng 93 # $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
700     $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
701 sng 47 echo "
702     Done creating new ISO file
703     The file is saved as $outFile"
704     ans=c
705     chIsoHyb=`type isohybrid 2>/dev/null`
706     if [ -n "$chIsoHyb" ];then
707     echo -n "Isohybriding $outFile... "
708     isohybrid "$outFile"
709     echo 'done'
710     fi
711    
712 sng 61 if [ -z "$auto" ];then
713 sng 47 echo '
714    
715     '
716 sng 61 fi
717 sng 47 else
718     while [ ! -r "$outFile" ];do
719     echo 'Insert "clonezilla-resccd" ISO file name'
720     echo -n "> "
721     read outFile
722     done
723     ans=y
724     fi
725    
726     if [ $onlyCreateISO -eq 1 ];then ans=n;fi
727    
728     while [ 1 ];do
729     if [ "$ans" = "" ];then ans=y;fi
730     if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "n" ] || [ "$ans" = "N" ];then break;fi
731 sng 61 if [ -n "$auto" ]; then
732     ans=n
733     else
734     echo -n "Do you want to burn this ISO file? ([y]/n): "
735     read ans
736     fi
737 sng 47 done
738     burnISO=0
739     if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
740     echo
741     echo "File to burn: $outFile"
742     echo
743     burnISO=1
744     # decectDVDWriter
745    
746 sng 58 # CDRECORDER=$(sh /root/.clonezilla-sysresccd/files/what-cd -wb)
747     chmod +x /root/.clonezilla-sysresccd/files/what-cd
748     CDRECORDER=$(/root/.clonezilla-sysresccd/files/what-cd -wb)
749     chmod -x /root/.clonezilla-sysresccd/files/what-cd
750 sng 47
751     echo CD redorder found: "$CDRECORDER"
752     ans=''
753     until [ "$ans" = "y" ] || [ "$ans" = "Y" ];do
754     echo -n "Is this correct? ([y]/n): "
755     read ans
756     if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "" ];then
757     ans='y'
758     cdW="$CDRECORDER"
759     else
760     echo -n "Insert your CD redorder device name ($CDRECORDER): "
761     read cdW
762     if [ "$cdW" = "" ];then cdW="$CDRECORDER";fi
763     echo CD redorder: "$cdW"
764     fi
765     done
766     fi
767    
768     if [ $burnISO -eq 1 ];then
769     ans=c
770     while [ 1 ];do
771     if [ "$ans" = "" ];then ans="y";fi
772     if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "n" ] || [ "$ans" = "N" ];then break;fi
773     echo -n "Does the CD need blanking (RW-CD)? ([y]/n): "
774     read ans
775     done
776     if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
777     blankCD=1
778     else
779     blankCD=0
780     fi
781     ans=c
782     while [ 1 ];do
783     if [ "$ans" = "" ];then ans="y";fi
784     if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "n" ] || [ "$ans" = "N" ];then break;fi
785     echo -n "Do you wan to to start a multi-session CD? ([y]/n): "
786     read ans
787     done
788     if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
789     MULTI='-multi'
790     else
791     MULTI=''
792     fi
793    
794     clear
795     echo "Ready to burn the ISO file to CD. Please load a (re)writable CD
796     in $cdW and Press ENTER to continue... "
797     read
798     echo -n "Unmounting CD... "
799     while [ $(mount |grep "$cdW" | wc -l) -gt 0 ] ;do
800     umount "$cdW" 2>/dev/null
801     done
802     echo 'done'
803     if [ $blankCD -eq 1 ];then
804     echo "Blanking CD...
805     -----------"
806     cdrecord dev="$cdW" blank=fast -eject || errorMount '
807    
808     Error: Blanking procedure failed...
809    
810    
811     '
812     fi
813     echo
814     echo "Burinng ISO file
815     ----------------"
816     cdrecord -v dev="$cdW" driveropts=burnfree "$MULTI" -eject "$outFile" || errorMount '
817    
818     Error: Burning procedure failed...
819    
820    
821     '
822     fi
823     cleanUp

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26