Skip to content

Instantly share code, notes, and snippets.

@louy2
Created January 25, 2017 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save louy2/f15daaf69c1e4c41f617398560e40719 to your computer and use it in GitHub Desktop.
Save louy2/f15daaf69c1e4c41f617398560e40719 to your computer and use it in GitHub Desktop.
OpenBSD-STABLE Automated build script: 2 Posted 12-02-2014 at 06:18 PM by rocket357 from http://www.linuxquestions.org/questions/blog/rocket357-328529/openbsd-stable-automated-build-script-2-36315/
#!/bin/sh
# OpenBSD-STABLE Automated build script: 2 Posted 12-02-2014 at 06:18 PM by rocket357
# from http://www.linuxquestions.org/questions/blog/rocket357-328529/openbsd-stable-automated-build-script-2-36315/
# Comment by louy2
# Requires root
# Default disk layout doesn't work because /usr/xenocara & /usr/xobj shares
# the 2G given to /usr
# Recommend 2G each for /usr/xenocara & /usr/xobj too
# While at it give /usr/ports 5G too for future proof
set -e
export LOGFILE=/var/log/build_stable.log
export ARCH=`machine`
# DEFAULT: BUILD -STABLE (UPGRADE TO LATEST -RELEASE FIRST!!)
export BUILDVER=OPENBSD_`uname -r | tr '.' '_'`
cat > ${LOGFILE} << EOF
STABLE BUILD - `date` - `uname -a`
EOF
echo "Retrieving/Updating Sources for src ${BUILDVER}"
[ -d /usr/src/ ] || ( cd /usr; cvs -qd anoncvs@anoncvs1.usa.openbsd.org:/cvs checkout -r${BUILDVER} -P src >> ${LOGFILE} ) && ( cd /usr/src; cvs -qd anoncvs@anoncvs1.usa.openbsd.org:/cvs up -r${BUILDVER} -Pd >> ${LOGFILE} )
echo "Retrieving/Updating Sources for xenocara ${BUILDVER}"
[ -d /usr/xenocara/ ] || ( cd /usr; cvs -qd anoncvs@anoncvs1.usa.openbsd.org:/cvs checkout -r${BUILDVER} -P xenocara >> ${LOGFILE} ) && ( cd /usr/xenocara; cvs -qd anoncvs@anoncvs1.usa.openbsd.org:/cvs up -r${BUILDVER} -Pd >> ${LOGFILE} )
echo "Building Kernel..."
cd /usr/src/sys/arch/${ARCH}/conf
/usr/sbin/config GENERIC >> ${LOGFILE}
cd /usr/src/sys/arch/${ARCH}/compile/GENERIC
make clean >> ${LOGFILE}
make depend >> ${LOGFILE}
make >> ${LOGFILE}
cd /usr/src/sys/arch/${ARCH}/compile/GENERIC
make install >> ${LOGFILE}
cat > /etc/rc.firsttime << EOF
#!/bin/sh
set -e
# BUILD USERLAND
echo
echo "Building Userland..."
rm -rf /usr/obj/*
cd /usr/src
make obj >> ${LOGFILE}
cd /usr/src/etc && env DESTDIR=/ make distrib-dirs
cd /usr/src
make build >> ${LOGFILE}
echo "Building Xenocara..."
rm -rf /usr/xobj/*
cd /usr/xenocara
make bootstrap >> ${LOGFILE}
make obj >> ${LOGFILE}
make build >> ${LOGFILE}
test -d /pub/destdir && mv /pub/destdir{,.old} && rm -rf /pub/destdir.old &
mkdir -p /pub/destdir /pub/OpenBSD/`uname -r`/`uname -m`/ || true
cd /usr/src/etc && env DESTDIR=/pub/destdir RELEASEDIR=/pub/OpenBSD/`uname -r`/${ARCH}/ make release >> ${LOGFILE}
cd /usr/xenocara && env DESTDIR=/pub/destdir RELEASEDIR=/pub/OpenBSD/`uname -r`/${ARCH}/ make release >> ${LOGFILE}
EOF
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment