Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- PATH=/bin:/usr/bin:/sbin:/usr/sbin
- export PATH
- if [ -z "$*" ]; then
- echo `basename $0 [dvd1 img] [dvd1 dir] [memstick img] [memstick dir]`
- echo ' [dvd1 img] is the dvd1 image to convert'
- echo ' [dvd1 dir] is the mountpoint for the dvd1 image'
- echo ' [memstick img] is name of the memstick image file to create'
- echo ' [memstick dir] is temporary working directory for the memstick contents'
- exit 1
- fi
- if [ ! -f $1 ]; then
- echo "Source dvd1 image does not exist."
- exit 1
- fi
- if [ ! -d $2 ]; then
- echo "Mountpoint must be a directory."
- exit 1
- fi
- if [ -e $3 ]; then
- echo "Memstick file already exists."
- exit 1
- fi
- if [ ! -d $4 ]; then
- echo "Memstick directory does not exist or is not a directory."
- exit 1
- fi
- unit=`mdconfig -a -t vnode -f $1`
- if [ $? -ne 0 ]; then
- echo "dvd1 image mdconfig failed"
- exit 1
- fi
- mount_cd9660 /dev/$unit $2
- tar cf - -C $2 . | tar xpf - -C $4
- umount $2
- if [ $? -eq 0 ]; then
- mdconfig -d -u $unit
- else
- echo "Did not unmount dvd1."
- fi
- echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > $4/etc/fstab
- makefs -B little -o label=FreeBSD_Install $3 $4
- if [ $? -ne 0 ]; then
- echo "makefs failed"
- exit 1
- fi
- unit=`mdconfig -a -t vnode -f $3`
- if [ $? -ne 0 ]; then
- echo "mdconfig failed"
- exit 1
- fi
- gpart create -s BSD $unit
- gpart bootcode -b $4/boot/boot $unit
- gpart add -t freebsd-ufs $unit
- mdconfig -d -u $unit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement