/[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 68 by sng, Sun May 30 20:11:06 2010 UTC revision 193 by sng, Tue Aug 28 09:39:20 2012 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        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
69      done
70    else
71      clonType="$1"
72      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
77    fi
78    
79    # Download System Rescue CD
80    echo "
81    ******  Downloading System Rescue CD "$sysVersion" ******"
82    unset curlContinue
83    if [ -e systemrescuecd-x86-"$sysVersion".iso ];then
84      if [ -n "$md5sumFound" ];then
85        echo "$sysmd5  systemrescuecd-x86-"$sysVersion".iso" > test.md5sum
86        echo -n "File found.
87      Checking integrity of "
88        md5sum -c test.md5sum 2>/dev/null
89        if [ "$?" -eq 0 ];then
90          rm -f test.md5sum 2>/dev/null
91          return
92        else
93          echo "File systemrescuecd-x86-"$sysVersion".iso already exists"
94          echo "  You can continue downloading the file or restart it"
95          echo -n "  Continue downloading? (y/[n]): "
96          read ans
97          curlContinue=""
98          if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
99            curlContinue=1
100          else
101            rm -f test.md5sum 2>/dev/null
102          fi
103        fi
104      else
105        echo "File systemrescuecd-x86-"$sysVersion".iso already exists"
106        echo "    You can continue downloading the file or restart it"
107        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"
109        echo "  download is complete"
110        echo -n "  Continue downloading? (y/[n]): "
111        curlContinue=""
112        read ans
113        if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
114          curlContinue=1
115        fi
116      fi
117    fi
118    if [ -z "$curlContinue" ];then
119      curl -L "$sysIso" -o systemrescuecd-x86-"$sysVersion".iso
120    else
121      curl -L -C - "$sysIso" -o systemrescuecd-x86-"$sysVersion".iso
122    fi
123    # Check integrity
124    if [ -n "$md5sumFound" ];then
125      echo "$sysmd5  systemrescuecd-x86-"$sysVersion".iso" > test.md5sum
126      echo -n "Checking integrity of "
127      md5sum -c test.md5sum 2>/dev/null
128      if [ "$?" -eq 1 ];then
129        echo "Integrity check on systemrescuecd-x86-"$sysVersion".iso failed!!!"
130        echo -n "Do you want to delete this file? ([y]/n): "
131        read ans
132        if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
133          rm -f systemrescuecd-x86-"$sysVersion".iso 2>/dev/null && echo "File deleted..." || echo "******  Error deleting file!!!  ******
134      Please delete systemrescuecd-x86-"$sysVersion".iso manually"
135        fi
136      fi
137      rm -f test.md5sum 2>/dev/null
138    fi
139    }
140    
141    function downloadClonezillaLive(){
142    echo "
143    ******  Downloading Clonezilla Live "$clonVersion" "$clonType"  ******"
144    unset curlContinue
145    if [ -e clonezilla-live-"$clonVersion"-"$clonType".iso ];then
146      if [ -n "$md5sumFound" ];then
147        if [ "$clonType" = "amd64" ];then
148          echo "$amd64md5  clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum
149        elif [ "$clonType" = "i486" ];then
150          echo "$i486md5  clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum
151        else
152          echo "$i686md5  clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum
153        fi
154        unset checkmd5
155        echo -n "File found.
156      Checking integrity of "
157        md5sum -c test.md5sum 2>/dev/null && checkmd5=1
158      
159        if [ -z "$checkmd5" ];then
160          # md5 check failed
161          unset checkmd5
162          echo "File clonezilla-live-"$clonVersion"-"$clonType".iso already exists"
163          echo "  You can continue downloading the file or restart it"
164          echo -n "  Continue downloading? (y/[n]): "
165          read ans
166          if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
167            curlContinue=1
168          else
169            rm -f test.md5sum 2>/dev/null
170            return
171          fi
172        else
173          # file is ok
174          return
175        fi
176      else
177        # no md5sum
178        echo "File clonezilla-live-"$clonVersion"-"$clonType".iso already exists"
179        echo "  You can continue downloading the file or restart it"
180        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"
182        echo "  download is complete"
183        echo -n "  Continue downloading? (y/[n]): "
184        read ans
185        if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
186          curlContinue=1
187        fi
188      fi
189    fi
190    
191    # Check if we have to go to OldFiles
192    echo "Checking file availability..."
193    oldFiles="$(curl -IL "$clonIso" | grep 'Location: http://')"
194    if [ -z "$oldFiles" ];then
195      # go to stable
196      clonIso="$(echo "$clonIso" | sed 's{OldFiles/{{' | sed 's{OldFiles%2F{{')"
197      echo ">>>>>>  This is Clonezilla Live Stable!!!"
198    else
199      echo ">>>>>>  This is an older Clonezilla Live version!!!"
200    fi
201    
202    # Download file
203    if [ -z "$curlContinue" ];then
204      curl -L "$clonIso" -o clonezilla-live-"$clonVersion"-"$clonType".iso
205    else
206      curl -L -C - "$clonIso" -o clonezilla-live-"$clonVersion"-"$clonType".iso
207    fi  
208    
209    if [ -n "$md5sumFound" ];then
210      if [ "$clonType" = "amd64" ];then
211        echo "$amd64md5  clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum
212      elif [ "$clonType" = "i486" ];then
213        echo "$i486md5  clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum
214      else
215        echo "$i686md5  clonezilla-live-"$clonVersion"-"$clonType".iso">test.md5sum
216      fi
217      unset checkmd5
218      echo -n "Checking integrity of "
219      md5sum -c test.md5sum 2>/dev/null && checkmd5=1
220      rm -f test.md5sum 2>/dev/null
221      if [ -z "$checkmd5" ];then
222        echo "Integrity check on clonezilla-live-"$clonVersion"-"$clonType".iso failed!!!"
223        echo -n "Do you want to delete this file? ([y]/n): "
224        read ans
225        if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then
226          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"
228        fi
229      fi
230    fi
231    
232    
233    }
234    
235  function noRoot(){  function noRoot(){
236  echo "    Error: You must be root to execute this script"  echo "    Error: You must be root to execute this script"
237  exit 1  exit 1
# Line 109  done Line 323  done
323    
324    
325  function createTempFolders(){  function createTempFolders(){
326  echo -n "Creating /root/tmp folder...   "  echo -n "Creating "$SAVE_DIR"/tmp folder...   "
327  mkdir /root/tmp 2>/dev/null  mkdir "$SAVE_DIR"/tmp 2>/dev/null
328  if [ ! -d /root/tmp ];then  if [ ! -d "$SAVE_DIR"/tmp ];then
329   echo   echo
330   echo "    Error creating folder: /root/tmp"   echo "    Error creating folder: "$SAVE_DIR"/tmp"
331   echo "          This shouldn't be happening..."   echo "          This shouldn't be happening..."
332   exit 1   exit 1
333  fi  fi
334  echo 'done'  echo 'done'
335    
336  echo -n "Creating temp folders...   "  echo -n "Creating temp folders...   "
337  rm -rf /root/tmp/clonezilla-sysresccd-"$version".iso 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd-"$version".iso 2>/dev/null
338  rm -rf /root/tmp/syscd 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/syscd 2>/dev/null
339  rm -rf /root/tmp/clonecd 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/clonecd 2>/dev/null
340  rm -rf /root/tmp/clonezilla-sysresccd 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd 2>/dev/null
341  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
342  if [ ! -d /root/tmp/syscd ];then  if [ ! -d "$SAVE_DIR"/tmp/syscd ];then
343   echo   echo
344   echo "    Error creating temp folder: /root/tmp/syscd"   echo "    Error creating temp folder: "$SAVE_DIR"/tmp/syscd"
345   exit 1   exit 1
346  fi  fi
347  if [ ! -d /root/tmp/clonecd ];then  if [ ! -d "$SAVE_DIR"/tmp/clonecd ];then
348   echo   echo
349   echo "    Error creating temp folder: /root/tmp/clonecd"   echo "    Error creating temp folder: "$SAVE_DIR"/tmp/clonecd"
350   exit 1   exit 1
351  fi  fi
352    
353    
354  if [ ! -d /root/tmp/clonezilla-sysresccd ];then  if [ ! -d "$SAVE_DIR"/tmp/clonezilla-sysresccd ];then
355   echo   echo
356   echo "    Error creating temp folder: /root/tmp/clonezilla-sysresccd"   echo "    Error creating temp folder: "$SAVE_DIR"/tmp/clonezilla-sysresccd"
357   exit 1   exit 1
358  fi  fi
359  echo 'done'  echo 'done'
# Line 152  exit 1 Line 366  exit 1
366  }  }
367    
368  function errorISO(){  function errorISO(){
369  echo "   Error creating new ISO file: /root/tmp/output.iso"  echo "   Error creating new ISO file: "$SAVE_DIR"/tmp/output.iso"
370  rm /root/tmp/clonezilla-sysresccd-"$outName""$version".iso 2>/dev/null  rm "$SAVE_DIR"/tmp/clonezilla-sysresccd-"$outName""$version".iso 2>/dev/null
371  cleanUp  cleanUp
372  exit 1  exit 1
373  }  }
# Line 161  exit 1 Line 375  exit 1
375  function cleanUp(){  function cleanUp(){
376  echo -n "  echo -n "
377  Cleaning up...   "  Cleaning up...   "
378  umount /root/tmp/clonecd 2>/dev/null  umount "$SAVE_DIR"/tmp/clonecd 2>/dev/null
379  umount /root/tmp/syscd 2>/dev/null  umount "$SAVE_DIR"/tmp/syscd 2>/dev/null
380  if [ -z "$cleanUpValue" ];then  if [ -z "$cleanUpValue" ];then
381   rm -rf /root/tmp/clonezilla-sysresccd 2>/dev/null   rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd 2>/dev/null
382  fi  fi
383  rm -rf /root/tmp/clonecd /root/tmp/syscd 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/clonecd "$SAVE_DIR"/tmp/syscd 2>/dev/null
384  echo 'done'  echo 'done'
385  echo  echo
386  exit $exitStatus  exit $exitStatus
# Line 218  Available options are: Line 432  Available options are:
432    f           copy files only. Don't create ISO file and don't    f           copy files only. Don't create ISO file and don't
433                burn anything on CD                burn anything on CD
434    nf          don't copy files. Use files existing in folder    nf          don't copy files. Use files existing in folder
435                \"/root/tmp/clonezilla-sysresccd\".                \""$SAVE_DIR"/tmp/clonezilla-sysresccd\".
436                *** Caution: Dangerous!!! ***                *** Caution: Dangerous!!! ***
437    i           only create ISO file. Don't burn anything on CD    i           only create ISO file. Don't burn anything on CD
438    b           burn a previously created ISO file    b           burn a previously created ISO file
439      d [folder]  Use [folder]/tmp as temporary and output folder
440                  instead of $HOME/tmp
441    x [script]  A user defined and written BASH script    x [script]  A user defined and written BASH script
442                to be executed just before mastering the CD                to be executed just before mastering the CD
443      g [arch]    Download ISO files and exit. $(basename $0)
444                  will download the appropriate ISO files in
445                  order to succesfully build Clonezilla-SysRescCD.
446                  [arch] refers to Clonezilla Live architecture
447                  (i686,i486 or amd64 - use all to get them all)
448                  SystemRescueCD will be downloaded in any case
449    v           print version and exit    v           print version and exit
450    h           print this screen and exit    h           print this screen and exit
451    
# Line 313  function readConfig(){ Line 535  function readConfig(){
535  }  }
536    
537  ####### Script starts here #######  ####### Script starts here #######
538    SAVE_DIR="$HOME"
539    
540    MKISOFS=genisoimage
541  onlyBurnISO=0  onlyBurnISO=0
542  onlyCopyFiles=0  onlyCopyFiles=0
543  onlyCreateISO=0  onlyCreateISO=0
# Line 323  profilesExist=0 Line 548  profilesExist=0
548  profilesError=0  profilesError=0
549    
550    
551  while getopts ":asp:bfihvn:x:" Option  while getopts ":asp:bfihvn:x:d:g:" Option
552  do  do
553   case $Option in   case $Option in
554   a)   a)
555    auto=yes    auto=yes
556          ;;    ;;
557   s)   s)
558    readConfig    readConfig
559    sourceProfiles    sourceProfiles
# Line 359  do Line 584  do
584    if [ $profilesExist -eq 1 ];then    if [ $profilesExist -eq 1 ];then
585     if $(isnumber "$OPTARG");then     if $(isnumber "$OPTARG");then
586      applyProfile $OPTARG      applyProfile $OPTARG
587                  usingProfile=yes      usingProfile=yes
588        currentProfile=$OPTARG
589     else     else
590      echo "    Error in parameter: -p $OPTARG"      echo "    Error in parameter: -p $OPTARG"
591      exit 1      exit 1
# Line 404  do Line 630  do
630    fi    fi
631    noFileCopy=1    noFileCopy=1
632    ;;    ;;
633     d)
634      SAVE_DIR="$OPTARG"
635      if [ ! -d "$SAVE_DIR" ]; then
636        mkdir "$SAVEDIR" 2>/dev/null
637        if [ -d "$SAVE_DIR" ];then
638          echo "Error: \"$SAVE_DIR\" cannot be created!!!"
639          exit 1
640        fi
641      fi
642      ;;
643     g)
644      ARCH="$OPTARG"
645      if [ "$ARCH" != "i486" ]  && [ "$ARCH" != "i686" ]  && [ "$ARCH" != "amd64" ] && [ "$ARCH" != "all" ];then
646        echo "    Error in parameter -g. Should be -g [i668|i486|amd64|all]"
647        exit 1
648      fi
649      ;;
650   esac   esac
651  done  done
652  shift $(($OPTIND - 1))  shift $(($OPTIND - 1))
653    
654  test "$(whoami)" = "root" || noRoot  if [ -z "$ARCH" ];then
655      test "$(whoami)" = "root" || noRoot
656  # chack auto mode  else
657      evalPrograms
658      downloadIsoFiles $ARCH
659      exit
660    fi
661    # check auto mode
662  if [ -n "$auto" ];then  if [ -n "$auto" ];then
663    if [ -z "$usingProfile" ];then    if [ -z "$usingProfile" ];then
664      echo '  Error: Parameter -a used without -p'      echo '  Error: Parameter -a used without -p'
665                  exit 1      exit 1
666          fi    fi
667    if [ "$onlyBurnISO" -eq 1 ];then    if [ "$onlyBurnISO" -eq 1 ];then
668      echo "  Error: Conflicting parameters -a and -b used"      echo "  Error: Conflicting parameters -a and -b used"
669                  exit 1      exit 1
670          fi    fi
671  fi  fi
672    
673  # Check input parameters  # Check input parameters
# Line 432  elif [ $checkInParms -gt 1 ];then Line 680  elif [ $checkInParms -gt 1 ];then
680   exit 1   exit 1
681  fi  fi
682  if [ "$outName" = "" ];then  if [ "$outName" = "" ];then
683   outFile=/root/tmp/clonezilla-sysresccd-"$version".iso   outFile="$SAVE_DIR"/tmp/clonezilla-sysresccd-"$version".iso
684  else  else
685   outFile=/root/tmp/clonezilla-sysresccd-"$outName"-"$version".iso   outFile="$SAVE_DIR"/tmp/clonezilla-sysresccd-"$outName"-"$version".iso
686  fi  fi
687    
688  if [ $onlyBurnISO -eq 0 ];then  if [ $onlyBurnISO -eq 0 ];then
# Line 455  if [ $onlyBurnISO -eq 0 ];then Line 703  if [ $onlyBurnISO -eq 0 ];then
703  #    #  
704  # Is this correct? (y/[n]): "  # Is this correct? (y/[n]): "
705    
706  if [ -n "$auto" ]; then    if [ -n "$auto" ]; then
707  ans=y      ans=y
708  else    else
709    echo -n "Current settings:      echo -n "Current settings:
710       System Rescue CD: $sysCD         System Rescue CD: $sysCD
711       Clonezilla Live CD: $cloneCD         Clonezilla Live CD: $cloneCD
712       isolinux.cfg to use: $cfgFile         isolinux.cfg to use: $cfgFile
713       script to execute: $exScript         script to execute: $exScript
714          
715  Is this correct? (y/[n]): "    Is this correct? (y/[n]): "
716          
717         read ans      read ans
718      fi    fi
719     if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then     if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then
720      sysCD=''      sysCD=''
721      cloneCD=''      cloneCD=''
# Line 483  Is this correct? (y/[n]): " Line 731  Is this correct? (y/[n]): "
731      if [ -n "$auto" ]; then      if [ -n "$auto" ]; then
732        ans=y        ans=y
733      else      else
734                  clear      clear
735    echo -n "Current CD info:    echo -n "Current CD info:
736       Preparer: $preparerID       Preparer: $preparerID
737       Publisher: $publisher       Publisher: $publisher
# Line 503  Is this correct? (y/[n]): " Line 751  Is this correct? (y/[n]): "
751    clear    clear
752    echo "$(basename $0) - v $version - Spiros Georgaras <sng@hellug.gr>    echo "$(basename $0) - v $version - Spiros Georgaras <sng@hellug.gr>
753    "    "
754    
755      if [ -n "$currentProfile" ];then
756        echo "Running profile: $currentProfile ($outName)"
757      fi
758    
759    createTempFolders    createTempFolders
760    
761    echo -n "Mounting ISO files...   "    echo -n "Mounting ISO files...   "
762    mount "$sysCD" /root/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'
763    mount "$cloneCD" /root/tmp/clonecd -o loop || errorMount '    Error mounting  Clonezilla" file'    mount "$cloneCD" "$SAVE_DIR"/tmp/clonecd -o ro,loop || errorMount '    Error mounting  Clonezilla" file'
764    echo 'done'    echo 'done'
765    echo -n "Copying files...   "    echo -n "Copying files...   "
766    cp -RL /root/tmp/syscd/* /root/tmp/clonezilla-sysresccd    cp -RL "$SAVE_DIR"/tmp/syscd/* "$SAVE_DIR"/tmp/clonezilla-sysresccd
767    cp -RL /root/tmp/clonecd/* /root/tmp/clonezilla-sysresccd    cp -RL "$SAVE_DIR"/tmp/clonecd/* "$SAVE_DIR"/tmp/clonezilla-sysresccd
768    echo 'done'    echo 'done'
769        
770        
771  #   echo -n "Extracting boot programs...  "  #   echo -n "Extracting boot programs...  "
772    echo "Extracting boot programs...  "    echo "Extracting boot programs...  "
773    cd /root/tmp/clonezilla-sysresccd/bootprog    cd "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootprog
774    mkdir tmp    mkdir tmp
775    cp *zip tmp    cp *zip tmp
776    unzip -x sys*zip win32/syslinux.exe    unzip -x sys*zip win32/syslinux.exe
# Line 531  Is this correct? (y/[n]): " Line 784  Is this correct? (y/[n]): "
784  #   echo 'done'  #   echo 'done'
785        
786    if [ ! -z "$splash" ];then    if [ ! -z "$splash" ];then
787     echo -n "Copying new spalsh screen...   "      echo -n "Copying new spalsh screen...   "
788     cp -L "$splash" /root/tmp/clonezilla-sysresccd/isolinux/ocswp.png      cp -L "$splash" "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/ocswp.png
789     echo 'done'      echo 'done'
790    else    else
791     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
792    fi    fi
793    
794    echo -n "Copying Super Grub Disk...   "    echo -n "Copying Super Grub Disk...   "
795    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' || {
796      echo      echo
797      echo      echo
798      echo      echo
799      echo "    Error: Copying Super Grub Disk failed!!!"      echo "    Error: Copying Super Grub Disk failed!!!"
800      echo      echo
801      echo "           Please make sure that the image file exists"      echo "           Please make sure that the image file exists"
802      echo "           Image file: /root/tmp/clonezilla-sysresccd/bootdisk/sgd.img"      echo "           Image file: "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/sgd.img"
803      echo      echo
804      echo      echo
805      cleanUp      cleanUp
# Line 554  Is this correct? (y/[n]): " Line 807  Is this correct? (y/[n]): "
807    }    }
808    if [ -e /root/.clonezilla-sysresccd/files/sgd2.img ];then    if [ -e /root/.clonezilla-sysresccd/files/sgd2.img ];then
809     echo -n "Copying Super Grub Disk 2...   "     echo -n "Copying Super Grub Disk 2...   "
810     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' || {
811       echo       echo
812       echo       echo
813       echo       echo
814       echo "    Error: Copying Super Grub Disk 2 failed!!!"       echo "    Error: Copying Super Grub Disk 2 failed!!!"
815       echo       echo
816       echo "           Please make sure that the image file exists"       echo "           Please make sure that the image file exists"
817       echo "           Image file: /root/tmp/clonezilla-sysresccd/bootdisk/sgd2.img"       echo "           Image file: "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/sgd2.img"
818       echo       echo
819       echo       echo
820       cleanUp       cleanUp
# Line 570  Is this correct? (y/[n]): " Line 823  Is this correct? (y/[n]): "
823    fi    fi
824    echo -n "Copying new cfg file(s)...   "    echo -n "Copying new cfg file(s)...   "
825    if [ -z $(echo "$cfgFile" | grep 'cfg$') ];then    if [ -z $(echo "$cfgFile" | grep 'cfg$') ];then
826      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
827    else    else
828      cp -L "$cfgFile" /root/tmp/clonezilla-sysresccd/isolinux/isolinux.cfg      cp -L "$cfgFile" "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/isolinux.cfg
829    fi    fi
830    echo 'done'    echo 'done'
831        
832    echo -n "Creating folder restorecd...   "    echo -n "Creating folder restorecd...   "
833    WHERE="$(pwd)"    WHERE="$(pwd)"
834    mkdir /root/tmp/clonezilla-sysresccd/restorecd 2>/dev/null    mkdir "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd 2>/dev/null
835    cd /root/.clonezilla-sysresccd/files    cd /root/.clonezilla-sysresccd/files
836    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 \
837      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
838    cp -L default-restore-ocswp.png /root/tmp/clonezilla-sysresccd/restorecd/ocswp.png    fsplash=`basename "$splash"`
839    cp sbminst /root/tmp/clonezilla-sysresccd/restorecd    if [ "$fsplash" = "default-ocswp-i686.png" ] || [ "$fsplash" = "default-ocswp-i486.png" ] || [ "$fsplash" = "default-ocswp-amd64.png" ];then
840        cp $(echo "$splash" | sed 's/default/default-restore/') "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/ocswp.png
841      else
842        cp -L default-restore-ocswp.png "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/ocswp.png
843      fi
844      cp sbminst "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd
845        
846    # Copy Smart Boot Manager and rawrite-fdimage to bootdisk    # Copy Smart Boot Manager and rawrite-fdimage to bootdisk
847    mkdir /root/tmp/clonezilla-sysresccd/rawrite    mkdir "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite
848    cp  raw* fd* *dll /root/tmp/clonezilla-sysresccd/rawrite    cp  raw* fd* *dll "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite
849    cp sbm.img /root/tmp/clonezilla-sysresccd/bootdisk    cp sbm.img "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk
850    cd "$DebianLiveFolder" 2>/dev/null || debFilesError=yes    cd "$DebianLiveFolder" 2>/dev/null || debFilesError=yes
851  #   if [ -s files.tar.gz ];then  #   if [ -s files.tar.gz ];then
852  #     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
853  #   else  #   else
854  #     [ -e "$DebianLiveFolder"/unifont.bgf ] || {  #     [ -e "$DebianLiveFolder"/unifont.bgf ] || {
855  #       uniFontCopied=yes  #       uniFontCopied=yes
856  #       cp -L /root/.clonezilla-sysresccd/files/unifont.bgf "$DebianLiveFolder"  #       cp -L /root/.clonezilla-sysresccd/files/unifont.bgf "$DebianLiveFolder"
857  #     }  #     }
858  #     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
859  #     [ -z "$uniFontCopied" ] || rm "$DebianLiveFolder"/unifont.bgf  #     [ -z "$uniFontCopied" ] || rm "$DebianLiveFolder"/unifont.bgf
860  #   fi  #   fi
861  #   [ -z "$debFilesError" ] || {  #   [ -z "$debFilesError" ] || {
# Line 620  Is this correct? (y/[n]): " Line 878  Is this correct? (y/[n]): "
878    echo "done"    echo "done"
879    
880    echo -n "Copying documentation files...   "    echo -n "Copying documentation files...   "
881    cd /root/tmp/clonezilla-sysresccd    cd "$SAVE_DIR"/tmp/clonezilla-sysresccd
882    tar xzhf /root/tmp/clonezilla-sysresccd/restorecd/doc.tar.gz    tar xzhf "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/doc.tar.gz
883    echo 'done'    echo 'done'
884    
885    if [ ! -z "$exScript" ];then    if [ ! -z "$exScript" ];then
886  #    echo -n "Executing external script: \"$exScript\"...   "  #    echo -n "Executing external script: \"$exScript\"...   "
887     echo -n "Executing external script...   "      echo -n "Executing external script...   "
888     . "$exScript" || {      . "$exScript" || {
889      echo        echo
890      echo        echo
891      echo        echo
892      echo "    Error: The execution of the script failed!!!"        echo "    Error: The execution of the script failed!!!"
893      echo "           Please correct it and try again"        echo "           Please correct it and try again"
894      echo        echo
895      echo "    Script: \"$exScript\""        echo "    Script: \"$exScript\""
896      cleanUp        cleanUp
897      exit 1        exit 1
898     }      }
899    echo 'done'      echo 'done'
900    fi    fi
901  #   echo  #   echo
902  #   echo  #   echo
903  #   echo  #   echo
904   else    else
905    trap cleanUp 2      trap cleanUp 2
906    cleanUpValue=1      cleanUpValue=1
907    if [ ! -d  /root/tmp/clonezilla-sysresccd ];then      if [ ! -d  "$SAVE_DIR"/tmp/clonezilla-sysresccd ];then
908     echo "    Error accessing folder \"/root/tmp/clonezilla-sysresccd\""        echo "    Error accessing folder \""$SAVE_DIR"/tmp/clonezilla-sysresccd\""
909     exitStatus=1        exitStatus=1
910     cleanUp        cleanUp
911        fi
912    fi    fi
  fi  
913    
914   # move extra folders into utils   # move extra folders into utils
915   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
916   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
917    
918      # copy png files from isolinux/ to syslinux/
919      cp  "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/*.png "$SAVE_DIR"/tmp/clonezilla-sysresccd/syslinux
920  #  #
921  # re-build clonezilla filesystem.squashfs  # re-build clonezilla filesystem.squashfs
922  #  #
923  echo -n "Rebuilding Clonezilla squashfs...   "  echo -n "Rebuilding Clonezilla squashfs...   "
924  cd /root/tmp/clonezilla-sysresccd/live  cd "$SAVE_DIR"/tmp/clonezilla-sysresccd/live
925  unsquashfs filesystem.squashfs 2>/dev/null 1>&2  unsquashfs filesystem.squashfs 2>/dev/null 1>&2
926  cp -r ../README* ../doc ../restorecd squashfs-root  cp -r ../README* ../doc ../restorecd squashfs-root
927  mksquashfs squashfs-root aa.squashfs -always-use-fragments -no-duplicates -all-root 2>/dev/null 1>&2  # mksquashfs squashfs-root aa.squashfs -always-use-fragments -no-duplicates -all-root 2>/dev/null 1>&2
928    if [ "$clonType" = "amd64" ];then
929      mksquashfs squashfs-root aa.squashfs -comp xz -Xbcj ia64 -Xdict-size 75% -always-use-fragments -no-duplicates -all-root 2>/dev/null 1>&2
930    else
931      mksquashfs squashfs-root aa.squashfs -comp xz -Xbcj x86 -Xdict-size 75% -always-use-fragments -no-duplicates -all-root 2>/dev/null 1>&2
932    fi
933  mv aa.squashfs filesystem.squashfs  mv aa.squashfs filesystem.squashfs
934  rm -rf squashfs-root  rm -rf squashfs-root
935  cd  cd
# Line 674  echo 'done' Line 939  echo 'done'
939    cleanUpValue=1    cleanUpValue=1
940  #   echo  #   echo
941  #   echo  #   echo
942    echo "Both CDs have been copyied in: /root/tmp/clonezilla-sysresccd"    echo "Both CDs have been copyied in: "$SAVE_DIR"/tmp/clonezilla-sysresccd"
943    cleanUp    cleanUp
944   fi   fi
945   echo   echo
# Line 684  if [ -z "$auto" ]; then Line 949  if [ -z "$auto" ]; then
949  ************************************************************************  ************************************************************************
950     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
951     in the CD, now is the right time.     in the CD, now is the right time.
952        CD root is \"/root/tmp/clonezilla-sysresccd\"        CD root is \""$SAVE_DIR"/tmp/clonezilla-sysresccd\"
953    
954     When you are done     When you are done
955  ***********************************************************************  ***********************************************************************
# Line 694  Press ENTER to continue...   " Line 959  Press ENTER to continue...   "
959  else  else
960    echo "Creating new ISO file."    echo "Creating new ISO file."
961  fi  fi
962    find /root/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';'    find "$SAVE_DIR"/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';'
963  #   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
964    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
965    echo "    echo "
966  Done creating new ISO file  Done creating new ISO file
967  The file is saved as $outFile"  The file is saved as $outFile"
# Line 731  while [ 1 ];do Line 996  while [ 1 ];do
996     ans=n     ans=n
997   else   else
998     echo -n "Do you want to burn this ISO file? ([y]/n): "     echo -n "Do you want to burn this ISO file? ([y]/n): "
999      read ans     read ans
1000   fi   fi
1001  done  done
1002  burnISO=0  burnISO=0

Legend:
Removed from v.68  
changed lines
  Added in v.193

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26