/[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 93 by sng, Fri Aug 13 08:30:37 2010 UTC revision 140 by sng, Mon Sep 27 17:02:51 2010 UTC
# Line 109  done Line 109  done
109    
110    
111  function createTempFolders(){  function createTempFolders(){
112  echo -n "Creating /root/tmp folder...   "  echo -n "Creating "$SAVE_DIR"/tmp folder...   "
113  mkdir /root/tmp 2>/dev/null  mkdir "$SAVE_DIR"/tmp 2>/dev/null
114  if [ ! -d /root/tmp ];then  if [ ! -d "$SAVE_DIR"/tmp ];then
115   echo   echo
116   echo "    Error creating folder: /root/tmp"   echo "    Error creating folder: "$SAVE_DIR"/tmp"
117   echo "          This shouldn't be happening..."   echo "          This shouldn't be happening..."
118   exit 1   exit 1
119  fi  fi
120  echo 'done'  echo 'done'
121    
122  echo -n "Creating temp folders...   "  echo -n "Creating temp folders...   "
123  rm -rf /root/tmp/clonezilla-sysresccd-"$version".iso 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd-"$version".iso 2>/dev/null
124  rm -rf /root/tmp/syscd 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/syscd 2>/dev/null
125  rm -rf /root/tmp/clonecd 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/clonecd 2>/dev/null
126  rm -rf /root/tmp/clonezilla-sysresccd 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd 2>/dev/null
127  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
128  if [ ! -d /root/tmp/syscd ];then  if [ ! -d "$SAVE_DIR"/tmp/syscd ];then
129   echo   echo
130   echo "    Error creating temp folder: /root/tmp/syscd"   echo "    Error creating temp folder: "$SAVE_DIR"/tmp/syscd"
131   exit 1   exit 1
132  fi  fi
133  if [ ! -d /root/tmp/clonecd ];then  if [ ! -d "$SAVE_DIR"/tmp/clonecd ];then
134   echo   echo
135   echo "    Error creating temp folder: /root/tmp/clonecd"   echo "    Error creating temp folder: "$SAVE_DIR"/tmp/clonecd"
136   exit 1   exit 1
137  fi  fi
138    
139    
140  if [ ! -d /root/tmp/clonezilla-sysresccd ];then  if [ ! -d "$SAVE_DIR"/tmp/clonezilla-sysresccd ];then
141   echo   echo
142   echo "    Error creating temp folder: /root/tmp/clonezilla-sysresccd"   echo "    Error creating temp folder: "$SAVE_DIR"/tmp/clonezilla-sysresccd"
143   exit 1   exit 1
144  fi  fi
145  echo 'done'  echo 'done'
# Line 152  exit 1 Line 152  exit 1
152  }  }
153    
154  function errorISO(){  function errorISO(){
155  echo "   Error creating new ISO file: /root/tmp/output.iso"  echo "   Error creating new ISO file: "$SAVE_DIR"/tmp/output.iso"
156  rm /root/tmp/clonezilla-sysresccd-"$outName""$version".iso 2>/dev/null  rm "$SAVE_DIR"/tmp/clonezilla-sysresccd-"$outName""$version".iso 2>/dev/null
157  cleanUp  cleanUp
158  exit 1  exit 1
159  }  }
# Line 161  exit 1 Line 161  exit 1
161  function cleanUp(){  function cleanUp(){
162  echo -n "  echo -n "
163  Cleaning up...   "  Cleaning up...   "
164  umount /root/tmp/clonecd 2>/dev/null  umount "$SAVE_DIR"/tmp/clonecd 2>/dev/null
165  umount /root/tmp/syscd 2>/dev/null  umount "$SAVE_DIR"/tmp/syscd 2>/dev/null
166  if [ -z "$cleanUpValue" ];then  if [ -z "$cleanUpValue" ];then
167   rm -rf /root/tmp/clonezilla-sysresccd 2>/dev/null   rm -rf "$SAVE_DIR"/tmp/clonezilla-sysresccd 2>/dev/null
168  fi  fi
169  rm -rf /root/tmp/clonecd /root/tmp/syscd 2>/dev/null  rm -rf "$SAVE_DIR"/tmp/clonecd "$SAVE_DIR"/tmp/syscd 2>/dev/null
170  echo 'done'  echo 'done'
171  echo  echo
172  exit $exitStatus  exit $exitStatus
# Line 218  Available options are: Line 218  Available options are:
218    f           copy files only. Don't create ISO file and don't    f           copy files only. Don't create ISO file and don't
219                burn anything on CD                burn anything on CD
220    nf          don't copy files. Use files existing in folder    nf          don't copy files. Use files existing in folder
221                \"/root/tmp/clonezilla-sysresccd\".                \""$SAVE_DIR"/tmp/clonezilla-sysresccd\".
222                *** Caution: Dangerous!!! ***                *** Caution: Dangerous!!! ***
223    i           only create ISO file. Don't burn anything on CD    i           only create ISO file. Don't burn anything on CD
224    b           burn a previously created ISO file    b           burn a previously created ISO file
225      d [folder]  Use [folder]/tmp as temporary and output folder
226                  instead of $HOME/tmp
227    x [script]  A user defined and written BASH script    x [script]  A user defined and written BASH script
228                to be executed just before mastering the CD                to be executed just before mastering the CD
229    v           print version and exit    v           print version and exit
# Line 313  function readConfig(){ Line 315  function readConfig(){
315  }  }
316    
317  ####### Script starts here #######  ####### Script starts here #######
318    SAVE_DIR="$HOME"
319    
320  MKISOFS=genisoimage  MKISOFS=genisoimage
321  onlyBurnISO=0  onlyBurnISO=0
322  onlyCopyFiles=0  onlyCopyFiles=0
# Line 324  profilesExist=0 Line 328  profilesExist=0
328  profilesError=0  profilesError=0
329    
330    
331  while getopts ":asp:bfihvn:x:" Option  while getopts ":asp:bfihvn:x:d:" Option
332  do  do
333   case $Option in   case $Option in
334   a)   a)
# Line 405  do Line 409  do
409    fi    fi
410    noFileCopy=1    noFileCopy=1
411    ;;    ;;
412     d)
413      SAVE_DIR="$OPTARG"
414      if [ ! -d "$SAVE_DIR" ]; then
415        mkdir "$SAVEDIR" 2>/dev/null
416        if [ -d "$SAVE_DIR" ];then
417          echo "Error: \"$SAVE_DIR\" cannot be created!!!"
418          exit 1
419        fi
420      fi
421      ;;
422    
423   esac   esac
424  done  done
425  shift $(($OPTIND - 1))  shift $(($OPTIND - 1))
# Line 433  elif [ $checkInParms -gt 1 ];then Line 448  elif [ $checkInParms -gt 1 ];then
448   exit 1   exit 1
449  fi  fi
450  if [ "$outName" = "" ];then  if [ "$outName" = "" ];then
451   outFile=/root/tmp/clonezilla-sysresccd-"$version".iso   outFile="$SAVE_DIR"/tmp/clonezilla-sysresccd-"$version".iso
452  else  else
453   outFile=/root/tmp/clonezilla-sysresccd-"$outName"-"$version".iso   outFile="$SAVE_DIR"/tmp/clonezilla-sysresccd-"$outName"-"$version".iso
454  fi  fi
455    
456  if [ $onlyBurnISO -eq 0 ];then  if [ $onlyBurnISO -eq 0 ];then
# Line 507  Is this correct? (y/[n]): " Line 522  Is this correct? (y/[n]): "
522    createTempFolders    createTempFolders
523    
524    echo -n "Mounting ISO files...   "    echo -n "Mounting ISO files...   "
525    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'
526    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'
527    echo 'done'    echo 'done'
528    echo -n "Copying files...   "    echo -n "Copying files...   "
529    cp -RL /root/tmp/syscd/* /root/tmp/clonezilla-sysresccd    cp -RL "$SAVE_DIR"/tmp/syscd/* "$SAVE_DIR"/tmp/clonezilla-sysresccd
530    cp -RL /root/tmp/clonecd/* /root/tmp/clonezilla-sysresccd    cp -RL "$SAVE_DIR"/tmp/clonecd/* "$SAVE_DIR"/tmp/clonezilla-sysresccd
531    echo 'done'    echo 'done'
532        
533        
534  #   echo -n "Extracting boot programs...  "  #   echo -n "Extracting boot programs...  "
535    echo "Extracting boot programs...  "    echo "Extracting boot programs...  "
536    cd /root/tmp/clonezilla-sysresccd/bootprog    cd "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootprog
537    mkdir tmp    mkdir tmp
538    cp *zip tmp    cp *zip tmp
539    unzip -x sys*zip win32/syslinux.exe    unzip -x sys*zip win32/syslinux.exe
# Line 533  Is this correct? (y/[n]): " Line 548  Is this correct? (y/[n]): "
548        
549    if [ ! -z "$splash" ];then    if [ ! -z "$splash" ];then
550     echo -n "Copying new spalsh screen...   "     echo -n "Copying new spalsh screen...   "
551     cp -L "$splash" /root/tmp/clonezilla-sysresccd/isolinux/ocswp.png     cp -L "$splash" "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/ocswp.png
552     echo 'done'     echo 'done'
553    else    else
554     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
555    fi    fi
556    
557    echo -n "Copying Super Grub Disk...   "    echo -n "Copying Super Grub Disk...   "
558    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' || {
559      echo      echo
560      echo      echo
561      echo      echo
562      echo "    Error: Copying Super Grub Disk failed!!!"      echo "    Error: Copying Super Grub Disk failed!!!"
563      echo      echo
564      echo "           Please make sure that the image file exists"      echo "           Please make sure that the image file exists"
565      echo "           Image file: /root/tmp/clonezilla-sysresccd/bootdisk/sgd.img"      echo "           Image file: "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/sgd.img"
566      echo      echo
567      echo      echo
568      cleanUp      cleanUp
# Line 555  Is this correct? (y/[n]): " Line 570  Is this correct? (y/[n]): "
570    }    }
571    if [ -e /root/.clonezilla-sysresccd/files/sgd2.img ];then    if [ -e /root/.clonezilla-sysresccd/files/sgd2.img ];then
572     echo -n "Copying Super Grub Disk 2...   "     echo -n "Copying Super Grub Disk 2...   "
573     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' || {
574       echo       echo
575       echo       echo
576       echo       echo
577       echo "    Error: Copying Super Grub Disk 2 failed!!!"       echo "    Error: Copying Super Grub Disk 2 failed!!!"
578       echo       echo
579       echo "           Please make sure that the image file exists"       echo "           Please make sure that the image file exists"
580       echo "           Image file: /root/tmp/clonezilla-sysresccd/bootdisk/sgd2.img"       echo "           Image file: "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk/sgd2.img"
581       echo       echo
582       echo       echo
583       cleanUp       cleanUp
# Line 571  Is this correct? (y/[n]): " Line 586  Is this correct? (y/[n]): "
586    fi    fi
587    echo -n "Copying new cfg file(s)...   "    echo -n "Copying new cfg file(s)...   "
588    if [ -z $(echo "$cfgFile" | grep 'cfg$') ];then    if [ -z $(echo "$cfgFile" | grep 'cfg$') ];then
589      tar -C /root/tmp/clonezilla-sysresccd -xzhf /root/.clonezilla-sysresccd/files/menu-for-iso.tar.gz      tar -C "$SAVE_DIR"/tmp/clonezilla-sysresccd -xzhf /root/.clonezilla-sysresccd/files/menu-for-iso.tar.gz
590    else    else
591      cp -L "$cfgFile" /root/tmp/clonezilla-sysresccd/isolinux/isolinux.cfg      cp -L "$cfgFile" "$SAVE_DIR"/tmp/clonezilla-sysresccd/isolinux/isolinux.cfg
592    fi    fi
593    echo 'done'    echo 'done'
594        
595    echo -n "Creating folder restorecd...   "    echo -n "Creating folder restorecd...   "
596    WHERE="$(pwd)"    WHERE="$(pwd)"
597    mkdir /root/tmp/clonezilla-sysresccd/restorecd 2>/dev/null    mkdir "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd 2>/dev/null
598    cd /root/.clonezilla-sysresccd/files    cd /root/.clonezilla-sysresccd/files
599    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 \
600      isolinux-restore-cd-ram.cfg menu-for-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
601    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
602    cp sbminst /root/tmp/clonezilla-sysresccd/restorecd    cp sbminst "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd
603        
604    # Copy Smart Boot Manager and rawrite-fdimage to bootdisk    # Copy Smart Boot Manager and rawrite-fdimage to bootdisk
605    mkdir /root/tmp/clonezilla-sysresccd/rawrite    mkdir "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite
606    cp  raw* fd* *dll /root/tmp/clonezilla-sysresccd/rawrite    cp  raw* fd* *dll "$SAVE_DIR"/tmp/clonezilla-sysresccd/rawrite
607    cp sbm.img /root/tmp/clonezilla-sysresccd/bootdisk    cp sbm.img "$SAVE_DIR"/tmp/clonezilla-sysresccd/bootdisk
608    cd "$DebianLiveFolder" 2>/dev/null || debFilesError=yes    cd "$DebianLiveFolder" 2>/dev/null || debFilesError=yes
609  #   if [ -s files.tar.gz ];then  #   if [ -s files.tar.gz ];then
610  #     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
611  #   else  #   else
612  #     [ -e "$DebianLiveFolder"/unifont.bgf ] || {  #     [ -e "$DebianLiveFolder"/unifont.bgf ] || {
613  #       uniFontCopied=yes  #       uniFontCopied=yes
614  #       cp -L /root/.clonezilla-sysresccd/files/unifont.bgf "$DebianLiveFolder"  #       cp -L /root/.clonezilla-sysresccd/files/unifont.bgf "$DebianLiveFolder"
615  #     }  #     }
616  #     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
617  #     [ -z "$uniFontCopied" ] || rm "$DebianLiveFolder"/unifont.bgf  #     [ -z "$uniFontCopied" ] || rm "$DebianLiveFolder"/unifont.bgf
618  #   fi  #   fi
619  #   [ -z "$debFilesError" ] || {  #   [ -z "$debFilesError" ] || {
# Line 621  Is this correct? (y/[n]): " Line 636  Is this correct? (y/[n]): "
636    echo "done"    echo "done"
637    
638    echo -n "Copying documentation files...   "    echo -n "Copying documentation files...   "
639    cd /root/tmp/clonezilla-sysresccd    cd "$SAVE_DIR"/tmp/clonezilla-sysresccd
640    tar xzhf /root/tmp/clonezilla-sysresccd/restorecd/doc.tar.gz    tar xzhf "$SAVE_DIR"/tmp/clonezilla-sysresccd/restorecd/doc.tar.gz
641    echo 'done'    echo 'done'
642    
643    if [ ! -z "$exScript" ];then    if [ ! -z "$exScript" ];then
# Line 647  Is this correct? (y/[n]): " Line 662  Is this correct? (y/[n]): "
662   else   else
663    trap cleanUp 2    trap cleanUp 2
664    cleanUpValue=1    cleanUpValue=1
665    if [ ! -d  /root/tmp/clonezilla-sysresccd ];then    if [ ! -d  "$SAVE_DIR"/tmp/clonezilla-sysresccd ];then
666     echo "    Error accessing folder \"/root/tmp/clonezilla-sysresccd\""     echo "    Error accessing folder \""$SAVE_DIR"/tmp/clonezilla-sysresccd\""
667     exitStatus=1     exitStatus=1
668     cleanUp     cleanUp
669    fi    fi
670   fi   fi
671    
672   # move extra folders into utils   # move extra folders into utils
673   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
674   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
675    
676  #  #
677  # re-build clonezilla filesystem.squashfs  # re-build clonezilla filesystem.squashfs
678  #  #
679  echo -n "Rebuilding Clonezilla squashfs...   "  echo -n "Rebuilding Clonezilla squashfs...   "
680  cd /root/tmp/clonezilla-sysresccd/live  cd "$SAVE_DIR"/tmp/clonezilla-sysresccd/live
681  unsquashfs filesystem.squashfs 2>/dev/null 1>&2  unsquashfs filesystem.squashfs 2>/dev/null 1>&2
682  cp -r ../README* ../doc ../restorecd squashfs-root  cp -r ../README* ../doc ../restorecd squashfs-root
683  mksquashfs squashfs-root aa.squashfs -always-use-fragments -no-duplicates -all-root 2>/dev/null 1>&2  mksquashfs squashfs-root aa.squashfs -always-use-fragments -no-duplicates -all-root 2>/dev/null 1>&2
# Line 675  echo 'done' Line 690  echo 'done'
690    cleanUpValue=1    cleanUpValue=1
691  #   echo  #   echo
692  #   echo  #   echo
693    echo "Both CDs have been copyied in: /root/tmp/clonezilla-sysresccd"    echo "Both CDs have been copyied in: "$SAVE_DIR"/tmp/clonezilla-sysresccd"
694    cleanUp    cleanUp
695   fi   fi
696   echo   echo
# Line 685  if [ -z "$auto" ]; then Line 700  if [ -z "$auto" ]; then
700  ************************************************************************  ************************************************************************
701     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
702     in the CD, now is the right time.     in the CD, now is the right time.
703        CD root is \"/root/tmp/clonezilla-sysresccd\"        CD root is \""$SAVE_DIR"/tmp/clonezilla-sysresccd\"
704    
705     When you are done     When you are done
706  ***********************************************************************  ***********************************************************************
# Line 695  Press ENTER to continue...   " Line 710  Press ENTER to continue...   "
710  else  else
711    echo "Creating new ISO file."    echo "Creating new ISO file."
712  fi  fi
713    find /root/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';'    find "$SAVE_DIR"/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';'
714  #    $MKISOFS -quiet -f -r -J -o "$outFile" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -iso-level 3 -joliet-long -input-charset utf-8 -output-charset utf-8 -V "$volLabel" -publisher "$publisher" -p "$preparerID" /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
715     $MKISOFS -quiet -f -r -J -o "$outFile" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V "$volLabel" -publisher "$publisher" -p "$preparerID" /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
716    echo "    echo "
717  Done creating new ISO file  Done creating new ISO file
718  The file is saved as $outFile"  The file is saved as $outFile"

Legend:
Removed from v.93  
changed lines
  Added in v.140

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26