Changeset View
Changeset View
Standalone View
Standalone View
release/arm64/make-memstick.sh
#!/bin/sh | #!/bin/sh | ||||
# | # | ||||
# This script generates a "memstick image" (image that can be copied to a | # This script generates a "memstick image" (image that can be copied to a | ||||
# USB memory stick) from a directory tree. Note that the script does not | # USB memory stick) from a directory tree. Note that the script does not | ||||
# clean up after itself very well for error conditions on purpose so the | # clean up after itself very well for error conditions on purpose so the | ||||
# problem can be diagnosed (full filesystem most likely but ...). | # problem can be diagnosed (full filesystem most likely but ...). | ||||
# | # | ||||
# Usage: make-memstick.sh <directory tree or manifest> <image filename> | # Usage: make-memstick.sh <directory tree or manifest> <image filename> | ||||
# | # | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
set -e | set -e | ||||
if [ "$(uname -s)" = "FreeBSD" ]; then | |||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin | PATH=/bin:/usr/bin:/sbin:/usr/sbin | ||||
export PATH | export PATH | ||||
fi | |||||
scriptdir=$(dirname $(realpath $0)) | scriptdir=$(dirname $(realpath $0)) | ||||
. ${scriptdir}/../../tools/boot/install-boot.sh | . ${scriptdir}/../../tools/boot/install-boot.sh | ||||
if [ $# -ne 2 ]; then | if [ $# -ne 2 ]; then | ||||
echo "make-memstick.sh /path/to/directory/or/manifest /path/to/image/file" | echo "make-memstick.sh /path/to/directory/or/manifest /path/to/image/file" | ||||
exit 1 | exit 1 | ||||
fi | fi | ||||
Show All 20 Lines | |||||
echo 'root_rw_mount="NO"' > ${BASEBITSDIR}/etc/rc.conf.local | echo 'root_rw_mount="NO"' > ${BASEBITSDIR}/etc/rc.conf.local | ||||
if [ -n "${METALOG}" ]; then | if [ -n "${METALOG}" ]; then | ||||
metalogfilename=$(mktemp /tmp/metalog.XXXXXX) | metalogfilename=$(mktemp /tmp/metalog.XXXXXX) | ||||
cat ${METALOG} > ${metalogfilename} | cat ${METALOG} > ${metalogfilename} | ||||
echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} | echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} | ||||
echo "./etc/rc.conf.local type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} | echo "./etc/rc.conf.local type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} | ||||
MAKEFSARG=${metalogfilename} | MAKEFSARG=${metalogfilename} | ||||
fi | fi | ||||
makefs -D -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG} | makefs -D -N ${BASEBITSDIR}/etc -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG} | ||||
rm ${BASEBITSDIR}/etc/fstab | rm ${BASEBITSDIR}/etc/fstab | ||||
rm ${BASEBITSDIR}/etc/rc.conf.local | rm ${BASEBITSDIR}/etc/rc.conf.local | ||||
if [ -n "${METALOG}" ]; then | if [ -n "${METALOG}" ]; then | ||||
rm ${metalogfilename} | rm ${metalogfilename} | ||||
fi | fi | ||||
# Make an ESP in a file. | # Make an ESP in a file. | ||||
espfilename=$(mktemp /tmp/efiboot.XXXXXX) | espfilename=$(mktemp /tmp/efiboot.XXXXXX) | ||||
Show All 9 Lines |