18 |
# with Clonezilla-SysRescCD. If not, see <http://www.gnu.org/licenses/>. # |
# with Clonezilla-SysRescCD. If not, see <http://www.gnu.org/licenses/>. # |
19 |
# # |
# # |
20 |
############################################################################## |
############################################################################## |
21 |
|
function evalPrograms(){ |
22 |
|
local ans |
23 |
|
|
24 |
|
echo -n "Looking for curl... " |
25 |
|
if [ -z "$(curl -V 2>/dev/null)" ];then |
26 |
|
echo failed |
27 |
|
unset curlFound |
28 |
|
echo |
29 |
|
echo "curl was not found on your system, so the ISO files cannot be download" |
30 |
|
echo "Please install curl and try again" |
31 |
|
exit 1 |
32 |
|
else |
33 |
|
echo found |
34 |
|
curlFound=1 |
35 |
|
fi |
36 |
|
|
37 |
|
echo -n "Looking for md5sum... " |
38 |
|
if [ -z "$(md5sum --version 2>/dev/null)" ];then |
39 |
|
echo failed |
40 |
|
unset md5sumFound |
41 |
|
echo |
42 |
|
echo " Info: md5sum was not found on your system" |
43 |
|
echo " The ISO files will not be validated." |
44 |
|
echo |
45 |
|
echo -n " Do you want to continue? (y/[n]) " |
46 |
|
read ans |
47 |
|
if [ "$ans" != "y" ];then |
48 |
|
exit |
49 |
|
fi |
50 |
|
else |
51 |
|
echo found |
52 |
|
md5sumFound=1 |
53 |
|
fi |
54 |
|
} |
55 |
|
|
56 |
|
function downloadIsoFiles(){ |
57 |
|
local clonIso |
58 |
|
local sysIso="http://sourceforge.net/projects/systemrescuecd/files/sysresccd-x86/"$sysVersion"/systemrescuecd-x86-"$sysVersion".iso/download" |
59 |
|
|
60 |
|
# Start with Clonezilla Live |
61 |
|
if [ "$1" = "all" ] || [ -z "$1" ];then |
62 |
|
# Download all files |
63 |
|
for clonType in i686 i486 amd64;do |
64 |
|
clonIso="http://sourceforge.net/projects/clonezilla/files/clonezilla_live_stable/OldFiles/"$clonVersion"/clonezilla-live-"$clonVersion"-"$clonType".iso/download" |
65 |
|
downloadClonezillaLive |
66 |
|
done |
67 |
|
else |
68 |
|
clonType="$1" |
69 |
|
clonIso="http://sourceforge.net/projects/clonezilla/files/clonezilla_live_stable/OldFiles/"$clonVersion"/clonezilla-live-"$clonVersion"-"$clonType".iso/download" |
70 |
|
downloadClonezillaLive |
71 |
|
fi |
72 |
|
|
73 |
|
# Download System Rescue CD |
74 |
|
echo " |
75 |
|
****** Downloading System Rescue CD "$sysVersion" ******" |
76 |
|
unset curlContinue |
77 |
|
if [ -e systemrescuecd-x86-"$sysVersion".iso ];then |
78 |
|
if [ -n "$md5sumFound" ];then |
79 |
|
echo "$sysmd5 systemrescuecd-x86-"$sysVersion".iso" > test.md5sum |
80 |
|
echo -n "File found. Checking integrity of " |
81 |
|
md5sum -c test.md5sum 2>/dev/null |
82 |
|
if [ "$?" -eq 0 ];then |
83 |
|
rm -f test.md5sum 2>/dev/null |
84 |
|
return |
85 |
|
else |
86 |
|
echo "File systemrescuecd-x86-"$sysVersion".iso already exists" |
87 |
|
echo "You can continue downloading the file or restart it" |
88 |
|
echo -n "Continue downloading? (y/[n]): " |
89 |
|
read ans |
90 |
|
if [ "$ans" = "y" ];then |
91 |
|
curlContinue=1 |
92 |
|
else |
93 |
|
rm -f test.md5sum 2>/dev/null |
94 |
|
fi |
95 |
|
fi |
96 |
|
else |
97 |
|
echo "File systemrescuecd-x86-"$sysVersion".iso already exists" |
98 |
|
echo "You can continue downloading the file or restart it" |
99 |
|
echo "If you do continue downloading, and since md5sum was not found," |
100 |
|
echo "make sure you check the file's integrity manually, after the" |
101 |
|
echo "download is complete" |
102 |
|
echo -n "Continue downloading? (y/[n]): " |
103 |
|
read ans |
104 |
|
if [ "$ans" = "y" ];then |
105 |
|
curlContinue=1 |
106 |
|
fi |
107 |
|
fi |
108 |
|
fi |
109 |
|
if [ -z "$curlContinue" ];then |
110 |
|
curl -L "$sysIso" -o systemrescuecd-x86-"$sysVersion".iso |
111 |
|
else |
112 |
|
curl -L -C - "$sysIso" -o systemrescuecd-x86-"$sysVersion".iso |
113 |
|
fi |
114 |
|
# Check integrity |
115 |
|
echo "$sysmd5 systemrescuecd-x86-"$sysVersion".iso" > test.md5sum |
116 |
|
echo -n "Checking integrity of " |
117 |
|
md5sum -c test.md5sum 2>/dev/null |
118 |
|
if [ "$?" -eq 1 ];then |
119 |
|
echo "Integrity check on systemrescuecd-x86-"$sysVersion".iso failed!!!" |
120 |
|
echo -n "Do you want to delete this file? ([y]/n): " |
121 |
|
read ans |
122 |
|
if [ "$ans" != "y" ];then |
123 |
|
rm -f systemrescuecd-x86-"$sysVersion".iso 2>/dev/null && echo "File deleted..." || echo "****** Error deleting file!!! ****** |
124 |
|
Please delete systemrescuecd-x86-"$sysVersion".iso manually" |
125 |
|
fi |
126 |
|
rm -f test.md5sum 2>/dev/null |
127 |
|
fi |
128 |
|
} |
129 |
|
|
130 |
|
function downloadClonezillaLive(){ |
131 |
|
echo " |
132 |
|
****** Downloading Clonezilla Live "$clonVersion" "$clonType" ******" |
133 |
|
unset curlContinue |
134 |
|
if [ -e clonezilla-live-"$clonVersion"-"$clonType".iso ];then |
135 |
|
if [ -n "$md5sumFound" ];then |
136 |
|
if [ "$clonType" = "amd64" ];then |
137 |
|
echo "$amd64md5 clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum |
138 |
|
elif [ "$clonType" = "i486" ];then |
139 |
|
echo "$i486md5 clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum |
140 |
|
else |
141 |
|
echo "$i686md5 clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum |
142 |
|
fi |
143 |
|
unset checkmd5 |
144 |
|
echo -n "File found. Checking integrity of " |
145 |
|
md5sum -c test.md5sum 2>/dev/null && checkmd5=1 |
146 |
|
|
147 |
|
if [ -z "$checkmd5" ];then |
148 |
|
# md5 check failed |
149 |
|
unset checkmd5 |
150 |
|
echo "File clonezilla-live-"$clonVersion"-"$clonType".iso already exists" |
151 |
|
echo "You can continue downloading the file or restart it" |
152 |
|
echo -n "Continue downloading? (y/[n]): " |
153 |
|
read ans |
154 |
|
if [ "$ans" = "y" ];then |
155 |
|
curlContinue=1 |
156 |
|
else |
157 |
|
rm -f test.md5sum 2>/dev/null |
158 |
|
return |
159 |
|
fi |
160 |
|
else |
161 |
|
# file is ok |
162 |
|
return |
163 |
|
fi |
164 |
|
else |
165 |
|
# no md5sum |
166 |
|
echo "File clonezilla-live-"$clonVersion"-"$clonType".iso already exists" |
167 |
|
echo "You can continue downloading the file or restart it" |
168 |
|
echo "If you do continue downloading, and since md5sum was not found," |
169 |
|
echo "make sure you check the file's integrity manually, after the" |
170 |
|
echo "download is complete" |
171 |
|
echo -n "Continue downloading? (y/[n]): " |
172 |
|
read ans |
173 |
|
if [ "$ans" = "y" ];then |
174 |
|
curlContinue=1 |
175 |
|
fi |
176 |
|
fi |
177 |
|
fi |
178 |
|
|
179 |
|
# Check if we have to go to OldFiles |
180 |
|
echo "Checking file availability..." |
181 |
|
oldFiles="$(curl -IL "$clonIso" | grep '301 Moved Permanently')" |
182 |
|
if [ -n "$oldFiles" ];then |
183 |
|
# go to stable |
184 |
|
clonIso="$(echo "$clonIso" | sed 's{OldFiles/{{')" |
185 |
|
echo "This is Clonezilla Live Stable!!!" |
186 |
|
else |
187 |
|
echo "This is an older Clonezilla Live version!!!" |
188 |
|
fi |
189 |
|
|
190 |
|
# Download file |
191 |
|
if [ -z "$curlContinue" ];then |
192 |
|
curl -L "$clonIso" -o clonezilla-live-"$clonVersion"-"$clonType".iso |
193 |
|
else |
194 |
|
curl -L -C - "$clonIso" -o clonezilla-live-"$clonVersion"-"$clonType".iso |
195 |
|
fi |
196 |
|
|
197 |
|
if [ -n "$md5sumFound" ];then |
198 |
|
if [ "$clonType" = "amd64" ];then |
199 |
|
echo "$amd64md5 clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum |
200 |
|
elif [ "$clonType" = "i486" ];then |
201 |
|
echo "$i486md5 clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum |
202 |
|
else |
203 |
|
echo "$i686md5 clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum |
204 |
|
fi |
205 |
|
unset checkmd5 |
206 |
|
echo -n "Checking integrity of " |
207 |
|
md5sum -c test.md5sum 2>/dev/null && checkmd5=1 |
208 |
|
rm -f test.md5sum 2>/dev/null |
209 |
|
if [ -z "$checkmd5" ];then |
210 |
|
echo "Integrity check on clonezilla-live-"$clonVersion"-"$clonType".iso failed!!!" |
211 |
|
echo -n "Do you want to delete this file? ([y]/n): " |
212 |
|
read ans |
213 |
|
if [ "$ans" != "y" ];then |
214 |
|
rm -f clonezilla-live-"$clonVersion"-"$clonType".iso 2>/dev/null && echo "File deleted..." || echo "****** Error deleting file!!! ****** |
215 |
|
Please delete clonezilla-live-"$clonVersion"-"$clonType".iso manually" |
216 |
|
fi |
217 |
|
fi |
218 |
|
fi |
219 |
|
|
220 |
|
|
221 |
|
} |
222 |
|
|
223 |
function noRoot(){ |
function noRoot(){ |
224 |
echo " Error: You must be root to execute this script" |
echo " Error: You must be root to execute this script" |
225 |
exit 1 |
exit 1 |
311 |
|
|
312 |
|
|
313 |
function createTempFolders(){ |
function createTempFolders(){ |
314 |
echo -n "Creating /root/tmp folder... " |
echo -n "Creating "$SAVE_DIR"/tmp folder... " |
315 |
mkdir /root/tmp 2>/dev/null |
mkdir "$SAVE_DIR"/tmp 2>/dev/null |
316 |
if [ ! -d /root/tmp ];then |
if [ ! -d "$SAVE_DIR"/tmp ];then |
317 |
echo |
echo |
318 |
echo " Error creating folder: /root/tmp" |
echo " Error creating folder: "$SAVE_DIR"/tmp" |
319 |
echo " This shouldn't be happening..." |
echo " This shouldn't be happening..." |
320 |
exit 1 |
exit 1 |
321 |
fi |
fi |
322 |
echo 'done' |
echo 'done' |
323 |
|
|
324 |
echo -n "Creating temp folders... " |
echo -n "Creating temp folders... " |
325 |
rm -rf /root/tmp/clonezilla-sysresccd-"$version".iso 2>/dev/null |
rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd-"$version".iso 2>/dev/null |
326 |
rm -rf /root/tmp/syscd 2>/dev/null |
rm -rf "$SAVE_DIR"/tmp/syscd 2>/dev/null |
327 |
rm -rf /root/tmp/clonecd 2>/dev/null |
rm -rf "$SAVE_DIR"/tmp/clonecd 2>/dev/null |
328 |
rm -rf /root/tmp/clonezilla-sysresccd 2>/dev/null |
rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd 2>/dev/null |
329 |
mkdir /root/tmp/syscd /root/tmp/clonecd /root/tmp/clonezilla-sysresccd 2>/dev/null |
mkdir "$SAVE_DIR"/tmp/syscd "$SAVE_DIR"/tmp/clonecd "$SAVE_DIR"/tmp/clonezilla-sysresccd 2>/dev/null |
330 |
if [ ! -d /root/tmp/syscd ];then |
if [ ! -d "$SAVE_DIR"/tmp/syscd ];then |
331 |
echo |
echo |
332 |
echo " Error creating temp folder: /root/tmp/syscd" |
echo " Error creating temp folder: "$SAVE_DIR"/tmp/syscd" |
333 |
exit 1 |
exit 1 |
334 |
fi |
fi |
335 |
if [ ! -d /root/tmp/clonecd ];then |
if [ ! -d "$SAVE_DIR"/tmp/clonecd ];then |
336 |
echo |
echo |
337 |
echo " Error creating temp folder: /root/tmp/clonecd" |
echo " Error creating temp folder: "$SAVE_DIR"/tmp/clonecd" |
338 |
exit 1 |
exit 1 |
339 |
fi |
fi |
340 |
|
|
341 |
|
|
342 |
if [ ! -d /root/tmp/clonezilla-sysresccd ];then |
if [ ! -d "$SAVE_DIR"/tmp/clonezilla-sysresccd ];then |
343 |
echo |
echo |
344 |
echo " Error creating temp folder: /root/tmp/clonezilla-sysresccd" |
echo " Error creating temp folder: "$SAVE_DIR"/tmp/clonezilla-sysresccd" |
345 |
exit 1 |
exit 1 |
346 |
fi |
fi |
347 |
echo 'done' |
echo 'done' |
354 |
} |
} |
355 |
|
|
356 |
function errorISO(){ |
function errorISO(){ |
357 |
echo " Error creating new ISO file: /root/tmp/output.iso" |
echo " Error creating new ISO file: "$SAVE_DIR"/tmp/output.iso" |
358 |
rm /root/tmp/clonezilla-sysresccd-"$outName""$version".iso 2>/dev/null |
rm "$SAVE_DIR"/tmp/clonezilla-sysresccd-"$outName""$version".iso 2>/dev/null |
359 |
cleanUp |
cleanUp |
360 |
exit 1 |
exit 1 |
361 |
} |
} |
363 |
function cleanUp(){ |
function cleanUp(){ |
364 |
echo -n " |
echo -n " |
365 |
Cleaning up... " |
Cleaning up... " |
366 |
umount /root/tmp/clonecd 2>/dev/null |
umount "$SAVE_DIR"/tmp/clonecd 2>/dev/null |
367 |
umount /root/tmp/syscd 2>/dev/null |
umount "$SAVE_DIR"/tmp/syscd 2>/dev/null |
368 |
if [ -z "$cleanUpValue" ];then |
if [ -z "$cleanUpValue" ];then |
369 |
rm -rf /root/tmp/clonezilla-sysresccd 2>/dev/null |
rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd 2>/dev/null |
370 |
fi |
fi |
371 |
rm -rf /root/tmp/clonecd /root/tmp/syscd 2>/dev/null |
rm -rf "$SAVE_DIR"/tmp/clonecd "$SAVE_DIR"/tmp/syscd 2>/dev/null |
372 |
echo 'done' |
echo 'done' |
373 |
echo |
echo |
374 |
exit $exitStatus |
exit $exitStatus |
420 |
f copy files only. Don't create ISO file and don't |
f copy files only. Don't create ISO file and don't |
421 |
burn anything on CD |
burn anything on CD |
422 |
nf don't copy files. Use files existing in folder |
nf don't copy files. Use files existing in folder |
423 |
\"/root/tmp/clonezilla-sysresccd\". |
\""$SAVE_DIR"/tmp/clonezilla-sysresccd\". |
424 |
*** Caution: Dangerous!!! *** |
*** Caution: Dangerous!!! *** |
425 |
i only create ISO file. Don't burn anything on CD |
i only create ISO file. Don't burn anything on CD |
426 |
b burn a previously created ISO file |
b burn a previously created ISO file |
427 |
|
d [folder] Use [folder]/tmp as temporary and output folder |
428 |
|
instead of $HOME/tmp |
429 |
x [script] A user defined and written BASH script |
x [script] A user defined and written BASH script |
430 |
to be executed just before mastering the CD |
to be executed just before mastering the CD |
431 |
|
g [arch] Download ISO files and exit. $(basename $0) |
432 |
|
will download the appropriate ISO files in |
433 |
|
order to succesfully build Clonezilla-SysRescCD. |
434 |
|
[arch] refers to Clonezilla Live architecture |
435 |
|
(i686,i486 or amd64 - use all to get them all) |
436 |
v print version and exit |
v print version and exit |
437 |
h print this screen and exit |
h print this screen and exit |
438 |
|
|
522 |
} |
} |
523 |
|
|
524 |
####### Script starts here ####### |
####### Script starts here ####### |
525 |
|
SAVE_DIR="$HOME" |
526 |
|
|
527 |
|
MKISOFS=genisoimage |
528 |
onlyBurnISO=0 |
onlyBurnISO=0 |
529 |
onlyCopyFiles=0 |
onlyCopyFiles=0 |
530 |
onlyCreateISO=0 |
onlyCreateISO=0 |
535 |
profilesError=0 |
profilesError=0 |
536 |
|
|
537 |
|
|
538 |
while getopts ":asp:bfihvn:x:" Option |
while getopts ":asp:bfihvn:x:d:g:" Option |
539 |
do |
do |
540 |
case $Option in |
case $Option in |
541 |
a) |
a) |
542 |
auto=yes |
auto=yes |
543 |
;; |
;; |
544 |
s) |
s) |
545 |
readConfig |
readConfig |
546 |
sourceProfiles |
sourceProfiles |
571 |
if [ $profilesExist -eq 1 ];then |
if [ $profilesExist -eq 1 ];then |
572 |
if $(isnumber "$OPTARG");then |
if $(isnumber "$OPTARG");then |
573 |
applyProfile $OPTARG |
applyProfile $OPTARG |
574 |
usingProfile=yes |
usingProfile=yes |
575 |
else |
else |
576 |
echo " Error in parameter: -p $OPTARG" |
echo " Error in parameter: -p $OPTARG" |
577 |
exit 1 |
exit 1 |
616 |
fi |
fi |
617 |
noFileCopy=1 |
noFileCopy=1 |
618 |
;; |
;; |
619 |
|
d) |
620 |
|
SAVE_DIR="$OPTARG" |
621 |
|
if [ ! -d "$SAVE_DIR" ]; then |
622 |
|
mkdir "$SAVEDIR" 2>/dev/null |
623 |
|
if [ -d "$SAVE_DIR" ];then |
624 |
|
echo "Error: \"$SAVE_DIR\" cannot be created!!!" |
625 |
|
exit 1 |
626 |
|
fi |
627 |
|
fi |
628 |
|
;; |
629 |
|
g) |
630 |
|
ARCH="$OPTARG" |
631 |
|
if [ "$ARCH" != "i486" ] && [ "$ARCH" != "i686" ] && [ "$ARCH" != "amd64" ] && [ "$ARCH" != "all" ];then |
632 |
|
echo " Error in parameter -g. Should be -g [i668|i486|amd64|all]" |
633 |
|
exit 1 |
634 |
|
fi |
635 |
|
;; |
636 |
esac |
esac |
637 |
done |
done |
638 |
shift $(($OPTIND - 1)) |
shift $(($OPTIND - 1)) |
639 |
|
|
640 |
test "$(whoami)" = "root" || noRoot |
if [ -z "$ARCH" ];then |
641 |
|
test "$(whoami)" = "root" || noRoot |
642 |
|
else |
643 |
|
evalPrograms |
644 |
|
downloadIsoFiles $ARCH |
645 |
|
exit |
646 |
|
fi |
647 |
# chack auto mode |
# chack auto mode |
648 |
if [ -n "$auto" ];then |
if [ -n "$auto" ];then |
649 |
if [ -z "$usingProfile" ];then |
if [ -z "$usingProfile" ];then |
650 |
echo ' Error: Parameter -a used without -p' |
echo ' Error: Parameter -a used without -p' |
651 |
exit 1 |
exit 1 |
652 |
fi |
fi |
653 |
if [ -n "$onlyBurnISO" ];then |
if [ "$onlyBurnISO" -eq 1 ];then |
654 |
echo " Error: Conflicting parameters -a and -b used" |
echo " Error: Conflicting parameters -a and -b used" |
655 |
exit 1 |
exit 1 |
656 |
fi |
fi |
657 |
fi |
fi |
658 |
|
|
659 |
# Check input parameters |
# Check input parameters |
666 |
exit 1 |
exit 1 |
667 |
fi |
fi |
668 |
if [ "$outName" = "" ];then |
if [ "$outName" = "" ];then |
669 |
outFile=/root/tmp/clonezilla-sysresccd-"$version".iso |
outFile="$SAVE_DIR"/tmp/clonezilla-sysresccd-"$version".iso |
670 |
else |
else |
671 |
outFile=/root/tmp/clonezilla-sysresccd-"$outName"-"$version".iso |
outFile="$SAVE_DIR"/tmp/clonezilla-sysresccd-"$outName"-"$version".iso |
672 |
fi |
fi |
673 |
|
|
674 |
if [ $onlyBurnISO -eq 0 ];then |
if [ $onlyBurnISO -eq 0 ];then |
717 |
if [ -n "$auto" ]; then |
if [ -n "$auto" ]; then |
718 |
ans=y |
ans=y |
719 |
else |
else |
720 |
clear |
clear |
721 |
echo -n "Current CD info: |
echo -n "Current CD info: |
722 |
Preparer: $preparerID |
Preparer: $preparerID |
723 |
Publisher: $publisher |
Publisher: $publisher |
740 |
createTempFolders |
createTempFolders |
741 |
|
|
742 |
echo -n "Mounting ISO files... " |
echo -n "Mounting ISO files... " |
743 |
mount "$sysCD" /root/tmp/syscd -o loop || errorMount ' Error mounting "System Rescue CD" file' |
mount "$sysCD" "$SAVE_DIR"/tmp/syscd -o loop || errorMount ' Error mounting "System Rescue CD" file' |
744 |
mount "$cloneCD" /root/tmp/clonecd -o loop || errorMount ' Error mounting Clonezilla" file' |
mount "$cloneCD" "$SAVE_DIR"/tmp/clonecd -o loop || errorMount ' Error mounting Clonezilla" file' |
745 |
echo 'done' |
echo 'done' |
746 |
echo -n "Copying files... " |
echo -n "Copying files... " |
747 |
cp -RL /root/tmp/syscd/* /root/tmp/clonezilla-sysresccd |
cp -RL "$SAVE_DIR"/tmp/syscd/* "$SAVE_DIR"/tmp/clonezilla-sysresccd |
748 |
cp -RL /root/tmp/clonecd/* /root/tmp/clonezilla-sysresccd |
cp -RL "$SAVE_DIR"/tmp/clonecd/* "$SAVE_DIR"/tmp/clonezilla-sysresccd |
749 |
echo 'done' |
echo 'done' |
750 |
|
|
751 |
|
|
752 |
# echo -n "Extracting boot programs... " |
# echo -n "Extracting boot programs... " |
753 |
echo "Extracting boot programs... " |
echo "Extracting boot programs... " |
754 |
cd /root/tmp/clonezilla-sysresccd/bootprog |
cd "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootprog |
755 |
mkdir tmp |
mkdir tmp |
756 |
cp *zip tmp |
cp *zip tmp |
757 |
unzip -x sys*zip win32/syslinux.exe |
unzip -x sys*zip win32/syslinux.exe |
766 |
|
|
767 |
if [ ! -z "$splash" ];then |
if [ ! -z "$splash" ];then |
768 |
echo -n "Copying new spalsh screen... " |
echo -n "Copying new spalsh screen... " |
769 |
cp -L "$splash" /root/tmp/clonezilla-sysresccd/isolinux/ocswp.png |
cp -L "$splash" "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/ocswp.png |
770 |
echo 'done' |
echo 'done' |
771 |
else |
else |
772 |
cp -L /root/.clonezilla-sysresccd/files/default-ocswp.png /root/tmp/clonezilla-sysresccd/isolinux/ocswp.png |
cp -L /root/.clonezilla-sysresccd/files/default-ocswp.png "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/ocswp.png |
773 |
fi |
fi |
774 |
|
|
775 |
echo -n "Copying Super Grub Disk... " |
echo -n "Copying Super Grub Disk... " |
776 |
cp -L /root/.clonezilla-sysresccd/files/sgd.img /root/tmp/clonezilla-sysresccd/bootdisk/sgd.img && echo 'done' || { |
cp -L /root/.clonezilla-sysresccd/files/sgd.img "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/sgd.img && echo 'done' || { |
777 |
echo |
echo |
778 |
echo |
echo |
779 |
echo |
echo |
780 |
echo " Error: Copying Super Grub Disk failed!!!" |
echo " Error: Copying Super Grub Disk failed!!!" |
781 |
echo |
echo |
782 |
echo " Please make sure that the image file exists" |
echo " Please make sure that the image file exists" |
783 |
echo " Image file: /root/tmp/clonezilla-sysresccd/bootdisk/sgd.img" |
echo " Image file: "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/sgd.img" |
784 |
echo |
echo |
785 |
echo |
echo |
786 |
cleanUp |
cleanUp |
788 |
} |
} |
789 |
if [ -e /root/.clonezilla-sysresccd/files/sgd2.img ];then |
if [ -e /root/.clonezilla-sysresccd/files/sgd2.img ];then |
790 |
echo -n "Copying Super Grub Disk 2... " |
echo -n "Copying Super Grub Disk 2... " |
791 |
cp -L /root/.clonezilla-sysresccd/files/sgd2.img /root/tmp/clonezilla-sysresccd/bootdisk/grubdisk.img && echo 'done' || { |
cp -L /root/.clonezilla-sysresccd/files/sgd2.img "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/grubdisk.img && echo 'done' || { |
792 |
echo |
echo |
793 |
echo |
echo |
794 |
echo |
echo |
795 |
echo " Error: Copying Super Grub Disk 2 failed!!!" |
echo " Error: Copying Super Grub Disk 2 failed!!!" |
796 |
echo |
echo |
797 |
echo " Please make sure that the image file exists" |
echo " Please make sure that the image file exists" |
798 |
echo " Image file: /root/tmp/clonezilla-sysresccd/bootdisk/sgd2.img" |
echo " Image file: "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/sgd2.img" |
799 |
echo |
echo |
800 |
echo |
echo |
801 |
cleanUp |
cleanUp |
804 |
fi |
fi |
805 |
echo -n "Copying new cfg file(s)... " |
echo -n "Copying new cfg file(s)... " |
806 |
if [ -z $(echo "$cfgFile" | grep 'cfg$') ];then |
if [ -z $(echo "$cfgFile" | grep 'cfg$') ];then |
807 |
tar -C /root/tmp/clonezilla-sysresccd -xzhf /root/.clonezilla-sysresccd/files/menu-iso.tar.gz |
tar -C "$SAVE_DIR"/tmp/clonezilla-sysresccd -xzhf /root/.clonezilla-sysresccd/files/menu-for-iso.tar.gz |
808 |
else |
else |
809 |
cp -L "$cfgFile" /root/tmp/clonezilla-sysresccd/isolinux/isolinux.cfg |
cp -L "$cfgFile" "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/isolinux.cfg |
810 |
fi |
fi |
811 |
echo 'done' |
echo 'done' |
812 |
|
|
813 |
echo -n "Creating folder restorecd... " |
echo -n "Creating folder restorecd... " |
814 |
WHERE="$(pwd)" |
WHERE="$(pwd)" |
815 |
mkdir /root/tmp/clonezilla-sysresccd/restorecd 2>/dev/null |
mkdir "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd 2>/dev/null |
816 |
cd /root/.clonezilla-sysresccd/files |
cd /root/.clonezilla-sysresccd/files |
817 |
cp -L pre* ocs-iso what-cd continue-multi-cd isolinux-restore-cd.cfg \ |
cp -L pre* ocs-iso what-cd patch-clonezilla-sysresccd continue-multi-cd isolinux-restore-cd.cfg \ |
818 |
isolinux-restore-cd-ram.cfg menu-iso.tar.gz doc.tar.gz imginfo imgconvert cust-menu /root/tmp/clonezilla-sysresccd/restorecd |
isolinux-restore-cd-ram.cfg menu-for-iso.tar.gz doc.tar.gz imginfo imgconvert cust-menu "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd |
819 |
cp -L default-restore-ocswp.png /root/tmp/clonezilla-sysresccd/restorecd/ocswp.png |
cp -L default-restore-ocswp.png "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/ocswp.png |
820 |
cp sbminst /root/tmp/clonezilla-sysresccd/restorecd |
cp sbminst "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd |
821 |
|
|
822 |
# Copy Smart Boot Manager and rawrite-fdimage to bootdisk |
# Copy Smart Boot Manager and rawrite-fdimage to bootdisk |
823 |
mkdir /root/tmp/clonezilla-sysresccd/rawrite |
mkdir "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite |
824 |
cp raw* fd* *dll /root/tmp/clonezilla-sysresccd/rawrite |
cp raw* fd* *dll "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite |
825 |
cp sbm.img /root/tmp/clonezilla-sysresccd/bootdisk |
cp sbm.img "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk |
826 |
cd "$DebianLiveFolder" 2>/dev/null || debFilesError=yes |
cd "$DebianLiveFolder" 2>/dev/null || debFilesError=yes |
827 |
# if [ -s files.tar.gz ];then |
# if [ -s files.tar.gz ];then |
828 |
# cp -L files.tar.gz /root/tmp/clonezilla-sysresccd/restorecd/ 2>/dev/null || debFilesError=yes |
# cp -L files.tar.gz "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/ 2>/dev/null || debFilesError=yes |
829 |
# else |
# else |
830 |
# [ -e "$DebianLiveFolder"/unifont.bgf ] || { |
# [ -e "$DebianLiveFolder"/unifont.bgf ] || { |
831 |
# uniFontCopied=yes |
# uniFontCopied=yes |
832 |
# cp -L /root/.clonezilla-sysresccd/files/unifont.bgf "$DebianLiveFolder" |
# cp -L /root/.clonezilla-sysresccd/files/unifont.bgf "$DebianLiveFolder" |
833 |
# } |
# } |
834 |
# tar chzf /root/tmp/clonezilla-sysresccd/restorecd/files.tar.gz unifont.bgf debian-live-for-ocs.iso 2>/dev/null || debFilesError=yes |
# tar chzf "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/files.tar.gz unifont.bgf debian-live-for-ocs.iso 2>/dev/null || debFilesError=yes |
835 |
# [ -z "$uniFontCopied" ] || rm "$DebianLiveFolder"/unifont.bgf |
# [ -z "$uniFontCopied" ] || rm "$DebianLiveFolder"/unifont.bgf |
836 |
# fi |
# fi |
837 |
# [ -z "$debFilesError" ] || { |
# [ -z "$debFilesError" ] || { |
854 |
echo "done" |
echo "done" |
855 |
|
|
856 |
echo -n "Copying documentation files... " |
echo -n "Copying documentation files... " |
857 |
cd /root/tmp/clonezilla-sysresccd |
cd "$SAVE_DIR"/tmp/clonezilla-sysresccd |
858 |
tar xzhf /root/tmp/clonezilla-sysresccd/restorecd/doc.tar.gz |
tar xzhf "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/doc.tar.gz |
859 |
echo 'done' |
echo 'done' |
860 |
|
|
861 |
if [ ! -z "$exScript" ];then |
if [ ! -z "$exScript" ];then |
880 |
else |
else |
881 |
trap cleanUp 2 |
trap cleanUp 2 |
882 |
cleanUpValue=1 |
cleanUpValue=1 |
883 |
if [ ! -d /root/tmp/clonezilla-sysresccd ];then |
if [ ! -d "$SAVE_DIR"/tmp/clonezilla-sysresccd ];then |
884 |
echo " Error accessing folder \"/root/tmp/clonezilla-sysresccd\"" |
echo " Error accessing folder \""$SAVE_DIR"/tmp/clonezilla-sysresccd\"" |
885 |
exitStatus=1 |
exitStatus=1 |
886 |
cleanUp |
cleanUp |
887 |
fi |
fi |
888 |
fi |
fi |
889 |
|
|
890 |
# move extra folders into utils |
# move extra folders into utils |
891 |
mv /root/tmp/clonezilla-sysresccd/rawrite /root/tmp/clonezilla-sysresccd/bootprog /root/tmp/clonezilla-sysresccd/utils |
mv "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootprog "$SAVE_DIR"/tmp/clonezilla-sysresccd/utils |
892 |
mv /root/tmp/clonezilla-sysresccd/version /root/tmp/clonezilla-sysresccd/SystemRescueCD-Version |
mv "$SAVE_DIR"/tmp/clonezilla-sysresccd/version "$SAVE_DIR"/tmp/clonezilla-sysresccd/SystemRescueCD-Version |
893 |
|
|
894 |
|
# |
895 |
|
# re-build clonezilla filesystem.squashfs |
896 |
|
# |
897 |
|
echo -n "Rebuilding Clonezilla squashfs... " |
898 |
|
cd "$SAVE_DIR"/tmp/clonezilla-sysresccd/live |
899 |
|
unsquashfs filesystem.squashfs 2>/dev/null 1>&2 |
900 |
|
cp -r ../README* ../doc ../restorecd squashfs-root |
901 |
|
mksquashfs squashfs-root aa.squashfs -always-use-fragments -no-duplicates -all-root 2>/dev/null 1>&2 |
902 |
|
mv aa.squashfs filesystem.squashfs |
903 |
|
rm -rf squashfs-root |
904 |
|
cd |
905 |
|
echo 'done' |
906 |
|
|
907 |
if [ $onlyCopyFiles -eq 1 ];then |
if [ $onlyCopyFiles -eq 1 ];then |
908 |
cleanUpValue=1 |
cleanUpValue=1 |
909 |
# echo |
# echo |
910 |
# echo |
# echo |
911 |
echo "Both CDs have been copyied in: /root/tmp/clonezilla-sysresccd" |
echo "Both CDs have been copyied in: "$SAVE_DIR"/tmp/clonezilla-sysresccd" |
912 |
cleanUp |
cleanUp |
913 |
fi |
fi |
914 |
echo |
echo |
918 |
************************************************************************ |
************************************************************************ |
919 |
Ready to master your CD. If you want to alter any files contained |
Ready to master your CD. If you want to alter any files contained |
920 |
in the CD, now is the right time. |
in the CD, now is the right time. |
921 |
CD root is \"/root/tmp/clonezilla-sysresccd\" |
CD root is \""$SAVE_DIR"/tmp/clonezilla-sysresccd\" |
922 |
|
|
923 |
When you are done |
When you are done |
924 |
*********************************************************************** |
*********************************************************************** |
928 |
else |
else |
929 |
echo "Creating new ISO file." |
echo "Creating new ISO file." |
930 |
fi |
fi |
931 |
find /root/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';' |
find "$SAVE_DIR"/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';' |
932 |
# 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 |
# $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 |
933 |
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 |
$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 |
934 |
echo " |
echo " |
935 |
Done creating new ISO file |
Done creating new ISO file |
936 |
The file is saved as $outFile" |
The file is saved as $outFile" |