Skip to content

Instantly share code, notes, and snippets.

@shattered
Created March 31, 2013 18:53
Show Gist options
  • Select an option

  • Save shattered/5281601 to your computer and use it in GitHub Desktop.

Select an option

Save shattered/5281601 to your computer and use it in GitHub Desktop.
nbrelease.sh -- a wrapper around NetBSD's build.sh
#!/bin/sh -e
#
# objective: build an ISO image from checked-out (possibly modified) source.
#
if [ $# -lt 1 ]; then
echo "nbrelease.sh: Usage: <arch> <xsrc> <root>"
exit 1
fi
if [ '!' -x build.sh ]; then
echo "nbrelease.sh: ERROR: should be run from top-level dir of source tree." 1>&2
exit 1
fi
release=`cvs status Makefile 2> /dev/null | awk 'BEGIN { tag = "fail" } /Sticky Tag/ { tag = $3 } END { if (tag == "(none)") tag = "HEAD"; print tag; }'`
if [ $release = fail ]; then
echo "nbrelease.sh: ERROR: Unable to determine CVS tag."
exit 1
fi
arch=$1
xsrc=$2
root=$3
wpath=`mktemp -d -t tmp`
nbbuildsh () {
echo "nbrelease.sh: INFO: Making $@"
./build.sh -M ${root}/obj/${arch}-${release} \
-T ${root}/tools-${release} -X ${xsrc} \
-D ${root}/d.${arch}-${release} -R ${root}/r.${arch}-${release} \
-w ${wpath}/nbmake-${arch}-${release} -m ${arch} \
-N 1 -o -u -U -x "$@"
}
echo "nbrelease.sh: INFO: Starting, tag ${release}, arch ${arch}"
mkdir -p ${root}/tools-${release}
mkdir -p ${root}/obj/${arch}-${release}
mkdir -p ${root}/d.${arch}-${release}
mkdir -p ${root}/r.${arch}-${release}
nbbuildsh obj
(cd external/mit/xorg && ${wpath}/nbmake-${arch}-${release} obj)
# build tools, world and release
nbbuildsh tools
nbbuildsh release
nbbuildsh iso-image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment