Restoring a Zen image from a Bootable DVD

From MicroFocusInternationalWiki
Jump to: navigation, search

Not sure if anyone has a better way to do this but........

Scenario : I want to deploy zmg images using a bootable dvd but give the user the option to restore from the dvd or a connected usb disk. This script tries to mount one.

#!/bin/sh
# usb.s
# cgerke 19th September 2006
# mount the usb device
unset USB
usbdisk=`hwinfo --usb | grep "/dev/" | sed -n 1p | awk '{print $3}'`
mounted=`mount | grep $usbdisk | wc -l`

if [ $mounted = "1" ]; then
 echo "USB Device mounted"
 export USB=YES;
else
 devs="${usbdisk}1 ${usbdisk}2 ${usbdisk3} ${usbdisk4} ${usbdisk5} ${usbdisk6}"
 /bin/mkdir -p /mnt/usbhd
 for usb in ${devs[@]}
 do
  /bin/mount -t vfat $usb /mnt/usbhd > /dev/null 2>&1
  if [ $? = "32" ]; then
   echo "Checking for usb device..."
  else
   echo "Mounting usb to /mnt/usbhd"
   export USB=YES;
   break;
  fi
 done
fi

if [ ! $USB ]; then 
	echo "Unable to mount USB DISK, check if you have a DISK ATTACHED and reboot." 
fi

--Cgerke1979 23:19, 18 September 2006 (MDT)