/[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 58 by sng, Tue May 25 09:02:17 2010 UTC revision 93 by sng, Fri Aug 13 08:30:37 2010 UTC
# Line 24  exit 1 Line 24  exit 1
24  }  }
25    
26  function getScript(){  function getScript(){
27    if [ -n "$auto" ];then return;fi
28  echo 'Insert script to be executed'  echo 'Insert script to be executed'
29   echo -n '> '   echo -n '> '
30   read exScript   read exScript
# Line 151  exit 1 Line 152  exit 1
152  }  }
153    
154  function errorISO(){  function errorISO(){
155  echo "   Error creating the new ISO file: /root/tmp/output.iso"  echo "   Error creating new ISO file: /root/tmp/output.iso"
156  rm /root/tmp/clonezilla-sysresccd-"$outName""$version".iso 2>/dev/null  rm /root/tmp/clonezilla-sysresccd-"$outName""$version".iso 2>/dev/null
157  cleanUp  cleanUp
158  exit 1  exit 1
# Line 210  A utility to create a multi boot CD cont Line 211  A utility to create a multi boot CD cont
211    
212  Usage: $(basename $0) [options]  Usage: $(basename $0) [options]
213  Available options are:  Available options are:
214      a           run in auto mode (no confirmation, assume yes to
215                  all questions asked, no ISO burning to disk)
216    s           show profiles and let user select profile to use    s           show profiles and let user select profile to use
217    p [number]  use profile number    p [number]  use profile number
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
# Line 310  function readConfig(){ Line 313  function readConfig(){
313  }  }
314    
315  ####### Script starts here #######  ####### Script starts here #######
316    MKISOFS=genisoimage
317  onlyBurnISO=0  onlyBurnISO=0
318  onlyCopyFiles=0  onlyCopyFiles=0
319  onlyCreateISO=0  onlyCreateISO=0
# Line 320  profilesExist=0 Line 324  profilesExist=0
324  profilesError=0  profilesError=0
325    
326    
327  while getopts ":sp:bfihvn:x:" Option  while getopts ":asp:bfihvn:x:" Option
328  do  do
329   case $Option in   case $Option in
330     a)
331      auto=yes
332            ;;
333   s)   s)
334    readConfig    readConfig
335    sourceProfiles    sourceProfiles
# Line 353  do Line 360  do
360    if [ $profilesExist -eq 1 ];then    if [ $profilesExist -eq 1 ];then
361     if $(isnumber "$OPTARG");then     if $(isnumber "$OPTARG");then
362      applyProfile $OPTARG      applyProfile $OPTARG
363                    usingProfile=yes
364     else     else
365      echo "    Error in parameter: -p $OPTARG"      echo "    Error in parameter: -p $OPTARG"
366      exit 1      exit 1
# Line 402  done Line 410  done
410  shift $(($OPTIND - 1))  shift $(($OPTIND - 1))
411    
412  test "$(whoami)" = "root" || noRoot  test "$(whoami)" = "root" || noRoot
413    
414    # chack auto mode
415    if [ -n "$auto" ];then
416      if [ -z "$usingProfile" ];then
417        echo '  Error: Parameter -a used without -p'
418                    exit 1
419            fi
420      if [ "$onlyBurnISO" -eq 1 ];then
421        echo "  Error: Conflicting parameters -a and -b used"
422                    exit 1
423            fi
424    fi
425    
426  # Check input parameters  # Check input parameters
427  checkInParms=0  checkInParms=0
428  checkInParms=$(( onlyBurnISO + onlyCreateISO + onlyCopyFiles + noFileCopy ))  checkInParms=$(( onlyBurnISO + onlyCreateISO + onlyCopyFiles + noFileCopy ))
# Line 435  if [ $onlyBurnISO -eq 0 ];then Line 456  if [ $onlyBurnISO -eq 0 ];then
456  #    #  
457  # Is this correct? (y/[n]): "  # Is this correct? (y/[n]): "
458    
459    if [ -n "$auto" ]; then
460    ans=y
461    else
462    echo -n "Current settings:    echo -n "Current settings:
463       System Rescue CD: $sysCD       System Rescue CD: $sysCD
464       Clonezilla Live CD: $cloneCD       Clonezilla Live CD: $cloneCD
# Line 443  if [ $onlyBurnISO -eq 0 ];then Line 467  if [ $onlyBurnISO -eq 0 ];then
467        
468  Is this correct? (y/[n]): "  Is this correct? (y/[n]): "
469        
470     read ans         read ans
471        fi
472     if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then     if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then
473      sysCD=''      sysCD=''
474      cloneCD=''      cloneCD=''
# Line 455  Is this correct? (y/[n]): " Line 480  Is this correct? (y/[n]): "
480     test -z "$preparerID" && getPreparer     test -z "$preparerID" && getPreparer
481     test -z "$publisher" && getPublisher     test -z "$publisher" && getPublisher
482     test -z "$volLabel" && getvolLabel     test -z "$volLabel" && getvolLabel
483     clear  
484        if [ -n "$auto" ]; then
485          ans=y
486        else
487                    clear
488    echo -n "Current CD info:    echo -n "Current CD info:
489       Preparer: $preparerID       Preparer: $preparerID
490       Publisher: $publisher       Publisher: $publisher
491       Volume label: $volLabel       Volume label: $volLabel
492    
493  Is this correct? (y/[n]): "  Is this correct? (y/[n]): "
494     read ans         read ans
495        fi
496     if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then     if [ "$ans" = "n" ] || [ "$ans" = "N" ] || [ "$ans" = "" ];then
497      preparerID=''      preparerID=''
498      publisher=''      publisher=''
# Line 541  Is this correct? (y/[n]): " Line 571  Is this correct? (y/[n]): "
571    fi    fi
572    echo -n "Copying new cfg file(s)...   "    echo -n "Copying new cfg file(s)...   "
573    if [ -z $(echo "$cfgFile" | grep 'cfg$') ];then    if [ -z $(echo "$cfgFile" | grep 'cfg$') ];then
574      tar -C /root/tmp/clonezilla-sysresccd -xzhf /root/.clonezilla-sysresccd/files/menu-iso.tar.gz      tar -C /root/tmp/clonezilla-sysresccd -xzhf /root/.clonezilla-sysresccd/files/menu-for-iso.tar.gz
575    else    else
576      cp -L "$cfgFile" /root/tmp/clonezilla-sysresccd/isolinux/isolinux.cfg      cp -L "$cfgFile" /root/tmp/clonezilla-sysresccd/isolinux/isolinux.cfg
577    fi    fi
# Line 551  Is this correct? (y/[n]): " Line 581  Is this correct? (y/[n]): "
581    WHERE="$(pwd)"    WHERE="$(pwd)"
582    mkdir /root/tmp/clonezilla-sysresccd/restorecd 2>/dev/null    mkdir /root/tmp/clonezilla-sysresccd/restorecd 2>/dev/null
583    cd /root/.clonezilla-sysresccd/files    cd /root/.clonezilla-sysresccd/files
584    cp -L pre* ocs-iso what-cd continue-multi-cd isolinux-restore-cd.cfg \    cp -L pre* ocs-iso what-cd patch-clonezilla-sysresccd continue-multi-cd isolinux-restore-cd.cfg \
585      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 /root/tmp/clonezilla-sysresccd/restorecd
586    cp -L default-restore-ocswp.png /root/tmp/clonezilla-sysresccd/restorecd/ocswp.png    cp -L default-restore-ocswp.png /root/tmp/clonezilla-sysresccd/restorecd/ocswp.png
587    cp sbminst /root/tmp/clonezilla-sysresccd/restorecd    cp sbminst /root/tmp/clonezilla-sysresccd/restorecd
588        
# Line 609  Is this correct? (y/[n]): " Line 639  Is this correct? (y/[n]): "
639      cleanUp      cleanUp
640      exit 1      exit 1
641     }     }
   fi  
