/[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 140 - (show annotations)
Mon Sep 27 17:02:51 2010 UTC (13 years, 6 months ago) by sng
File MIME type: application/x-sh
File size: 23927 byte(s)
preparing for 3.2.0
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 "$SAVE_DIR"/tmp folder... "
113 mkdir "$SAVE_DIR"/tmp 2>/dev/null
114 if [ ! -d "$SAVE_DIR"/tmp ];then
115 echo
116 echo " Error creating folder: "$SAVE_DIR"/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 "$SAVE_DIR"/tmp/clonezilla-sysresccd-"$version".iso 2>/dev/null
124 rm -rf "$SAVE_DIR"/tmp/syscd 2>/dev/null
125 rm -rf "$SAVE_DIR"/tmp/clonecd 2>/dev/null
126 rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd 2>/dev/null
127 mkdir "$SAVE_DIR"/tmp/syscd "$SAVE_DIR"/tmp/clonecd "$SAVE_DIR"/tmp/clonezilla-sysresccd 2>/dev/null
128 if [ ! -d "$SAVE_DIR"/tmp/syscd ];then
129 echo
130 echo " Error creating temp folder: "$SAVE_DIR"/tmp/syscd"
131 exit 1
132 fi
133 if [ ! -d "$SAVE_DIR"/tmp/clonecd ];then
134 echo
135 echo " Error creating temp folder: "$SAVE_DIR"/tmp/clonecd"
136 exit 1
137 fi
138
139
140 if [ ! -d "$SAVE_DIR"/tmp/clonezilla-sysresccd ];then
141 echo
142 echo " Error creating temp folder: "$SAVE_DIR"/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: "$SAVE_DIR"/tmp/output.iso"
156 rm "$SAVE_DIR"/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 "$SAVE_DIR"/tmp/clonecd 2>/dev/null
165 umount "$SAVE_DIR"/tmp/syscd 2>/dev/null
166 if [ -z "$cleanUpValue" ];then
167 rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd 2>/dev/null
168 fi
169 rm -rf "$SAVE_DIR"/tmp/clonecd "$SAVE_DIR"/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 \""$SAVE_DIR"/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 d [folder] Use [folder]/tmp as temporary and output folder
226 instead of $HOME/tmp
227 x [script] A user defined and written BASH script
228 to be executed just before mastering the CD
229 v print version and exit
230 h print this screen and exit
231
232 More information on available customization in file
233 /root/.clonezilla-sysresccd/clonezilla-sysresccd.conf"
234 }
235
236 function printVersion(){
237 echo "$(basename $0) - v $version - Spiros Georgaras <sng@hellug.gr>
238 A utility to create a multi boot CD containing
239 Clonezilla Live CD and
240 System Rescue CD
241 (they have to be downloaded seperately)"
242 exit
243 }
244
245 # function decectDVDWriter(){
246 # local z
247 # # local DEV0 DEV1
248 # local CDW0 CDW1
249 # local DVDW0 DVDW1
250 #
251 # z=`cat /proc/sys/dev/cdrom/info 2>/dev/null | grep name | sed 's/.*name://' | sed 's/[ ][ ]*/ /g'| sed 's/^[ ][ ]*//' `
252 # DEV0=`echo "$z" | sed 's/\([^ ]*\).*/\1/'`
253 # DEV1=`echo "$z" | sed 's/[^ ]* *\([^ ]*\)/\1/'`
254 #
255 # z=`cat /proc/sys/dev/cdrom/info 2>/dev/null| grep 'write' | grep 'DVD-R:'| sed 's/.*DVD-R://' | sed 's/[ ][ ]*/ /g'| sed 's/^[ ][ ]*//' `
256 # # echo z=$z
257 # DVDW0=`echo "$z" | sed 's/\([^ ]*\).*/\1/'`
258 # DVDW1=`echo "$z" | sed 's/[^ ]* *\([^ ]*\)/\1/'`
259 #
260 #
261 # z=`cat /proc/sys/dev/cdrom/info 2>/dev/null| grep 'write' | grep 'CD-R:'| sed 's/.*CD-R://' | sed 's/[ ][ ]*/ /g'| sed 's/^[ ][ ]*//' `
262 # # echo z=$z
263 # CDW0=`echo "$z" | sed 's/\([^ ]*\).*/\1/'`
264 # CDW1=`echo "$z" | sed 's/[^ ]* *\([^ ]*\)/\1/'`
265 #
266 # if ! test -z "$DEV0";then
267 # if [ "$DVDW0" = "1" ];then DVDRECORDER=/dev/"$DEV0";fi
268 # if [ "$CDW0" = "1" ];then CDRECORDER=/dev/"$DEV0";fi
269 # fi
270 #
271 # if ! test -z "$DEV1";then
272 # if test -z "$DVDRECORDER"; then
273 # if [ "$DVDW1" = "1" ];then
274 # DVDRECORDER=/dev/"$DEV1"
275 # fi
276 # fi
277 # if test -z "$CDRECORDER"; then
278 # if [ "$CDW1" = "1" ];then
279 # CDRECORDER=/dev/"$DEV1"
280 # fi
281 # fi
282 # fi
283 #
284 # }
285
286 function sourceProfiles(){
287 if [ -r /root/.clonezilla-sysresccd/profiles.conf ];then
288 . /root/.clonezilla-sysresccd/profiles.conf 2>/dev/null || profilesError=1
289 profilesExist=1
290 fi
291 if [ $profilesError -eq 1 ];then
292 echo " Error: Your profiles configuration file \"/root/.clonezilla-sysresccd/profiles.conf\""
293 echo " has errors and cannot be used. Please fix the problem and try again"
294 exit 1
295 fi
296 }
297
298
299 function readConfig(){
300 if [ -n "$configAlreadyRead" ];then return; fi
301 test "$(whoami)" = "root" || noRoot
302 [ -r /root/.clonezilla-sysresccd/clonezilla-sysresccd.conf ] || {
303 echo " Error: Your configuration file \"/root/.clonezilla-sysresccd/clonezilla-sysresccd.conf\""
304 echo " does not exist or can not be read. Please fix the problem and try again"
305 exit 1
306 }
307
308 . /root/.clonezilla-sysresccd/clonezilla-sysresccd.conf 2>/dev/null
309 if [ $? -ne 0 ];then
310 echo " Error: Your configuration file \"/root/.clonezilla-sysresccd/clonezilla-sysresccd.conf\""
311 echo " has errors and cannot be used. Please fix the problem and try again"
312 exit 1
313 fi
314 configAlreadyRead='true'
315 }
316
317 ####### Script starts here #######
318 SAVE_DIR="$HOME"
319
320 MKISOFS=genisoimage
321 onlyBurnISO=0
322 onlyCopyFiles=0
323 onlyCreateISO=0
324 noFileCopy=0
325 exitStatus=0
326
327 profilesExist=0
328 profilesError=0
329
330
331 while getopts ":asp:bfihvn:x:d:" Option
332 do
333 case $Option in
334 a)
335 auto=yes
336 ;;
337 s)
338 readConfig
339 sourceProfiles
340 if [ $profilesExist -eq 1 ];then
341 readProfiles
342 until [ ! -z "$prN" ];do
343 clear
344 echo "Available profiles"
345 for i in `seq 0 $numOfProfiles`;do
346 echo " Profile[$i]: ${profile[$i]}"
347 done
348 echo -n "Insert profile number ([0]-$numOfProfiles): "
349 read prN
350 test -z "$prN" && prN=0
351 isnumber "$prN" || prN=''
352 if [ $prN -gt $numOfProfiles ] 2>/dev/null; then prN='';fi
353 done
354 applyProfile $prN
355 else
356 echo " Error: You have requested to use profiles but your profiles configuration file"
357 echo " \"/root/.clonezilla-sysresccd/profiles.conf\" does not exist or cannot be read"
358 exit 1
359 fi
360 ;;
361 p)
362 readConfig
363 sourceProfiles
364 if [ $profilesExist -eq 1 ];then
365 if $(isnumber "$OPTARG");then
366 applyProfile $OPTARG
367 usingProfile=yes
368 else
369 echo " Error in parameter: -p $OPTARG"
370 exit 1
371 fi
372 else
373 echo " Error: You have requested to use profile No $OPTARG but your profiles configuration file"
374 echo " \"/root/.clonezilla-sysresccd/profiles.conf\" does not exist or cannot be read"
375 exit 1
376 fi
377 ;;
378 b)
379 readConfig
380 onlyBurnISO=1;;
381 f)
382 readConfig
383 onlyCopyFiles=1;;
384 i)
385 readConfig
386 onlyCreateISO=1;;
387 x)
388 readConfig
389 [ -s "OPTARG" ] || {
390 echo " Error: The specified script \"$OPTARG\" cannot be found"
391 exit 1
392 }
393 [ -r "$OPTARG" ] && exScript="$OPTARG" || {
394 echo " Error: The specified script \"$OPTARG\" cannot be read"
395 exit 1
396 };;
397 h)
398 printHelp
399 exit
400 ;;
401 v)
402 printVersion
403 ;;
404 n)
405 readConfig
406 if [ "$OPTARG" != "f" ] ;then
407 echo "Error: Not a valid parameter -n$OPTARG"
408 exit 1
409 fi
410 noFileCopy=1
411 ;;
412 d)
413 SAVE_DIR="$OPTARG"
414 if [ ! -d "$SAVE_DIR" ]; then
415 mkdir "$SAVEDIR" 2>/dev/null
416 if [ -d "$SAVE_DIR" ];then
417 echo "Error: \"$SAVE_DIR\" cannot be created!!!"
418 exit 1
419 fi
420 fi
421 ;;
422
423 esac
424 done
425 shift $(($OPTIND - 1))
426
427 test "$(whoami)" = "root" || noRoot
428
429 # chack auto mode
430 if [ -n "$auto" ];then
431 if [ -z "$usingProfile" ];then
432 echo ' Error: Parameter -a used without -p'
433 exit 1
434 fi
435 if [ "$onlyBurnISO" -eq 1 ];then
436 echo " Error: Conflicting parameters -a and -b used"
437 exit 1
438 fi
439 fi
440
441 # Check input parameters
442 checkInParms=0
443 checkInParms=$(( onlyBurnISO + onlyCreateISO + onlyCopyFiles + noFileCopy ))
444 if [ $noFileCopy -eq 1 ] && [ $onlyCreateISO -eq 1 ];then
445 okToContinue=1
446 elif [ $checkInParms -gt 1 ];then
447 echo " Error: Conflicting input parameters detected..."
448 exit 1
449 fi
450 if [ "$outName" = "" ];then
451 outFile="$SAVE_DIR"/tmp/clonezilla-sysresccd-"$version".iso
452 else
453 outFile="$SAVE_DIR"/tmp/clonezilla-sysresccd-"$outName"-"$version".iso
454 fi
455
456 if [ $onlyBurnISO -eq 0 ];then
457 if [ $noFileCopy -eq 0 ];then
458 while [ "$ans" != "y" ] || [ "$ans" = "Y" ];do
459 test -z "$sysCD" && getSysCD
460 test -z "$cloneCD" && getCloneCD
461 test -z "$cfgFile" && getcfgFile
462 test -z "$exScript" && getScript
463 # test -z "$DebianLiveFolder" && getDebianLiveFolder
464 clear
465 # echo -n "Current settings:
466 # System Rescue CD: $sysCD
467 # Clonezilla Live CD: $cloneCD
468 # isolinux.cfg to use: $cfgFile
469 # Debian Live folder: $DebianLiveFolder
470 # script to execute: $exScript
471 #
472 # Is this correct? (y/[n]): "
473
474 if [ -n "$auto" ]; then
475 ans=y
476 else
477 echo -n "Current settings:
478 System Rescue CD: $sysCD
479 Clonezilla Live CD: $cloneCD
480 isolinux.cfg to use: $cfgFile
481 script to execute: $exScript
482
483 Is this correct? (y/[n]): "
484
485 read ans
486 fi
487 if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then
488 sysCD=''
489 cloneCD=''
490 cfgFile=''
491 fi
492 done
493 ans=''
494 while [ 1 ];do
495 test -z "$preparerID" && getPreparer
496 test -z "$publisher" && getPublisher
497 test -z "$volLabel" && getvolLabel
498
499 if [ -n "$auto" ]; then
500 ans=y
501 else
502 clear
503 echo -n "Current CD info:
504 Preparer: $preparerID
505 Publisher: $publisher
506 Volume label: $volLabel
507
508 Is this correct? (y/[n]): "
509 read ans
510 fi
511 if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then
512 preparerID=''
513 publisher=''
514 volLabel=''
515 fi
516 if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then break;fi
517 done
518 trap cleanUp 2
519 clear
520 echo "$(basename $0) - v $version - Spiros Georgaras <sng@hellug.gr>
521 "
522 createTempFolders
523
524 echo -n "Mounting ISO files... "
525 mount "$sysCD" "$SAVE_DIR"/tmp/syscd -o loop || errorMount ' Error mounting "System Rescue CD" file'
526 mount "$cloneCD" "$SAVE_DIR"/tmp/clonecd -o loop || errorMount ' Error mounting Clonezilla" file'
527 echo 'done'
528 echo -n "Copying files... "
529 cp -RL "$SAVE_DIR"/tmp/syscd/* "$SAVE_DIR"/tmp/clonezilla-sysresccd
530 cp -RL "$SAVE_DIR"/tmp/clonecd/* "$SAVE_DIR"/tmp/clonezilla-sysresccd
531 echo 'done'
532
533
534 # echo -n "Extracting boot programs... "
535 echo "Extracting boot programs... "
536 cd "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootprog
537 mkdir tmp
538 cp *zip tmp
539 unzip -x sys*zip win32/syslinux.exe
540 mv win32/* .
541 rmdir win32
542 unzip -x gr* gr*/grub.exe
543 mv gr*/grub.exe .
544 rm -rf grub4dos*
545 cp tmp/* .
546 rm -rf tmp
547 # echo 'done'
548
549 if [ ! -z "$splash" ];then
550 echo -n "Copying new spalsh screen... "
551 cp -L "$splash" "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/ocswp.png
552 echo 'done'
553 else
554 cp -L /root/.clonezilla-sysresccd/files/default-ocswp.png "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/ocswp.png
555 fi
556
557 echo -n "Copying Super Grub Disk... "
558 cp -L /root/.clonezilla-sysresccd/files/sgd.img "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/sgd.img && echo 'done' || {
559 echo
560 echo
561 echo
562 echo " Error: Copying Super Grub Disk failed!!!"
563 echo
564 echo " Please make sure that the image file exists"
565 echo " Image file: "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/sgd.img"
566 echo
567 echo
568 cleanUp
569 exit 1
570 }
571 if [ -e /root/.clonezilla-sysresccd/files/sgd2.img ];then
572 echo -n "Copying Super Grub Disk 2... "
573 cp -L /root/.clonezilla-sysresccd/files/sgd2.img "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/grubdisk.img && echo 'done' || {
574 echo
575 echo
576 echo
577 echo " Error: Copying Super Grub Disk 2 failed!!!"
578 echo
579 echo " Please make sure that the image file exists"
580 echo " Image file: "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/sgd2.img"
581 echo
582 echo
583 cleanUp
584 exit 1
585 }
586 fi
587 echo -n "Copying new cfg file(s)... "
588 if [ -z $(echo "$cfgFile" | grep 'cfg$') ];then
589 tar -C "$SAVE_DIR"/tmp/clonezilla-sysresccd -xzhf /root/.clonezilla-sysresccd/files/menu-for-iso.tar.gz
590 else
591 cp -L "$cfgFile" "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/isolinux.cfg
592 fi
593 echo 'done'
594
595 echo -n "Creating folder restorecd... "
596 WHERE="$(pwd)"
597 mkdir "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd 2>/dev/null
598 cd /root/.clonezilla-sysresccd/files
599 cp -L pre* ocs-iso what-cd patch-clonezilla-sysresccd continue-multi-cd isolinux-restore-cd.cfg \
600 isolinux-restore-cd-ram.cfg menu-for-iso.tar.gz doc.tar.gz imginfo imgconvert cust-menu "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd
601 cp -L default-restore-ocswp.png "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/ocswp.png
602 cp sbminst "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd
603
604 # Copy Smart Boot Manager and rawrite-fdimage to bootdisk
605 mkdir "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite
606 cp raw* fd* *dll "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite
607 cp sbm.img "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk
608 cd "$DebianLiveFolder" 2>/dev/null || debFilesError=yes
609 # if [ -s files.tar.gz ];then
610 # cp -L files.tar.gz "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/ 2>/dev/null || debFilesError=yes
611 # else
612 # [ -e "$DebianLiveFolder"/unifont.bgf ] || {
613 # uniFontCopied=yes
614 # cp -L /root/.clonezilla-sysresccd/files/unifont.bgf "$DebianLiveFolder"
615 # }
616 # tar chzf "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/files.tar.gz unifont.bgf debian-live-for-ocs.iso 2>/dev/null || debFilesError=yes
617 # [ -z "$uniFontCopied" ] || rm "$DebianLiveFolder"/unifont.bgf
618 # fi
619 # [ -z "$debFilesError" ] || {
620 # echo
621 # echo
622 # echo
623 # echo " Error: Copying files.tar.gz failed!!!"
624 # echo
625 # echo " Please make sure that the variable DebianLiveFolder points either to"
626 # echo " the folder where the files unifont.bgf and debian-live-for-ocs.iso"
627 # echo " reside, or the files files.tar.gz (which contains unifont.bgf and"
628 # echo " debian-live-for-ocs.iso) can be found"
629 # echo
630 # echo
631 # echo
632 # cleanUp
633 # exit 1
634 # }
635 cd "$WHERE"
636 echo "done"
637
638 echo -n "Copying documentation files... "
639 cd "$SAVE_DIR"/tmp/clonezilla-sysresccd
640 tar xzhf "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/doc.tar.gz
641 echo 'done'
642
643 if [ ! -z "$exScript" ];then
644 # echo -n "Executing external script: \"$exScript\"... "
645 echo -n "Executing external script... "
646 . "$exScript" || {
647 echo
648 echo
649 echo
650 echo " Error: The execution of the script failed!!!"
651 echo " Please correct it and try again"
652 echo
653 echo " Script: \"$exScript\""
654 cleanUp
655 exit 1
656 }
657 echo 'done'
658 fi
659 # echo
660 # echo
661 # echo
662 else
663 trap cleanUp 2
664 cleanUpValue=1
665 if [ ! -d "$SAVE_DIR"/tmp/clonezilla-sysresccd ];then
666 echo " Error accessing folder \""$SAVE_DIR"/tmp/clonezilla-sysresccd\""
667 exitStatus=1
668 cleanUp
669 fi
670 fi
671
672 # move extra folders into utils
673 mv "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootprog "$SAVE_DIR"/tmp/clonezilla-sysresccd/utils
674 mv "$SAVE_DIR"/tmp/clonezilla-sysresccd/version "$SAVE_DIR"/tmp/clonezilla-sysresccd/SystemRescueCD-Version
675
676 #
677 # re-build clonezilla filesystem.squashfs
678 #
679 echo -n "Rebuilding Clonezilla squashfs... "
680 cd "$SAVE_DIR"/tmp/clonezilla-sysresccd/live
681 unsquashfs filesystem.squashfs 2>/dev/null 1>&2
682 cp -r ../README* ../doc ../restorecd squashfs-root
683 mksquashfs squashfs-root aa.squashfs -always-use-fragments -no-duplicates -all-root 2>/dev/null 1>&2
684 mv aa.squashfs filesystem.squashfs
685 rm -rf squashfs-root
686 cd
687 echo 'done'
688
689 if [ $onlyCopyFiles -eq 1 ];then
690 cleanUpValue=1
691 # echo
692 # echo
693 echo "Both CDs have been copyied in: "$SAVE_DIR"/tmp/clonezilla-sysresccd"
694 cleanUp
695 fi
696 echo
697 if [ -z "$auto" ]; then
698 echo -n "Ready to create new ISO file.
699
700 ************************************************************************
701 Ready to master your CD. If you want to alter any files contained
702 in the CD, now is the right time.
703 CD root is \""$SAVE_DIR"/tmp/clonezilla-sysresccd\"
704
705 When you are done
706 ***********************************************************************
707
708 Press ENTER to continue... "
709 read
710 else
711 echo "Creating new ISO file."
712 fi
713 find "$SAVE_DIR"/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';'
714 # $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" "$SAVE_DIR"/tmp/clonezilla-sysresccd || errorISO
715 $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" "$SAVE_DIR"/tmp/clonezilla-sysresccd || errorISO
716 echo "
717 Done creating new ISO file
718 The file is saved as $outFile"
719 ans=c
720 chIsoHyb=`type isohybrid 2>/dev/null`
721 if [ -n "$chIsoHyb" ];then
722 echo -n "Isohybriding $outFile... "
723 isohybrid "$outFile"
724 echo 'done'
725 fi
726
727 if [ -z "$auto" ];then
728 echo '
729
730 '
731 fi
732 else
733 while [ ! -r "$outFile" ];do
734 echo 'Insert "clonezilla-resccd" ISO file name'
735 echo -n "> "
736 read outFile
737 done
738 ans=y
739 fi
740
741 if [ $onlyCreateISO -eq 1 ];then ans=n;fi
742
743 while [ 1 ];do
744 if [ "$ans" = "" ];then ans=y;fi
745 if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "n" ] || [ "$ans" = "N" ];then break;fi
746 if [ -n "$auto" ]; then
747 ans=n
748 else
749 echo -n "Do you want to burn this ISO file? ([y]/n): "
750 read ans
751 fi
752 done
753 burnISO=0
754 if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
755 echo
756 echo "File to burn: $outFile"
757 echo
758 burnISO=1
759 # decectDVDWriter
760
761 # CDRECORDER=$(sh /root/.clonezilla-sysresccd/files/what-cd -wb)
762 chmod +x /root/.clonezilla-sysresccd/files/what-cd
763 CDRECORDER=$(/root/.clonezilla-sysresccd/files/what-cd -wb)
764 chmod -x /root/.clonezilla-sysresccd/files/what-cd
765
766 echo CD redorder found: "$CDRECORDER"
767 ans=''
768 until [ "$ans" = "y" ] || [ "$ans" = "Y" ];do
769 echo -n "Is this correct? ([y]/n): "
770 read ans
771 if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "" ];then
772 ans='y'
773 cdW="$CDRECORDER"
774 else
775 echo -n "Insert your CD redorder device name ($CDRECORDER): "
776 read cdW
777 if [ "$cdW" = "" ];then cdW="$CDRECORDER";fi
778 echo CD redorder: "$cdW"
779 fi
780 done
781 fi
782
783 if [ $burnISO -eq 1 ];then
784 ans=c
785 while [ 1 ];do
786 if [ "$ans" = "" ];then ans="y";fi
787 if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "n" ] || [ "$ans" = "N" ];then break;fi
788 echo -n "Does the CD need blanking (RW-CD)? ([y]/n): "
789 read ans
790 done
791 if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
792 blankCD=1
793 else
794 blankCD=0
795 fi
796 ans=c
797 while [ 1 ];do
798 if [ "$ans" = "" ];then ans="y";fi
799 if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "n" ] || [ "$ans" = "N" ];then break;fi
800 echo -n "Do you wan to to start a multi-session CD? ([y]/n): "
801 read ans
802 done
803 if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
804 MULTI='-multi'
805 else
806 MULTI=''
807 fi
808
809 clear
810 echo "Ready to burn the ISO file to CD. Please load a (re)writable CD
811 in $cdW and Press ENTER to continue... "
812 read
813 echo -n "Unmounting CD... "
814 while [ $(mount |grep "$cdW" | wc -l) -gt 0 ] ;do
815 umount "$cdW" 2>/dev/null
816 done
817 echo 'done'
818 if [ $blankCD -eq 1 ];then
819 echo "Blanking CD...
820 -----------"
821 cdrecord dev="$cdW" blank=fast -eject || errorMount '
822
823 Error: Blanking procedure failed...
824
825
826 '
827 fi
828 echo
829 echo "Burinng ISO file
830 ----------------"
831 cdrecord -v dev="$cdW" driveropts=burnfree "$MULTI" -eject "$outFile" || errorMount '
832
833 Error: Burning procedure failed...
834
835
836 '
837 fi
838 cleanUp

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26