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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 64 by sng, Fri May 28 09:47:17 2010 UTC revision 176 by sng, Tue May 31 19:45:21 2011 UTC
# Line 1  Line 1 
1  ##############################################################################  ##############################################################################
2  #                                                                            #  #                                                                            #
3  # create-clonezilla-sysresccd, (C) 2007-2010 S. Georgaras <sng@hellug.gr>    #  # create-clonezilla-sysresccd, (C) 2007-2011 S. Georgaras <sng@hellug.gr>    #
4  #                                                                            #  #                                                                            #
5  # This file is part of Clonezilla-SysRescCD.                                 #  # This file is part of Clonezilla-SysRescCD.                                 #
6  #                                                                            #  #                                                                            #
# Line 18  Line 18 
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" ] || [ "$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" ] || [ "$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    if [ -n "$md5sumFound" ];then
116      echo "$sysmd5  systemrescuecd-x86-"$sysVersion".iso" > test.md5sum
117      echo -n "Checking integrity of "
118      md5sum -c test.md5sum 2>/dev/null
119      if [ "$?" -eq 1 ];then
120        echo "Integrity check on systemrescuecd-x86-"$sysVersion".iso failed!!!"
121        echo -n "Do you want to delete this file? ([y]/n): "
122        read ans
123        if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
124          rm -f systemrescuecd-x86-"$sysVersion".iso 2>/dev/null && echo "File deleted..." || echo "******  Error deleting file!!!  ******
125      Please delete systemrescuecd-x86-"$sysVersion".iso manually"
126        fi
127      fi
128      rm -f test.md5sum 2>/dev/null
129    fi
130    }
131    
132    function downloadClonezillaLive(){
133    echo "
134    ******  Downloading Clonezilla Live "$clonVersion" "$clonType"  ******"
135    unset curlContinue
136    if [ -e clonezilla-live-"$clonVersion"-"$clonType".iso ];then
137      if [ -n "$md5sumFound" ];then
138        if [ "$clonType" = "amd64" ];then
139          echo "$amd64md5  clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum
140        elif [ "$clonType" = "i486" ];then
141          echo "$i486md5  clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum
142        else
143          echo "$i686md5  clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum
144        fi
145        unset checkmd5
146        echo -n "File found. Checking integrity of "
147        md5sum -c test.md5sum 2>/dev/null && checkmd5=1
148      
149        if [ -z "$checkmd5" ];then
150          # md5 check failed
151          unset checkmd5
152          echo "File clonezilla-live-"$clonVersion"-"$clonType".iso already exists"
153          echo "You can continue downloading the file or restart it"
154          echo -n "Continue downloading? (y/[n]): "
155          read ans
156          if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
157            curlContinue=1
158          else
159            rm -f test.md5sum 2>/dev/null
160            return
161          fi
162        else
163          # file is ok
164          return
165        fi
166      else
167        # no md5sum
168        echo "File clonezilla-live-"$clonVersion"-"$clonType".iso already exists"
169        echo "You can continue downloading the file or restart it"
170        echo "If you do continue downloading, and since md5sum was not found,"
171        echo "make sure you check the file's integrity manually, after the"
172        echo "download is complete"
173        echo -n "Continue downloading? (y/[n]): "
174        read ans
175        if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
176          curlContinue=1
177        fi
178      fi
179    fi
180    
181    # Check if we have to go to OldFiles
182    echo "Checking file availability..."
183    oldFiles="$(curl -IL "$clonIso" | grep '301 Moved Permanently')"
184    if [ -n "$oldFiles" ];then
185      # go to stable
186      clonIso="$(echo "$clonIso" | sed 's{OldFiles/{{')"
187      echo "This is Clonezilla Live Stable!!!"
188    else
189      echo "This is an older Clonezilla Live version!!!"
190    fi
191    
192    # Download file
193    if [ -z "$curlContinue" ];then
194      curl -L "$clonIso" -o clonezilla-live-"$clonVersion"-"$clonType".iso
195    else
196      curl -L -C - "$clonIso" -o clonezilla-live-"$clonVersion"-"$clonType".iso
197    fi  
198    
199    if [ -n "$md5sumFound" ];then
200      if [ "$clonType" = "amd64" ];then
201        echo "$amd64md5  clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum
202      elif [ "$clonType" = "i486" ];then
203        echo "$i486md5  clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum
204      else
205        echo "$i686md5  clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum
206      fi
207      unset checkmd5
208      echo -n "Checking integrity of "
209      md5sum -c test.md5sum 2>/dev/null && checkmd5=1
210      rm -f test.md5sum 2>/dev/null
211      if [ -z "$checkmd5" ];then
212        echo "Integrity check on clonezilla-live-"$clonVersion"-"$clonType".iso failed!!!"
213        echo -n "Do you want to delete this file? ([y]/n): "
214        read ans
215        if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
216          rm -f clonezilla-live-"$clonVersion"-"$clonType".iso 2>/dev/null && echo "File deleted..." || echo "******  Error deleting file!!!  ******
217    Please delete clonezilla-live-"$clonVersion"-"$clonType".iso manually"
218        fi
219      fi
220    fi
221    
222    
223    }
224    
225  function noRoot(){  function noRoot(){
226  echo "    Error: You must be root to execute this script"  echo "    Error: You must be root to execute this script"
227  exit 1  exit 1
# Line 109  done Line 313  done
313    
314    
315  function createTempFolders(){  function createTempFolders(){
316  echo -n "Creating /root/tmp folder...   "  echo -n "Creating "$SAVE_DIR"/tmp folder...   "
317  mkdir /root/tmp 2>/dev/null  mkdir "$SAVE_DIR"/tmp 2>/dev/null
318  if [ ! -d /root/tmp ];then  if [ ! -d "$SAVE_DIR"/tmp ];then
319   echo   echo
320   echo "    Error creating folder: /root/tmp"   echo "    Error creating folder: "$SAVE_DIR"/tmp"
321   echo "          This shouldn't be happening..."   echo "          This shouldn't be happening..."
322   exit 1   exit 1
323  fi  fi
324  echo 'done'  echo 'done'
325    
326  echo -n "Creating temp folders...   "  echo -n "Creating temp folders...   "
327  rm -rf /root/tmp/clonezilla-sysresccd-"$version".iso 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd-"$version".iso 2>/dev/null
328  rm -rf /root/tmp/syscd 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/syscd 2>/dev/null
329  rm -rf /root/tmp/clonecd 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/clonecd 2>/dev/null
330  rm -rf /root/tmp/clonezilla-sysresccd 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd 2>/dev/null
331  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
332  if [ ! -d /root/tmp/syscd ];then  if [ ! -d "$SAVE_DIR"/tmp/syscd ];then
333   echo   echo
334   echo "    Error creating temp folder: /root/tmp/syscd"   echo "    Error creating temp folder: "$SAVE_DIR"/tmp/syscd"
335   exit 1   exit 1
336  fi  fi
337  if [ ! -d /root/tmp/clonecd ];then  if [ ! -d "$SAVE_DIR"/tmp/clonecd ];then
338   echo   echo
339   echo "    Error creating temp folder: /root/tmp/clonecd"   echo "    Error creating temp folder: "$SAVE_DIR"/tmp/clonecd"
340   exit 1   exit 1
341  fi  fi
342    
343    
344  if [ ! -d /root/tmp/clonezilla-sysresccd ];then  if [ ! -d "$SAVE_DIR"/tmp/clonezilla-sysresccd ];then
345   echo   echo
346   echo "    Error creating temp folder: /root/tmp/clonezilla-sysresccd"   echo "    Error creating temp folder: "$SAVE_DIR"/tmp/clonezilla-sysresccd"
347   exit 1   exit 1
348  fi  fi
349  echo 'done'  echo 'done'
# Line 152  exit 1 Line 356  exit 1
356  }  }
357    
358  function errorISO(){  function errorISO(){
359  echo "   Error creating new ISO file: /root/tmp/output.iso"  echo "   Error creating new ISO file: "$SAVE_DIR"/tmp/output.iso"
360  rm /root/tmp/clonezilla-sysresccd-"$outName""$version".iso 2>/dev/null  rm "$SAVE_DIR"/tmp/clonezilla-sysresccd-"$outName""$version".iso 2>/dev/null
361  cleanUp  cleanUp
362  exit 1  exit 1
363  }  }
# Line 161  exit 1 Line 365  exit 1
365  function cleanUp(){  function cleanUp(){
366  echo -n "  echo -n "
367  Cleaning up...   "  Cleaning up...   "
368  umount /root/tmp/clonecd 2>/dev/null  umount "$SAVE_DIR"/tmp/clonecd 2>/dev/null
369  umount /root/tmp/syscd 2>/dev/null  umount "$SAVE_DIR"/tmp/syscd 2>/dev/null
370  if [ -z "$cleanUpValue" ];then  if [ -z "$cleanUpValue" ];then
371   rm -rf /root/tmp/clonezilla-sysresccd 2>/dev/null   rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd 2>/dev/null
372  fi  fi
373  rm -rf /root/tmp/clonecd /root/tmp/syscd 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/clonecd "$SAVE_DIR"/tmp/syscd 2>/dev/null
374  echo 'done'  echo 'done'
375  echo  echo
376  exit $exitStatus  exit $exitStatus
# Line 218  Available options are: Line 422  Available options are:
422    f           copy files only. Don't create ISO file and don't    f           copy files only. Don't create ISO file and don't
423                burn anything on CD                burn anything on CD
424    nf          don't copy files. Use files existing in folder    nf          don't copy files. Use files existing in folder
425                \"/root/tmp/clonezilla-sysresccd\".                \""$SAVE_DIR"/tmp/clonezilla-sysresccd\".
426                *** Caution: Dangerous!!! ***                *** Caution: Dangerous!!! ***
427    i           only create ISO file. Don't burn anything on CD    i           only create ISO file. Don't burn anything on CD
428    b           burn a previously created ISO file    b           burn a previously created ISO file
429      d [folder]  Use [folder]/tmp as temporary and output folder
430                  instead of $HOME/tmp
431    x [script]  A user defined and written BASH script    x [script]  A user defined and written BASH script
432                to be executed just before mastering the CD                to be executed just before mastering the CD
433      g [arch]    Download ISO files and exit. $(basename $0)
434                  will download the appropriate ISO files in
435                  order to succesfully build Clonezilla-SysRescCD.
436                  [arch] refers to Clonezilla Live architecture
437                  (i686,i486 or amd64 - use all to get them all)
438    v           print version and exit    v           print version and exit
439    h           print this screen and exit    h           print this screen and exit
440    
# Line 313  function readConfig(){ Line 524  function readConfig(){
524  }  }
525    
526  ####### Script starts here #######  ####### Script starts here #######
527    SAVE_DIR="$HOME"
528    
529    MKISOFS=genisoimage
530  onlyBurnISO=0  onlyBurnISO=0
531  onlyCopyFiles=0  onlyCopyFiles=0
532  onlyCreateISO=0  onlyCreateISO=0
# Line 323  profilesExist=0 Line 537  profilesExist=0
537  profilesError=0  profilesError=0
538    
539    
540  while getopts ":asp:bfihvn:x:" Option  while getopts ":asp:bfihvn:x:d:g:" Option
541  do  do
542   case $Option in   case $Option in
543   a)   a)
544    auto=yes    auto=yes
545          ;;    ;;
546   s)   s)
547    readConfig    readConfig
548    sourceProfiles    sourceProfiles
# Line 359  do Line 573  do
573    if [ $profilesExist -eq 1 ];then    if [ $profilesExist -eq 1 ];then
574     if $(isnumber "$OPTARG");then     if $(isnumber "$OPTARG");then
575      applyProfile $OPTARG      applyProfile $OPTARG
576                  usingProfile=yes      usingProfile=yes
577        currentProfile=$OPTARG
578     else     else
579      echo "    Error in parameter: -p $OPTARG"      echo "    Error in parameter: -p $OPTARG"
580      exit 1      exit 1
# Line 404  do Line 619  do
619    fi    fi
620    noFileCopy=1    noFileCopy=1
621    ;;    ;;
622     d)
623      SAVE_DIR="$OPTARG"
624      if [ ! -d "$SAVE_DIR" ]; then
625        mkdir "$SAVEDIR" 2>/dev/null
626        if [ -d "$SAVE_DIR" ];then
627          echo "Error: \"$SAVE_DIR\" cannot be created!!!"
628          exit 1
629        fi
630      fi
631      ;;
632     g)
633      ARCH="$OPTARG"
634      if [ "$ARCH" != "i486" ]  && [ "$ARCH" != "i686" ]  && [ "$ARCH" != "amd64" ] && [ "$ARCH" != "all" ];then
635        echo "    Error in parameter -g. Should be -g [i668|i486|amd64|all]"
636        exit 1
637      fi
638      ;;
639   esac   esac
640  done  done
641  shift $(($OPTIND - 1))  shift $(($OPTIND - 1))
642    
643  test "$(whoami)" = "root" || noRoot  if [ -z "$ARCH" ];then
644      test "$(whoami)" = "root" || noRoot
645    else
646      evalPrograms
647      downloadIsoFiles $ARCH
648      exit
649    fi
650  # chack auto mode  # chack auto mode
651  if [ -n "$auto" ];then  if [ -n "$auto" ];then
652    if [ -z "$usingProfile" ];then    if [ -z "$usingProfile" ];then
653      echo '  Error: Parameter -a used without -p'      echo '  Error: Parameter -a used without -p'
654                  exit 1      exit 1
655          fi    fi
656    if [ "$onlyBurnISO" -eq 1 ];then    if [ "$onlyBurnISO" -eq 1 ];then
657      echo "  Error: Conflicting parameters -a and -b used"      echo "  Error: Conflicting parameters -a and -b used"
658                  exit 1      exit 1
659          fi    fi
660  fi  fi
661    
662  # Check input parameters  # Check input parameters
# Line 432  elif [ $checkInParms -gt 1 ];then Line 669  elif [ $checkInParms -gt 1 ];then
669   exit 1   exit 1
670  fi  fi
671  if [ "$outName" = "" ];then  if [ "$outName" = "" ];then
672   outFile=/root/tmp/clonezilla-sysresccd-"$version".iso   outFile="$SAVE_DIR"/tmp/clonezilla-sysresccd-"$version".iso
673  else  else
674   outFile=/root/tmp/clonezilla-sysresccd-"$outName"-"$version".iso   outFile="$SAVE_DIR"/tmp/clonezilla-sysresccd-"$outName"-"$version".iso
675  fi  fi
676    
677  if [ $onlyBurnISO -eq 0 ];then  if [ $onlyBurnISO -eq 0 ];then
# Line 483  Is this correct? (y/[n]): " Line 720  Is this correct? (y/[n]): "
720      if [ -n "$auto" ]; then      if [ -n "$auto" ]; then
721        ans=y        ans=y
722      else      else
723                  clear      clear
724    echo -n "Current CD info:    echo -n "Current CD info:
725       Preparer: $preparerID       Preparer: $preparerID
726       Publisher: $publisher       Publisher: $publisher
# Line 503  Is this correct? (y/[n]): " Line 740  Is this correct? (y/[n]): "
740    clear    clear
741    echo "$(basename $0) - v $version - Spiros Georgaras <sng@hellug.gr>    echo "$(basename $0) - v $version - Spiros Georgaras <sng@hellug.gr>
742    "    "
743    
744      if [ -n "$currentProfile" ];then
745        echo "Running profile: $currentProfile ($outName)"
746      fi
747    
748    createTempFolders    createTempFolders
749    
750    echo -n "Mounting ISO files...   "    echo -n "Mounting ISO files...   "
751    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'
752    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'
753    echo 'done'    echo 'done'
754    echo -n "Copying files...   "    echo -n "Copying files...   "
755    cp -RL /root/tmp/syscd/* /root/tmp/clonezilla-sysresccd    cp -RL "$SAVE_DIR"/tmp/syscd/* "$SAVE_DIR"/tmp/clonezilla-sysresccd
756    cp -RL /root/tmp/clonecd/* /root/tmp/clonezilla-sysresccd    cp -RL "$SAVE_DIR"/tmp/clonecd/* "$SAVE_DIR"/tmp/clonezilla-sysresccd
757    echo 'done'    echo 'done'
758        
759        
760  #   echo -n "Extracting boot programs...  "  #   echo -n "Extracting boot programs...  "
761    echo "Extracting boot programs...  "    echo "Extracting boot programs...  "
762    cd /root/tmp/clonezilla-sysresccd/bootprog    cd "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootprog
763    mkdir tmp    mkdir tmp
764    cp *zip tmp    cp *zip tmp
765    unzip -x sys*zip win32/syslinux.exe    unzip -x sys*zip win32/syslinux.exe
# Line 532  Is this correct? (y/[n]): " Line 774  Is this correct? (y/[n]): "
774        
775    if [ ! -z "$splash" ];then    if [ ! -z "$splash" ];then
776     echo -n "Copying new spalsh screen...   "     echo -n "Copying new spalsh screen...   "
777     cp -L "$splash" /root/tmp/clonezilla-sysresccd/isolinux/ocswp.png     cp -L "$splash" "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/ocswp.png
778     echo 'done'     echo 'done'
779    else    else
780     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
781    fi    fi
782    
783    echo -n "Copying Super Grub Disk...   "    echo -n "Copying Super Grub Disk...   "
784    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' || {
785      echo      echo
786      echo      echo
787      echo      echo
788      echo "    Error: Copying Super Grub Disk failed!!!"      echo "    Error: Copying Super Grub Disk failed!!!"
789      echo      echo
790      echo "           Please make sure that the image file exists"      echo "           Please make sure that the image file exists"
791      echo "           Image file: /root/tmp/clonezilla-sysresccd/bootdisk/sgd.img"      echo "           Image file: "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/sgd.img"
792      echo      echo
793      echo      echo
794      cleanUp      cleanUp
# Line 554  Is this correct? (y/[n]): " Line 796  Is this correct? (y/[n]): "
796    }    }
797    if [ -e /root/.clonezilla-sysresccd/files/sgd2.img ];then    if [ -e /root/.clonezilla-sysresccd/files/sgd2.img ];then
798     echo -n "Copying Super Grub Disk 2...   "     echo -n "Copying Super Grub Disk 2...   "
799     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' || {
800       echo       echo
801       echo       echo
802       echo       echo
803       echo "    Error: Copying Super Grub Disk 2 failed!!!"       echo "    Error: Copying Super Grub Disk 2 failed!!!"
804       echo       echo
805       echo "           Please make sure that the image file exists"       echo "           Please make sure that the image file exists"
806       echo "           Image file: /root/tmp/clonezilla-sysresccd/bootdisk/sgd2.img"       echo "           Image file: "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/sgd2.img"
807       echo       echo
808       echo       echo
809       cleanUp       cleanUp
# Line 570  Is this correct? (y/[n]): " Line 812  Is this correct? (y/[n]): "
812    fi    fi
813    echo -n "Copying new cfg file(s)...   "    echo -n "Copying new cfg file(s)...   "
814    if [ -z $(echo "$cfgFile" | grep 'cfg$') ];then    if [ -z $(echo "$cfgFile" | grep 'cfg$') ];then
815      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
816    else    else
817      cp -L "$cfgFile" /root/tmp/clonezilla-sysresccd/isolinux/isolinux.cfg      cp -L "$cfgFile" "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/isolinux.cfg
818    fi    fi
819    echo 'done'    echo 'done'
820        
821    echo -n "Creating folder restorecd...   "    echo -n "Creating folder restorecd...   "
822    WHERE="$(pwd)"    WHERE="$(pwd)"
823    mkdir /root/tmp/clonezilla-sysresccd/restorecd 2>/dev/null    mkdir "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd 2>/dev/null
824    cd /root/.clonezilla-sysresccd/files    cd /root/.clonezilla-sysresccd/files
825    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 \
826      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
827    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
828    cp sbminst /root/tmp/clonezilla-sysresccd/restorecd    cp sbminst "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd
829        
830    # Copy Smart Boot Manager and rawrite-fdimage to bootdisk    # Copy Smart Boot Manager and rawrite-fdimage to bootdisk
831    mkdir /root/tmp/clonezilla-sysresccd/rawrite    mkdir "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite
832    cp  raw* fd* *dll /root/tmp/clonezilla-sysresccd/rawrite    cp  raw* fd* *dll "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite
833    cp sbm.img /root/tmp/clonezilla-sysresccd/bootdisk    cp sbm.img "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk
834    cd "$DebianLiveFolder" 2>/dev/null || debFilesError=yes    cd "$DebianLiveFolder" 2>/dev/null || debFilesError=yes
835  #   if [ -s files.tar.gz ];then  #   if [ -s files.tar.gz ];then
836  #     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
837  #   else  #   else
838  #     [ -e "$DebianLiveFolder"/unifont.bgf ] || {  #     [ -e "$DebianLiveFolder"/unifont.bgf ] || {
839  #       uniFontCopied=yes  #       uniFontCopied=yes
840  #       cp -L /root/.clonezilla-sysresccd/files/unifont.bgf "$DebianLiveFolder"  #       cp -L /root/.clonezilla-sysresccd/files/unifont.bgf "$DebianLiveFolder"
841  #     }  #     }
842  #     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
843  #     [ -z "$uniFontCopied" ] || rm "$DebianLiveFolder"/unifont.bgf  #     [ -z "$uniFontCopied" ] || rm "$DebianLiveFolder"/unifont.bgf
844  #   fi  #   fi
845  #   [ -z "$debFilesError" ] || {  #   [ -z "$debFilesError" ] || {
# Line 620  Is this correct? (y/[n]): " Line 862  Is this correct? (y/[n]): "
862    echo "done"    echo "done"
863    
864    echo -n "Copying documentation files...   "    echo -n "Copying documentation files...   "
865    cd /root/tmp/clonezilla-sysresccd    cd "$SAVE_DIR"/tmp/clonezilla-sysresccd
866    tar xzhf /root/tmp/clonezilla-sysresccd/restorecd/doc.tar.gz    tar xzhf "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/doc.tar.gz
867    echo 'done'    echo 'done'
868    
869    if [ ! -z "$exScript" ];then    if [ ! -z "$exScript" ];then
# Line 646  Is this correct? (y/[n]): " Line 888  Is this correct? (y/[n]): "
888   else   else
889    trap cleanUp 2    trap cleanUp 2
890    cleanUpValue=1    cleanUpValue=1
891    if [ ! -d  /root/tmp/clonezilla-sysresccd ];then    if [ ! -d  "$SAVE_DIR"/tmp/clonezilla-sysresccd ];then
892     echo "    Error accessing folder \"/root/tmp/clonezilla-sysresccd\""     echo "    Error accessing folder \""$SAVE_DIR"/tmp/clonezilla-sysresccd\""
893     exitStatus=1     exitStatus=1
894     cleanUp     cleanUp
895    fi    fi
896   fi   fi
897    
898   # move extra folders into utils   # move extra folders into utils
899   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
900   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
901    
902    #
903    # re-build clonezilla filesystem.squashfs
904    #
905    echo -n "Rebuilding Clonezilla squashfs...   "
906    cd "$SAVE_DIR"/tmp/clonezilla-sysresccd/live
907    unsquashfs filesystem.squashfs 2>/dev/null 1>&2
908    cp -r ../README* ../doc ../restorecd squashfs-root
909    mksquashfs squashfs-root aa.squashfs -always-use-fragments -no-duplicates -all-root 2>/dev/null 1>&2
910    mv aa.squashfs filesystem.squashfs
911    rm -rf squashfs-root
912    cd
913    echo 'done'
914    
915   if [ $onlyCopyFiles -eq 1 ];then   if [ $onlyCopyFiles -eq 1 ];then
916    cleanUpValue=1    cleanUpValue=1
917  #   echo  #   echo
918  #   echo  #   echo
919    echo "Both CDs have been copyied in: /root/tmp/clonezilla-sysresccd"    echo "Both CDs have been copyied in: "$SAVE_DIR"/tmp/clonezilla-sysresccd"
920    cleanUp    cleanUp
921   fi   fi
922   echo   echo
# Line 671  if [ -z "$auto" ]; then Line 926  if [ -z "$auto" ]; then
926  ************************************************************************  ************************************************************************
927     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
928     in the CD, now is the right time.     in the CD, now is the right time.
929        CD root is \"/root/tmp/clonezilla-sysresccd\"        CD root is \""$SAVE_DIR"/tmp/clonezilla-sysresccd\"
930    
931     When you are done     When you are done
932  ***********************************************************************  ***********************************************************************
# Line 681  Press ENTER to continue...   " Line 936  Press ENTER to continue...   "
936  else  else
937    echo "Creating new ISO file."    echo "Creating new ISO file."
938  fi  fi
939    find /root/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';'    find "$SAVE_DIR"/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';'
940  #   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
941    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
942    echo "    echo "
943  Done creating new ISO file  Done creating new ISO file
944  The file is saved as $outFile"  The file is saved as $outFile"
# Line 718  while [ 1 ];do Line 973  while [ 1 ];do
973     ans=n     ans=n
974   else   else
975     echo -n "Do you want to burn this ISO file? ([y]/n): "     echo -n "Do you want to burn this ISO file? ([y]/n): "
976      read ans     read ans
977   fi   fi
978  done  done
979  burnISO=0  burnISO=0

Legend:
Removed from v.64  
changed lines
  Added in v.176

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26