Skip to main content

Thread: bash live cd customisation script


could me bash script please? it's edit live cds, i'm not sure what's happening: it's saying ~/livecdtmp/mnt/live/filesystem.squashfs not exist, though definately does.
here's script:
code:
#!/bin/bash  #this live cd customiser  #all changes done in command line  #the live cd similar original, unlike things remastersys, multiboots easier make it.  #this takes 1 argument, file name. if argument not given, it'll ask file name  #to do: add x support  #possible gui? zenity/kdialog?    #check root  if [ "$(whoami)" != "root" ];  echo "please run root. press key continue."  read -n 1 uselessvar  exit  fi    #check needed tools  if [ -z "$(which rsync)" ];  echo "please install rsync continue. press key continue."  read -n 1 uselessvar  exit  fi  if [ -z "$(which unsquashfs)" ];  echo "please install unsquashfs (might called squashfs tools) continue. press key continue."  read -n 1 uselessvar  exit  fi  if [ -z "$(which sed)" ];  echo "please install sed continue. press key continue."  read -n 1 uselessvar  exit  fi  if [ -z "$(which mksquashfs)" ];  echo "please install mksquashfs (the squashfs tools) continue. press key continue."  read -n 1 uselessvar  exit  fi  if [ -z "$(which mkisofs)" ];  echo "please install mkisofs (the genisoimage tools) continue. press key continue."  read -n 1 uselessvar  exit  fi    #check filename  #set checker variable one. used control while loop.  checker=1    while [ "$checker" = "1" ];      if [ -e "$1" ];        cdpath="$1"      else        echo -n "please enter full path, including filename, of cd want edit: "        read cdpath      fi      if [ -f "$cdpath" ];        checker="0"      fi    done  #that checks argument, if it's not there,it asks path, checks see if it's regular file, , if is, lets out of loop.    #do pre-customisation settings  mkdir ~/livecdtmp  cp "$cdpath" ~/livecdtmp  mkdir ~/livecdtmp/mnt  mount -o loop "$cdpath" ~/livecdtmp/mnt    echo -n "please type path squashfs filesystem without including ~/livecdtmp/mnt/: "  read squashfs    mkdir ~/livecdtmp/extract-cd  rsync -exclude="/$squashfs" -a ~/livecdtmp/mnt ~/livecdtmp/extract-cd  unsquashfs "~/livecdtmp/mnt/$squashfs"  mv ~/livecdtmp/squashfs-root ~/livecdtmp/edit    #add networking files  cp /etc/resolv.conf ~/livecdtmp/edit/etc/  cp /etc/hosts ~/livecdtmp/edit/etc/    #add mount points  mount --bind /dev/ ~/livecdtmp/edit/dev  chroot ~/livecd/edit mount -t proc none /proc  chroot ~/livecd/edit mount -t sysfs none /sys  chroot ~/livecd/edit mount -t devpts none /dev/pts    #enter chroot  chroot ~/livecd/edit    #do in-chroot cleanups  chroot ~/livecd/edit rm /etc/hosts  chroot ~/livecd/edit rm /etc/resolv.conf  chroot ~/livecd/edit umount /proc || umount -lf /proc  chroot ~/livecd/edit umount /sys  chroot ~/livecd/edit umount /dev/pts    #post-chroot unmounting  umount /edit/dev    #producing cd image  mkdir ~/livecd  rm "~/livecdtmp/extract-cd/$squashfs"  mksquashfs "~/livecdtmp/edit" "~/livecdtmp/extract-cd/$squashfs"    checker="1"  while [ "$checker" = "1" ];  echo -n "please type full path isolinux.bin file: "  read isolinuxbin  if [ -f "$isolinuxbin" ];  checker="0"  fi  done  checker="1"  while [ "$checker" = "1" ];  echo -n "please type full path boot.cat file: "  read bootcat  if [ -f "$bootcat" ];  checker="0"  fi  done    sudo mkisofs -d -r -v "~/livecd/custom_distro.iso" -cache-inodes -j -l -b "$isolinuxbin" -c "$bootcat" -no-emul-boot -boot-load-size  4 -boot-info-table -o "~/livecd/custom_distro.iso" .  umount ~/livecdtmp/mnt  rm -r ~/livecdtmp  echo "the file should in ~/livecd/custom_distro.iso"

guys, warning: since won't chroot, deletes /proc filesystem. can correct this?


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [all variants] bash live cd customisation script


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support