=================================================================== RCS file: /cvs/openbsd/update_openbsd/release.sh,v retrieving revision 1.24 retrieving revision 1.32 diff -u -r1.24 -r1.32 --- openbsd/update_openbsd/release.sh 2008/10/20 23:06:57 1.24 +++ openbsd/update_openbsd/release.sh 2010/02/24 21:58:18 1.32 @@ -1,5 +1,5 @@ #!/bin/sh -# $RedRiver$ +# $AFresh1: release.sh,v 1.31 2010/02/10 20:57:07 andrew Exp $ # # Copyright (c) 2002, 2008 Steven Roberts # @@ -25,9 +25,10 @@ XSRCDIR="/usr/xenocara" PORTSPATH="/usr/ports" -if [ -e /etc/releaserc ]; then - . /etc/releaserc +if [ -e /etc/release.conf ]; then + . /etc/release.conf fi +export CVSROOT if [ X"" != X"${_origtag}" ]; then TAG=$_origtag @@ -37,62 +38,138 @@ # See http://www.openbsd.org/anoncvs.html for instructions on fetching the # sources for the first time. +empty_dir() { +[ X"" == X"$1" ] && exit +cd $1 || exit + +local _old=`${SUDO} mktemp -d .old.XXXXXXX` +${SUDO} mv -f * .* $_old 2>/dev/null +${SUDO} rm -rf $_old + +sync +} + update_sources() { echo "---------- Update sources ----------" local _d for _d in /usr/src "${XSRCDIR}" "${PORTSPATH}"; do if [ -d $_d ]; then - echo [$_d] cvs update -r $TAG -Pd - cd $_d && cvs update -r $TAG -Pd + echo [$_d] cvs update -r$TAG -Pd + cd $_d && cvs update -r$TAG -Pd || exit 255 fi done } build_kernel() { echo "---------- Build and install a new kernel ----------" +local _status=0 +unset DESTDIR RELEASEDIR cd /usr/src/sys/arch/$ARCH/conf config $KERNEL cd ../compile/$KERNEL make clean depend && make -make install +_status=$? +if [ $_status == 0 ]; then + make install + _status=$? +fi +if [ $_status != 0 ]; then + echo Kernel Build Failed + exit $_status +fi } build_system() { echo "---------- Build a new system ----------" -rm -rf /usr/obj/* +local _status=0 +unset DESTDIR RELEASEDIR +empty_dir /usr/obj & cd /usr/src && nice make obj -cd /usr/src/etc && env DESTDIR=/ make distrib-dirs -cd /usr/src && nice make build -echo Update /etc, /var, and /dev/MAKEDEV, either by hand or using sysmerge\(8\). +_status=$? +if [ $_status == 0 ]; then + cd /usr/src/etc && env DESTDIR=/ $SUDO make distrib-dirs + _status=$? +fi +if [ $_status == 0 ]; then + cd /usr/src && nice make SUDO="${SUDO}" build +fi +if [ $_status != 0 ]; then + echo System Build Failed + exit $_status +else + echo Update /etc, /var, and /dev/MAKEDEV, either by hand or using sysmerge\(8\). +fi } make_system_release() { echo "---------- Make and validate the system release ----------" -cd /usr/src/distrib/crunch && make obj depend && make all install +local _status=0 export DESTDIR=$DEST; export RELEASEDIR=$RELEASE -rm -rf $DESTDIR +if [ X"$DESTDIR" == X"" ]; then + echo PLEASE SET \$DEST! >2& + exit +fi mkdir -p $DESTDIR $RELEASEDIR -cd /usr/src/etc && nice make release -cd /usr/src/distrib/sets && sh checkflist +empty_dir $DESTDIR & +cd /usr/src/etc && ${SUDO} nice make release +_status=$? +if [ $_status == 0 ]; then + cd /usr/src/distrib/sets && ${SUDO} sh checkflist + _status=$? +fi unset DESTDIR RELEASEDIR +if [ $_status != 0 ]; then + echo System Release Failed + exit $_status +fi } build_xenocara() { echo "---------- Build and install xenocara ----------" +local _status=0 +unset DESTDIR RELEASEDIR +empty_dir /usr/xobj & cd $XSRCDIR -make bootstrap -make obj -make build +_status=$? +if [ $_status == 0 ]; then + make bootstrap + _status=$? +fi +if [ $_status == 0 ]; then + make obj + _status=$? +fi +if [ $_status == 0 ]; then + make build + _status=$? +fi +if [ $_status != 0 ]; then + echo Xenocara Build Failed + exit $_status +fi } make_xenocara_release() { echo "---------- Make and validate the xenocara release ----------" -export DESTDIR=$DEST RELEASEDIR=$RELEASE -rm -rf $DESTDIR +local _status=0 +export DESTDIR=$DEST;export RELEASEDIR=$RELEASE +if [ X"$DESTDIR" == X"" ]; then + echo PLEASE SET \$DEST! >2& + exit +fi mkdir -p $DESTDIR $RELEASEDIR +empty_dir $DESTDIR & cd $XSRCDIR -nice make release +_status=$? +if [ $_status == 0 ]; then + nice make release + _status=$? +fi unset DESTDIR RELEASEDIR +if [ $_status != 0 ]; then + echo Xenocara Release Failed + exit $_status +fi } usage() { @@ -106,12 +183,12 @@ echo " system-release - Make and validate the system release" echo " xenocara - Build and install xenocara" echo " xenocara-release - Make and validate the xenocara release" -echo " full-release - Do system, xenocara, system-release, xenocara-release" +echo " full-release - xenocara, xenocara-release, system, system-release" echo } -if [ `whoami` != "root" ]; then -echo "You must be root to build a release." +if [ X"" == X"${SUDO}" -a `whoami` != "root" ]; then +echo "You must be root or set SUDO to build a release." exit 1 fi @@ -124,6 +201,9 @@ echo " Kernel: $KERNEL-$ARCH" echo " Dest: $DEST" echo "Release: $RELEASE" +if [ X"$CVSROOT" != X"" ]; then + echo " Root: $CVSROOT" +fi echo if [ $# = 0 ]; then usage; exit 1; fi @@ -150,9 +230,9 @@ make_xenocara_release ;; full-release) -build_system build_xenocara make_xenocara_release +build_system make_system_release ;; *)