61 |
if [ "$1" = "all" ] || [ -z "$1" ];then |
if [ "$1" = "all" ] || [ -z "$1" ];then |
62 |
# Download all files |
# Download all files |
63 |
for clonType in i686 i486 amd64;do |
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" |
if [ "$clonType" = "i686" ];then |
65 |
|
clonType="$clonType"-pae |
66 |
|
fi |
67 |
|
clonIso="http://downloads.sourceforge.net/project/clonezilla/clonezilla_live_stable/OldFiles/"$clonVersion"/clonezilla-live-"$clonVersion"-"$clonType".iso?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fclonezilla%2Ffiles%2Fclonezilla_live_stable%2FOldFiles%2F"$clonVersion"%2F" |
68 |
downloadClonezillaLive |
downloadClonezillaLive |
69 |
done |
done |
70 |
else |
else |
71 |
clonType="$1" |
clonType="$1" |
72 |
clonIso="http://sourceforge.net/projects/clonezilla/files/clonezilla_live_stable/OldFiles/"$clonVersion"/clonezilla-live-"$clonVersion"-"$clonType".iso/download" |
if [ "$clonType" = "i686" ];then |
73 |
|
clonType="$clonType"-pae |
74 |
|
fi |
75 |
|
clonIso="http://downloads.sourceforge.net/project/clonezilla/clonezilla_live_stable/OldFiles/"$clonVersion"/clonezilla-live-"$clonVersion"-"$clonType".iso?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fclonezilla%2Ffiles%2Fclonezilla_live_stable%2FOldFiles%2F"$clonVersion"%2F" |
76 |
downloadClonezillaLive |
downloadClonezillaLive |
77 |
fi |
fi |
78 |
|
|
83 |
if [ -e systemrescuecd-x86-"$sysVersion".iso ];then |
if [ -e systemrescuecd-x86-"$sysVersion".iso ];then |
84 |
if [ -n "$md5sumFound" ];then |
if [ -n "$md5sumFound" ];then |
85 |
echo "$sysmd5 systemrescuecd-x86-"$sysVersion".iso" > test.md5sum |
echo "$sysmd5 systemrescuecd-x86-"$sysVersion".iso" > test.md5sum |
86 |
echo -n "File found. Checking integrity of " |
echo -n "File found. |
87 |
|
Checking integrity of " |
88 |
md5sum -c test.md5sum 2>/dev/null |
md5sum -c test.md5sum 2>/dev/null |
89 |
if [ "$?" -eq 0 ];then |
if [ "$?" -eq 0 ];then |
90 |
rm -f test.md5sum 2>/dev/null |
rm -f test.md5sum 2>/dev/null |
91 |
return |
return |
92 |
else |
else |
93 |
echo "File systemrescuecd-x86-"$sysVersion".iso already exists" |
echo "File systemrescuecd-x86-"$sysVersion".iso already exists" |
94 |
echo "You can continue downloading the file or restart it" |
echo " You can continue downloading the file or restart it" |
95 |
echo -n "Continue downloading? (y/[n]): " |
echo -n " Continue downloading? (y/[n]): " |
96 |
read ans |
read ans |
97 |
if [ "$ans" = "y" ];then |
curlContinue="" |
98 |
|
if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then |
99 |
curlContinue=1 |
curlContinue=1 |
100 |
else |
else |
101 |
rm -f test.md5sum 2>/dev/null |
rm -f test.md5sum 2>/dev/null |
103 |
fi |
fi |
104 |
else |
else |
105 |
echo "File systemrescuecd-x86-"$sysVersion".iso already exists" |
echo "File systemrescuecd-x86-"$sysVersion".iso already exists" |
106 |
echo "You can continue downloading the file or restart it" |
echo " You can continue downloading the file or restart it" |
107 |
echo "If you do continue downloading, and since md5sum was not found," |
echo " If you do continue downloading, and since md5sum was not found," |
108 |
echo "make sure you check the file's integrity manually, after the" |
echo " make sure you check the file's integrity manually, after the" |
109 |
echo "download is complete" |
echo " download is complete" |
110 |
echo -n "Continue downloading? (y/[n]): " |
echo -n " Continue downloading? (y/[n]): " |
111 |
|
curlContinue="" |
112 |
read ans |
read ans |
113 |
if [ "$ans" = "y" ];then |
if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then |
114 |
curlContinue=1 |
curlContinue=1 |
115 |
fi |
fi |
116 |
fi |
fi |
129 |
echo "Integrity check on systemrescuecd-x86-"$sysVersion".iso failed!!!" |
echo "Integrity check on systemrescuecd-x86-"$sysVersion".iso failed!!!" |
130 |
echo -n "Do you want to delete this file? ([y]/n): " |
echo -n "Do you want to delete this file? ([y]/n): " |
131 |
read ans |
read ans |
132 |
if [ "$ans" != "n" ];then |
if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then |
133 |
rm -f systemrescuecd-x86-"$sysVersion".iso 2>/dev/null && echo "File deleted..." || echo "****** Error deleting file!!! ****** |
rm -f systemrescuecd-x86-"$sysVersion".iso 2>/dev/null && echo "File deleted..." || echo "****** Error deleting file!!! ****** |
134 |
Please delete systemrescuecd-x86-"$sysVersion".iso manually" |
Please delete systemrescuecd-x86-"$sysVersion".iso manually" |
135 |
fi |
fi |
152 |
echo "$i686md5 clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum |
echo "$i686md5 clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum |
153 |
fi |
fi |
154 |
unset checkmd5 |
unset checkmd5 |
155 |
echo -n "File found. Checking integrity of " |
echo -n "File found. |
156 |
|
Checking integrity of " |
157 |
md5sum -c test.md5sum 2>/dev/null && checkmd5=1 |
md5sum -c test.md5sum 2>/dev/null && checkmd5=1 |
158 |
|
|
159 |
if [ -z "$checkmd5" ];then |
if [ -z "$checkmd5" ];then |
160 |
# md5 check failed |
# md5 check failed |
161 |
unset checkmd5 |
unset checkmd5 |
162 |
echo "File clonezilla-live-"$clonVersion"-"$clonType".iso already exists" |
echo "File clonezilla-live-"$clonVersion"-"$clonType".iso already exists" |
163 |
echo "You can continue downloading the file or restart it" |
echo " You can continue downloading the file or restart it" |
164 |
echo -n "Continue downloading? (y/[n]): " |
echo -n " Continue downloading? (y/[n]): " |
165 |
read ans |
read ans |
166 |
if [ "$ans" = "y" ];then |
if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then |
167 |
curlContinue=1 |
curlContinue=1 |
168 |
else |
else |
169 |
rm -f test.md5sum 2>/dev/null |
rm -f test.md5sum 2>/dev/null |
176 |
else |
else |
177 |
# no md5sum |
# no md5sum |
178 |
echo "File clonezilla-live-"$clonVersion"-"$clonType".iso already exists" |
echo "File clonezilla-live-"$clonVersion"-"$clonType".iso already exists" |
179 |
echo "You can continue downloading the file or restart it" |
echo " You can continue downloading the file or restart it" |
180 |
echo "If you do continue downloading, and since md5sum was not found," |
echo " If you do continue downloading, and since md5sum was not found," |
181 |
echo "make sure you check the file's integrity manually, after the" |
echo " make sure you check the file's integrity manually, after the" |
182 |
echo "download is complete" |
echo " download is complete" |
183 |
echo -n "Continue downloading? (y/[n]): " |
echo -n " Continue downloading? (y/[n]): " |
184 |
read ans |
read ans |
185 |
if [ "$ans" = "y" ];then |
if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then |
186 |
curlContinue=1 |
curlContinue=1 |
187 |
fi |
fi |
188 |
fi |
fi |
190 |
|
|
191 |
# Check if we have to go to OldFiles |
# Check if we have to go to OldFiles |
192 |
echo "Checking file availability..." |
echo "Checking file availability..." |
193 |
oldFiles="$(curl -IL "$clonIso" | grep '301 Moved Permanently')" |
oldFiles="$(curl -IL "$clonIso" | grep 'Location: http://')" |
194 |
if [ -n "$oldFiles" ];then |
if [ -z "$oldFiles" ];then |
195 |
# go to stable |
# go to stable |
196 |
clonIso="$(echo "$clonIso" | sed 's{OldFiles/{{')" |
clonIso="$(echo "$clonIso" | sed 's{OldFiles/{{' | sed 's{OldFiles%2F{{')" |
197 |
echo "This is Clonezilla Live Stable!!!" |
echo ">>>>>> This is Clonezilla Live Stable!!!" |
198 |
else |
else |
199 |
echo "This is an older Clonezilla Live version!!!" |
echo ">>>>>> This is an older Clonezilla Live version!!!" |
200 |
fi |
fi |
201 |
|
|
202 |
# Download file |
# Download file |
222 |
echo "Integrity check on clonezilla-live-"$clonVersion"-"$clonType".iso failed!!!" |
echo "Integrity check on clonezilla-live-"$clonVersion"-"$clonType".iso failed!!!" |
223 |
echo -n "Do you want to delete this file? ([y]/n): " |
echo -n "Do you want to delete this file? ([y]/n): " |
224 |
read ans |
read ans |
225 |
if [ "$ans" != "n" ];then |
if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then |
226 |
rm -f clonezilla-live-"$clonVersion"-"$clonType".iso 2>/dev/null && echo "File deleted..." || echo "****** Error deleting file!!! ****** |
rm -f clonezilla-live-"$clonVersion"-"$clonType".iso 2>/dev/null && echo "File deleted..." || echo "****** Error deleting file!!! ****** |
227 |
Please delete clonezilla-live-"$clonVersion"-"$clonType".iso manually" |
Please delete clonezilla-live-"$clonVersion"-"$clonType".iso manually" |
228 |
fi |
fi |
584 |
if $(isnumber "$OPTARG");then |
if $(isnumber "$OPTARG");then |
585 |
applyProfile $OPTARG |
applyProfile $OPTARG |
586 |
usingProfile=yes |
usingProfile=yes |
587 |
|
currentProfile=$OPTARG |
588 |
else |
else |
589 |
echo " Error in parameter: -p $OPTARG" |
echo " Error in parameter: -p $OPTARG" |
590 |
exit 1 |
exit 1 |
657 |
downloadIsoFiles $ARCH |
downloadIsoFiles $ARCH |
658 |
exit |
exit |
659 |
fi |
fi |
660 |
# chack auto mode |
# check auto mode |
661 |
if [ -n "$auto" ];then |
if [ -n "$auto" ];then |
662 |
if [ -z "$usingProfile" ];then |
if [ -z "$usingProfile" ];then |
663 |
echo ' Error: Parameter -a used without -p' |
echo ' Error: Parameter -a used without -p' |
702 |
# |
# |
703 |
# Is this correct? (y/[n]): " |
# Is this correct? (y/[n]): " |
704 |
|
|
705 |
if [ -n "$auto" ]; then |
if [ -n "$auto" ]; then |
706 |
ans=y |
ans=y |
707 |
else |
else |
708 |
echo -n "Current settings: |
echo -n "Current settings: |
709 |
System Rescue CD: $sysCD |
System Rescue CD: $sysCD |
710 |
Clonezilla Live CD: $cloneCD |
Clonezilla Live CD: $cloneCD |
711 |
isolinux.cfg to use: $cfgFile |
isolinux.cfg to use: $cfgFile |
712 |
script to execute: $exScript |
script to execute: $exScript |
713 |
|
|
714 |
Is this correct? (y/[n]): " |
Is this correct? (y/[n]): " |
715 |
|
|
716 |
read ans |
read ans |
717 |
fi |
fi |
718 |
if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then |
if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then |
719 |
sysCD='' |
sysCD='' |
720 |
cloneCD='' |
cloneCD='' |
750 |
clear |
clear |
751 |
echo "$(basename $0) - v $version - Spiros Georgaras <sng@hellug.gr> |
echo "$(basename $0) - v $version - Spiros Georgaras <sng@hellug.gr> |
752 |
" |
" |
753 |
|
|
754 |
|
if [ -n "$currentProfile" ];then |
755 |
|
echo "Running profile: $currentProfile ($outName)" |
756 |
|
fi |
757 |
|
|
758 |
createTempFolders |
createTempFolders |
759 |
|
|
760 |
echo -n "Mounting ISO files... " |
echo -n "Mounting ISO files... " |
761 |
mount "$sysCD" "$SAVE_DIR"/tmp/syscd -o loop || errorMount ' Error mounting "System Rescue CD" file' |
mount "$sysCD" "$SAVE_DIR"/tmp/syscd -o ro,loop || errorMount ' Error mounting "System Rescue CD" file' |
762 |
mount "$cloneCD" "$SAVE_DIR"/tmp/clonecd -o loop || errorMount ' Error mounting Clonezilla" file' |
mount "$cloneCD" "$SAVE_DIR"/tmp/clonecd -o ro,loop || errorMount ' Error mounting Clonezilla" file' |
763 |
echo 'done' |
echo 'done' |
764 |
echo -n "Copying files... " |
echo -n "Copying files... " |
765 |
cp -RL "$SAVE_DIR"/tmp/syscd/* "$SAVE_DIR"/tmp/clonezilla-sysresccd |
cp -RL "$SAVE_DIR"/tmp/syscd/* "$SAVE_DIR"/tmp/clonezilla-sysresccd |
783 |
# echo 'done' |
# echo 'done' |
784 |
|
|
785 |
if [ ! -z "$splash" ];then |
if [ ! -z "$splash" ];then |
786 |
echo -n "Copying new spalsh screen... " |
echo -n "Copying new spalsh screen... " |
787 |
cp -L "$splash" "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/ocswp.png |
cp -L "$splash" "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/ocswp.png |
788 |
echo 'done' |
echo 'done' |
789 |
else |
else |
790 |
cp -L /root/.clonezilla-sysresccd/files/default-ocswp.png "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/ocswp.png |
cp -L /root/.clonezilla-sysresccd/files/default-ocswp.png "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/ocswp.png |
791 |
fi |
fi |
792 |
|
|
793 |
echo -n "Copying Super Grub Disk... " |
echo -n "Copying Super Grub Disk... " |
834 |
cd /root/.clonezilla-sysresccd/files |
cd /root/.clonezilla-sysresccd/files |
835 |
cp -L pre* ocs-iso what-cd patch-clonezilla-sysresccd continue-multi-cd isolinux-restore-cd.cfg \ |
cp -L pre* ocs-iso what-cd patch-clonezilla-sysresccd continue-multi-cd isolinux-restore-cd.cfg \ |
836 |
isolinux-restore-cd-ram.cfg menu-for-iso.tar.gz doc.tar.gz imginfo imgconvert cust-menu "$SAVE_DIR"/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 |
837 |
cp -L default-restore-ocswp.png "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/ocswp.png |
fsplash=`basename "$splash"` |
838 |
|
if [ "$fsplash" = "default-ocswp-i686.png" ] || [ "$fsplash" = "default-ocswp-i486.png" ] || [ "$fsplash" = "default-ocswp-amd64.png" ];then |
839 |
|
cp $(echo "$splash" | sed 's/default/default-restore/') "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/ocswp.png |
840 |
|
else |
841 |
|
cp -L default-restore-ocswp.png "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/ocswp.png |
842 |
|
fi |
843 |
cp sbminst "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd |
cp sbminst "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd |
844 |
|
|
845 |
# Copy Smart Boot Manager and rawrite-fdimage to bootdisk |
# Copy Smart Boot Manager and rawrite-fdimage to bootdisk |
883 |
|
|
884 |
if [ ! -z "$exScript" ];then |
if [ ! -z "$exScript" ];then |
885 |
# echo -n "Executing external script: \"$exScript\"... " |
# echo -n "Executing external script: \"$exScript\"... " |
886 |
echo -n "Executing external script... " |
echo -n "Executing external script... " |
887 |
. "$exScript" || { |
. "$exScript" || { |
888 |
echo |
echo |
889 |
echo |
echo |
890 |
echo |
echo |
891 |
echo " Error: The execution of the script failed!!!" |
echo " Error: The execution of the script failed!!!" |
892 |
echo " Please correct it and try again" |
echo " Please correct it and try again" |
893 |
echo |
echo |
894 |
echo " Script: \"$exScript\"" |
echo " Script: \"$exScript\"" |
895 |
cleanUp |
cleanUp |
896 |
exit 1 |
exit 1 |
897 |
} |
} |
898 |
echo 'done' |
echo 'done' |
899 |
fi |
fi |
900 |
# echo |
# echo |
901 |
# echo |
# echo |
902 |
# echo |
# echo |
903 |
else |
else |
904 |
trap cleanUp 2 |
trap cleanUp 2 |
905 |
cleanUpValue=1 |
cleanUpValue=1 |
906 |
if [ ! -d "$SAVE_DIR"/tmp/clonezilla-sysresccd ];then |
if [ ! -d "$SAVE_DIR"/tmp/clonezilla-sysresccd ];then |
907 |
echo " Error accessing folder \""$SAVE_DIR"/tmp/clonezilla-sysresccd\"" |
echo " Error accessing folder \""$SAVE_DIR"/tmp/clonezilla-sysresccd\"" |
908 |
exitStatus=1 |
exitStatus=1 |
909 |
cleanUp |
cleanUp |
910 |
|
fi |
911 |
fi |
fi |
|
fi |
|
912 |
|
|
913 |
# move extra folders into utils |
# move extra folders into utils |
914 |
mv "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootprog "$SAVE_DIR"/tmp/clonezilla-sysresccd/utils |
mv "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootprog "$SAVE_DIR"/tmp/clonezilla-sysresccd/utils |
915 |
mv "$SAVE_DIR"/tmp/clonezilla-sysresccd/version "$SAVE_DIR"/tmp/clonezilla-sysresccd/SystemRescueCD-Version |
mv "$SAVE_DIR"/tmp/clonezilla-sysresccd/version "$SAVE_DIR"/tmp/clonezilla-sysresccd/SystemRescueCD-Version |
916 |
|
|
917 |
|
# copy png files from isolinux/ to syslinux/ |
918 |
|
cp "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/*.png "$SAVE_DIR"/tmp/clonezilla-sysresccd/syslinux |
919 |
# |
# |
920 |
# re-build clonezilla filesystem.squashfs |
# re-build clonezilla filesystem.squashfs |
921 |
# |
# |
990 |
ans=n |
ans=n |
991 |
else |
else |
992 |
echo -n "Do you want to burn this ISO file? ([y]/n): " |
echo -n "Do you want to burn this ISO file? ([y]/n): " |
993 |
read ans |
read ans |
994 |
fi |
fi |
995 |
done |
done |
996 |
burnISO=0 |
burnISO=0 |