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

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

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

revision 63 by sng, Wed May 26 20:30:21 2010 UTC revision 103 by sng, Wed Aug 25 11:40:55 2010 UTC
# Line 85  done Line 85  done
85  }  }
86    
87  function isClonezillaSysRescCDRunning(){  function isClonezillaSysRescCDRunning(){
88  if [ -e /live/image/README.txt ] || [ -e /mnt/livecd/README.txt ];then  if [ -e /live/image/restorecd/what-cd ] || [ -e /restorecd/what-cd ];then
89    ClonezillaSysRescCDRunning='y'    ClonezillaSysRescCDRunning='y'
90  fi  fi
91  }  }
# Line 95  function cleanUp(){ Line 95  function cleanUp(){
95  cd  cd
96  echo -n "Cleanning up...   "  echo -n "Cleanning up...   "
97  [ -z "$inputFileMounted" ] || umount "$mountPoint" 2>/dev/null  [ -z "$inputFileMounted" ] || umount "$mountPoint" 2>/dev/null
 [ -z "$mountPointCreated" ] || rmdir "$mountPoint" 2>/dev/null  
98  [ -z "$savePartitionMounted" ] || umount "$savePartition" 2>/dev/null  [ -z "$savePartitionMounted" ] || umount "$savePartition" 2>/dev/null
99    [ -z "$mountPointCreated" ] || rmdir "$mountPoint" 2>/dev/null
100  [ -z "$newIsoCreated" ] || {  [ -z "$newIsoCreated" ] || {
101    [ -z "$keepFiles" ] && rm -rf "$savePartitionMountPoint"/new-iso 2>/dev/null    [ -z "$keepFiles" ] && rm -rf "$savePartitionMountPoint"/new-iso 2>/dev/null
102  }  }
# Line 143  fi Line 143  fi
143  #                                                                            #  #                                                                            #
144  ##############################################################################  ##############################################################################
145  if [ -z "$workingFromCD" ];then  if [ -z "$workingFromCD" ];then
146      genisoimage --version >/dev/null 2>&1 && MKISO=genisoimage || MKISO=mkisofs
147    savePartitionMountPoint=/root/tmp/savePartition.$$    savePartitionMountPoint=/root/tmp/savePartition.$$
148  else  else
149      MKISO=genisoimage
150    savePartitionMountPoint=/savePartition.$$    savePartitionMountPoint=/savePartition.$$
151  fi  fi
152  mkdir -p "$savePartitionMountPoint" 2>/dev/null && savePartitionMountPointCreated='y' || {  mkdir -p "$savePartitionMountPoint" 2>/dev/null && savePartitionMountPointCreated='y' || {
# Line 174  if [ -z "$savePartitionMounted" ];then Line 176  if [ -z "$savePartitionMounted" ];then
176  fi  fi
177  # is it writeable?  # is it writeable?
178    rm -rf "$savePartitionMountPoint"/new-iso 2>/dev/null    rm -rf "$savePartitionMountPoint"/new-iso 2>/dev/null
179          mkdir "$savePartitionMountPoint"/new-iso 2>/dev/null || {          mkdir "$savePartitionMountPoint"/new-iso 2>/dev/null && newIsoCreated='y' || {
180      echo      echo
181            echo "    Error: Partition $savePartition is mounted read-only"            echo "    Error: Partition $savePartition is mounted read-only"
182                  exit 1                  exit 1
# Line 187  echo "done" Line 189  echo "done"
189    
190  ####### Script starts here #######  ####### Script starts here #######
191    
 # set -x  
192  while getopts ":i:o:s:r:t:fp:bdwnvhl:k:" Option  while getopts ":i:o:s:r:t:fp:bdwnvhl:k:" Option
193  do  do
194   case $Option in   case $Option in
# Line 201  do Line 202  do
202    ;;    ;;
203   i) # input file or cdrom device   i) # input file or cdrom device
204      test "$(whoami)" = "root" || noRoot      test "$(whoami)" = "root" || noRoot
205      [ -s "$OPTARG" ] || {      [ -e "$OPTARG" ] || {
206        echo "    Error: The specified file \"$OPTARG\" cannot be found"        echo "    Error: The specified file \"$OPTARG\" cannot be found"
207        exit 1        exit 1
208      }      }
# Line 244  do Line 245  do
245        exit 1        exit 1
246      fi      fi
247      if [ -z "$(fdisk -l "$OPTARG" 2>/dev/null)" ];then      if [ -z "$(fdisk -l "$OPTARG" 2>/dev/null)" ];then
248        echo "    Error: Parameter -c (storage partition) is not a a valid partition"        echo "    Error: Parameter -p (storage partition) is not a a valid partition"
249        exit 1        exit 1
250      fi      fi
251      savePartition="$OPTARG"      savePartition="$OPTARG"
# Line 332  test "$(whoami)" = "root" || noRoot Line 333  test "$(whoami)" = "root" || noRoot
333  #   echo "    Error: Parameter -t (boot screen title) not specified!!!"  #   echo "    Error: Parameter -t (boot screen title) not specified!!!"
334  #   exit 1  #   exit 1
335  # }  # }
   
336  [ -z "$outputFile" ] && {  [ -z "$outputFile" ] && {
337    outputFile=$(basename "$0").$$.iso    outputFile=$(basename "$0").$$.iso
338    burnISO='y'    burnISO='y'
# Line 344  test "$(whoami)" = "root" || noRoot Line 344  test "$(whoami)" = "root" || noRoot
344    exit 1    exit 1
345  }  }
346    
347  [ -n "$burnISO" ] || {  [ -n "$burnISO" ] && {
348    [ -z "$cdWritter" ] && {    [ -z "$cdWritter" ] && {
349      WHAT_CD=$(which what-cd)      WHAT_CD=$(which what-cd)
350      [ -z "$WHAT_CD" ] && {      [ -z "$WHAT_CD" ] && {
# Line 363  test "$(whoami)" = "root" || noRoot Line 363  test "$(whoami)" = "root" || noRoot
363      }      }
364    }    }
365  }  }
   
366  printVersion  printVersion
367    
368  echo -n "Mounting files...   "  echo -n "Mounting files...   "
# Line 421  if [ -n "$(mount | grep "$savePartition" Line 420  if [ -n "$(mount | grep "$savePartition"
420          # can i write to it?          # can i write to it?
421    savePartitionMountPoint=$(mount | grep "$savePartition" | sed "s|"$savePartition" on \(.*\) type .*)|\1|")    savePartitionMountPoint=$(mount | grep "$savePartition" | sed "s|"$savePartition" on \(.*\) type .*)|\1|")
422          rm -rf "$savePartitionMountPoint"/new-iso 2>/dev/null          rm -rf "$savePartitionMountPoint"/new-iso 2>/dev/null
423          mkdir "$savePartitionMountPoint"/new-iso 2>/dev/null || {          mkdir "$savePartitionMountPoint"/new-iso 2>/dev/null && newIsoCreated='y' || {
424      echo      echo
425            echo "    Error: Partition $savePartition is already mounted read-only"            echo "    Error: Partition $savePartition is already mounted read-only"
426                  exit 1                  exit 1
# Line 441  fi Line 440  fi
440    
441  echo -n "Copying files...   "  echo -n "Copying files...   "
442    
443    
444    if [ -z "$workingFromCD" ];then
445    
446  cp -r "$mountPoint"/* "$savePartitionMountPoint"/new-iso 2>/dev/null && {  cp -r "$mountPoint"/* "$savePartitionMountPoint"/new-iso 2>/dev/null && {
447    echo "done"    echo "done"
448  } || {  } || {
# Line 451  cp -r "$mountPoint"/* "$savePartitionMou Line 453  cp -r "$mountPoint"/* "$savePartitionMou
453  }  }
454    
455    
456    else
457    
458    for n in "$mountPoint"/*;do
459    if [ "$n" != "$savePartitionMountPoint" ] && [ "$n" != "/proc" \ && [ "$n" != "/sys" ];then
460      cp -r "mountPoint"/"$n" "$savePartitionMountPoint"/new-iso 2>/dev/null || {
461        echo "failed"
462        echo
463        cleanUp
464        exit 1
465      }
466    fi
467    done
468    fi
469    
470  echo -n "Installing new files...   "  echo -n "Installing new files...   "
471  if [ ! -z "$mainTitle" ];then  if [ ! -z "$mainTitle" ];then
472    for n in $(find "$savePartitionMountPoint"/new-iso -iname "*.cfg");do    for n in $(find "$savePartitionMountPoint"/new-iso -iname "*.cfg");do
473      sed "0,/^MENU TITLE.*/s//MENU TITLE $mainTitle/" "$n"  > "$n".$$      sed "s/^MENU TITLE  *Clonezilla-SysRescCD .*$/MENU TITLE $mainTitle/" "$n"  > "$n".$$
474      mv "$n".$$ "$n"      mv "$n".$$ "$n"
475    done    done
476  fi  fi
477  if [ -e "$mainSplash" ];then  if [ -e "$mainSplash" ];then
478    cp "$mainSplash" "$savePartitionMountPoint"/new-iso/isolinux/ocswp.png    cp "$mainSplash" "$savePartitionMountPoint"/new-iso/isolinux/ocswp.png
479      cp "$mainSplash" "$savePartitionMountPoint"/new-iso/syslinux/ocswp.png
480    if [ -e "$restoreSplash" ];then    if [ -e "$restoreSplash" ];then
481      cp "$restoreSplash" "$savePartitionMountPoint"/new-iso/restorecd/default-restore-ocswp.png      cp "$restoreSplash" "$savePartitionMountPoint"/new-iso/restorecd/default-restore-ocswp.png
482      cp "$restoreSplash" "$savePartitionMountPoint"/new-iso/restorecd/ocswp.png      cp "$restoreSplash" "$savePartitionMountPoint"/new-iso/restorecd/ocswp.png
# Line 485  if [ ! -z "$theKeymap" ];then Line 502  if [ ! -z "$theKeymap" ];then
502    done    done
503  fi  fi
504    
505  tar czf menu-iso.tar.gz $(find . -iname "*.cfg")  tar czf menu-for-iso.tar.gz $(find . -iname "*.cfg")
506  mv menu-iso.tar.gz restorecd  mv menu-for-iso.tar.gz restorecd
507  echo "done"  echo "done"
508    
509  [ -z "$keepFiles" ] || {  [ -z "$keepFiles" ] || {
# Line 502  echo -n "Press ENTER to create the ISO f Line 519  echo -n "Press ENTER to create the ISO f
519  read  read
520    
521  outputFile="$savePartitionMountPoint"/"$outputFile"  outputFile="$savePartitionMountPoint"/"$outputFile"
522    genisoimage --version >/dev/null 2>&1 && MKISO=genisoimage || MKISO=mkisofs
523  mkisofs -r -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat \  $MKISO -r -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat \
524  -no-emul-boot -boot-load-size 4 -boot-info-table \  -no-emul-boot -boot-load-size 4 -boot-info-table \
525  "$savePartitionMountPoint"/new-iso \  "$savePartitionMountPoint"/new-iso \
526  | \  | \
# Line 540  mkisofs -r -J -l -b isolinux/isolinux.bi Line 557  mkisofs -r -J -l -b isolinux/isolinux.bi
557        fi        fi
558        [ -z "$deleteISO" ] && {        [ -z "$deleteISO" ] && {
559          echo          echo
560            echo -n "Looking for iohybrid executable...   "
561            chIsoHyb=`type isohybrid 2>/dev/null`
562            if [ -n "$chIsoHyb" ];then
563                                      echo found
564              echo -n "Isohybriding  $outFile...  "
565              isohybrid "$outputFile"
566              echo 'done'
567                                    else
568                                      echo not found
569            fi
570          echo "ISO file: \"$outputFile\""          echo "ISO file: \"$outputFile\""
571        };;        };;
572     esac     esac

Legend:
Removed from v.63  
changed lines
  Added in v.103

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26