]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - release/powerpc/make-memstick.sh
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / release / powerpc / make-memstick.sh
1 #!/bin/sh
2 #
3 # This script generates a "memstick image" (image that can be copied to a
4 # USB memory stick) from a directory tree.  Note that the script does not
5 # clean up after itself very well for error conditions on purpose so the
6 # problem can be diagnosed (full filesystem most likely but ...).
7 #
8 # Usage: make-memstick.sh <directory tree> <image filename>
9 #
10 # $FreeBSD$
11 #
12
13 PATH=/bin:/usr/bin:/sbin:/usr/sbin
14 export PATH
15
16 BLOCKSIZE=10240
17
18 if [ $# -ne 2 ]; then
19   echo "make-memstick.sh /path/to/directory /path/to/image/file"
20   exit 1
21 fi
22
23 tempfile="${2}.$$"
24
25 if [ ! -d ${1} ]; then
26   echo "${1} must be a directory"
27   exit 1
28 fi
29
30 if [ -e ${2} ]; then
31   echo "won't overwrite ${2}"
32   exit 1
33 fi
34
35 echo '/dev/da0s3 / ufs ro,noatime 1 1' > ${1}/etc/fstab
36 rm -f ${tempfile}
37 makefs -B big ${tempfile} ${1}
38 if [ $? -ne 0 ]; then
39   echo "makefs failed"
40   exit 1
41 fi
42 rm ${1}/etc/fstab
43
44 mkimg -s apm -p freebsd-boot:=${1}/boot/boot1.hfs -p freebsd-ufs/FreeBSD_Install:=${tempfile} -o ${2}
45
46 rm -f ${tempfile}
47