Skip to content

Instantly share code, notes, and snippets.

@dch
Last active April 27, 2025 15:55
Show Gist options
  • Save dch/a3ca418402821e42c1a82129e3e36b6f to your computer and use it in GitHub Desktop.
Save dch/a3ca418402821e42c1a82129e3e36b6f to your computer and use it in GitHub Desktop.
#!/bin/sh -eu
# echo 'WITH_CCACHE_BUILD=yes' > /etc/src.conf
# echo 'WITH_META_MODE=yes' > /etc/src-env.conf
# echo 'WITH_DIRDEPS_BUILD=yes' >> /etc/src-env.conf
# hide ports & poudriere's make.conf from src builds
export __MAKE_CONF=/dev/null
umask 0022
cd /usr/src
NOW=$(date -u +%Y%m%d-%H%M)
NCPU=$(sysctl -n hw.ncpu)
COMMIT=g$(git rev-parse --verify --short=7 HEAD)
STASH=/downloads/FreeBSD/current/${COMMIT}
echo STASH $STASH
RELEASE=/usr/obj/usr/src/amd64.amd64/release
mkdir -p -m0775 ${STASH}/amd64 || /usr/bin/true
chflags -R noschg ${RELEASE} || /usr/bin/true
chown -R dch:wheel ${RELEASE} || /usr/bin/true
rm -rf ${RELEASE}
git reset --hard
git clean -fdx
doas zfs snapshot \
-r zroot/usr/src@${NOW}:bebuild-${COMMIT} \
|| /usr/bin/true
time make -j${NCPU} buildworld -s
echo DONE BW
date -u +%Y%m%d-%H%M
time make -j${NCPU} buildkernel -s
echo DONE BK
date -u +%Y%m%d-%H%M
cd /usr/src/release
time make -DNOPORTS -DNOSRC -DNOTEST -s ftp
cd ${RELEASE}
cp -av ftp/* ${STASH}/amd64
echo DONE IMG
date -u +%Y%m%d-%H%M
cd /usr/src
rm ${STASH}/../latest
ln -s ${STASH} ${STASH}/../latest
echo DONE SRC $STASH $RELEASE | wall
cd /usr/src
time /usr/bin/env NO_PKG_UPGRADE=1 /usr/src/tools/build/beinstall.sh
cp -v /boot/efi/EFI/FreeBSD/current.efi /boot/efi/EFI/FreeBSD/lastgood.efi
cp -v /usr/obj/usr/src/amd64.amd64/release/dist/base/boot/loader.efi /boot/efi/EFI/FreeBSD/current.efi
echo DONE BE | wall
yes | poudriere jail -d -C all -j current_x64 \
|| /usr/bin/true
rm -rf /usr/local/poudriere/jails/current_x64 \
|| /usr/bin/true
poudriere jail -c \
-j current_x64 \
-v 15.0-CURRENT
echo DONE POUDRIERE | wall
date -u +%Y%m%d-%H%M
echo DONE ALL | wall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment