path: root/release/amd64/make-memstick.sh
diff options
authorJessica Clarke <jrtc27@FreeBSD.org>2022-02-28 22:37:37 +0000
committerJessica Clarke <jrtc27@FreeBSD.org>2022-02-28 22:37:37 +0000
commit1a9b1c367fa606c7850cfc876bf73a1e1129279a (patch)
treec8a90d2418f56e6f28f8da6b720c19037ba81a95 /release/amd64/make-memstick.sh
parent17160f21efe8e8ccaebe6f887624e4faab55f6c7 (diff)
release: Add support for building on non-FreeBSD
This requires two sets of changes. Firstly, for non-FreeBSD, we do not know where tools are in PATH (and it is likely that some are not in system directories and have been built as bootstrap tools during the build), so we should leave PATH alone and trust the user. Secondly, makefs needs a master.passwd for building images from a METALOG file, so pass the directory in the image tree to makefs's -N option in order to pick up a valid FreeBSD master.passwd; this is unnecessary on FreeBSD (except in the edge case of building an image that refers to users or groups not present in the host's database, which is unlikely but technically possible) but harmless so can be done unconditionally. Reviewed by: brooks, emaste, gjb Differential Revision: https://reviews.freebsd.org/D34001
Diffstat (limited to 'release/amd64/make-memstick.sh')
1 files changed, 5 insertions, 3 deletions
diff --git a/release/amd64/make-memstick.sh b/release/amd64/make-memstick.sh
index 835dc126d61d..57902e559d10 100755
--- a/release/amd64/make-memstick.sh
+++ b/release/amd64/make-memstick.sh
@@ -15,8 +15,10 @@ set -e
scriptdir=$(dirname $(realpath $0))
. ${scriptdir}/../../tools/boot/install-boot.sh
-export PATH
+if [ "$(uname -s)" = "FreeBSD" ]; then
+ PATH=/bin:/usr/bin:/sbin:/usr/sbin
+ export PATH
if [ $# -ne 2 ]; then
echo "make-memstick.sh /path/to/directory/or/manifest /path/to/image/file"
@@ -50,7 +52,7 @@ if [ -n "${METALOG}" ]; then
echo "./etc/rc.conf.local type=file uname=root gname=wheel mode=0644" >> ${metalogfilename}
-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/rc.conf.local
if [ -n "${METALOG}" ]; then