642    echo 'done'    echo 'done'
643      fi
644  #   echo  #   echo
645  #   echo  #   echo
646  #   echo  #   echo
# Line 628  Is this correct? (y/[n]): " Line 658  Is this correct? (y/[n]): "
658   mv /root/tmp/clonezilla-sysresccd/rawrite /root/tmp/clonezilla-sysresccd/bootprog /root/tmp/clonezilla-sysresccd/utils   mv /root/tmp/clonezilla-sysresccd/rawrite /root/tmp/clonezilla-sysresccd/bootprog /root/tmp/clonezilla-sysresccd/utils
659   mv /root/tmp/clonezilla-sysresccd/version /root/tmp/clonezilla-sysresccd/SystemRescueCD-Version   mv /root/tmp/clonezilla-sysresccd/version /root/tmp/clonezilla-sysresccd/SystemRescueCD-Version
660    
661    #
662    # re-build clonezilla filesystem.squashfs
663    #
664    echo -n "Rebuilding Clonezilla squashfs...   "
665    cd /root/tmp/clonezilla-sysresccd/live
666    unsquashfs filesystem.squashfs 2>/dev/null 1>&2
667    cp -r ../README* ../doc ../restorecd squashfs-root
668    mksquashfs squashfs-root aa.squashfs -always-use-fragments -no-duplicates -all-root 2>/dev/null 1>&2
669    mv aa.squashfs filesystem.squashfs
670    rm -rf squashfs-root
671    cd
672    echo 'done'
673    
674   if [ $onlyCopyFiles -eq 1 ];then   if [ $onlyCopyFiles -eq 1 ];then
675    cleanUpValue=1    cleanUpValue=1
676  #   echo  #   echo
# Line 636  Is this correct? (y/[n]): " Line 679  Is this correct? (y/[n]): "
679    cleanUp    cleanUp
680   fi   fi
681   echo   echo
682   echo -n "Ready to create the new ISO file.  if [ -z "$auto" ]; then
683     echo -n "Ready to create new ISO file.
684    
685  ************************************************************************  ************************************************************************
686     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
# Line 648  Is this correct? (y/[n]): " Line 692  Is this correct? (y/[n]): "
692    
693  Press ENTER to continue...   "  Press ENTER to continue...   "
694    read    read
695    else
696      echo "Creating new ISO file."
697    fi
698    find /root/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';'    find /root/tmp/clonezilla-sysresccd -name "*~" -exec rm '{}' ';'
699  #   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" /root/tmp/clonezilla-sysresccd || errorISO
700    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" /root/tmp/clonezilla-sysresccd || errorISO
701    echo "    echo "
702  Done creating new ISO file  Done creating new ISO file
703  The file is saved as $outFile"  The file is saved as $outFile"
# Line 662  if [ -n "$chIsoHyb" ];then Line 709  if [ -n "$chIsoHyb" ];then
709    echo 'done'    echo 'done'
710  fi  fi
711    
712    if [ -z "$auto" ];then
713  echo '  echo '
714    
715  '  '
716    fi
717  else  else
718   while [ ! -r "$outFile" ];do   while [ ! -r "$outFile" ];do
719    echo 'Insert "clonezilla-resccd" ISO file name'    echo 'Insert "clonezilla-resccd" ISO file name'
# Line 680  if [ $onlyCreateISO -eq 1 ];then ans=n;f Line 728  if [ $onlyCreateISO -eq 1 ];then ans=n;f
728  while [ 1 ];do  while [ 1 ];do
729   if [ "$ans" = "" ];then ans=y;fi   if [ "$ans" = "" ];then ans=y;fi
730   if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "n" ] || [ "$ans" = "N" ];then break;fi   if [ "$ans" = "y" ] || [ "$ans" = "Y" ] || [ "$ans" = "n" ] || [ "$ans" = "N" ];then break;fi
731   echo -n "Do you want to burn this ISO file? ([y]/n): "   if [ -n "$auto" ]; then
732   read ans     ans=n
733     else
734       echo -n "Do you want to burn this ISO file? ([y]/n): "
735        read ans
736     fi
737  done  done
738  burnISO=0  burnISO=0
739  if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then  if [ "$ans" = "y" ] || [ "$ans" = "Y" ];then

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26