]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - release/i386/make-memstick.sh
bluetooth: Fix a mandoc related issues
[FreeBSD/FreeBSD.git] / release / i386 / 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 set -e
14
15 PATH=/bin:/usr/bin:/sbin:/usr/sbin
16 export PATH
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 if [ ! -d ${1} ]; then
24         echo "${1} must be a directory"
25         exit 1
26 fi
27
28 if [ -e ${2} ]; then
29         echo "won't overwrite ${2}"
30         exit 1
31 fi
32
33 echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab
34 echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local
35 makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1}
36 rm ${1}/etc/fstab
37 rm ${1}/etc/rc.conf.local
38
39 mkimg -s mbr \
40     -b ${1}/boot/mbr \
41     -p freebsd:-"mkimg -s bsd -b ${1}/boot/boot -p freebsd-ufs:=${2}.part" \
42     -o ${2}
43 rm ${2}.part
44