version 1.15, 2008/02/13 16:31:47 |
version 1.38, 2017/02/16 07:08:49 |
|
|
#!/bin/sh |
#!/bin/sh |
# $RedRiver: release.sh,v 1.14 2007/11/20 20:08:31 andrew Exp $ |
# $AFresh1: release.sh,v 1.37 2015/11/27 22:36:12 andrew Exp $ |
# |
# |
# Copyright (c) 2002 - 2007 Steven Roberts <fenderq@fenderq.com> |
# Copyright (c) 2002, 2008 Steven Roberts <sroberts@fenderq.com> |
# |
# |
# Permission to use, copy, modify, and distribute this software for any |
# Permission to use, copy, modify, and distribute this software for any |
# purpose with or without fee is hereby granted, provided that the above |
# purpose with or without fee is hereby granted, provided that the above |
|
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
# |
# |
|
|
#TAG="OPENBSD_4_2" |
local _origtag=${TAG} |
|
TAG=`uname -sr | tr '[:lower:] .' '[:upper:]_'` |
KERNEL="GENERIC" |
KERNEL="GENERIC" |
ARCH="i386" |
ARCH=`machine` |
DEST="/home/destdir" |
DEST="/usr/dest" |
RELEASE="/home/releasedir" |
RELEASE="/home/releasedir" |
XSRCDIR="/usr/src/xenocara" |
XSRCDIR="/usr/xenocara" |
PORTSPATH="/usr/ports" |
PORTSPATH="/usr/ports" |
|
BUILDUSER=build |
|
|
DEST="/usr/dest" |
if [ -e /etc/mk.conf ]; then |
RELEASE="/usr/release" |
. /etc/mk.conf |
TAG=${TAG:=`uname -sr | tr '[:lower:] .' '[:upper:]_'`} |
fi |
ARCH=`machine` |
if [ -e /etc/release.conf ]; then |
#SOURCES="src ports XF4" |
. /etc/release.conf |
#SOURCES="src ports" |
fi |
SOURCES="/usr/src $XSRCDIR $PORTSPATH" |
|
|
|
# Anonymous CVS - http://www.openbsd.org/anoncvs.html |
|
#CVSROOT="anoncvs@anoncvs3.usa.openbsd.org:/cvs" |
|
#CVSROOT="anoncvs@anoncvs1.usa.openbsd.org:/cvs" |
|
CVSROOT="anoncvs@rt.fm:/cvs" |
|
export CVSROOT |
export CVSROOT |
|
|
|
if [ X"" != X"${_origtag}" ]; then |
|
TAG=$_origtag |
|
fi |
|
|
|
if [ X"$DEST" = X"" ]; then |
|
echo PLEASE SET \$DEST! >&2 |
|
exit 1 |
|
fi |
|
if [ X"$RELEASE" = X"" ]; then |
|
echo PLEASE SET \$RELEASE! >&2 |
|
exit 1 |
|
fi |
|
|
# See http://www.openbsd.org/anoncvs.html for instructions on fetching the |
# See http://www.openbsd.org/anoncvs.html for instructions on fetching the |
# sources for the first time. |
# sources for the first time. |
|
|
|
empty_dir() { |
|
[ X"" = X"$1" ] && exit |
|
cd $1 || exit |
|
|
|
local _old=`mktemp -d .old.XXXXXXX` |
|
mv -f * .* $_old 2>/dev/null |
|
rm -rf $_old |
|
|
|
sync |
|
} |
|
|
update_sources() { |
update_sources() { |
echo "---------- Update sources ----------" |
echo "---------- Update sources ----------" |
for d in $SOURCES; do |
local _d |
_cvstag=-r$CVSTAG |
for _d in /usr/src "${XSRCDIR}" "${PORTSPATH}"; do |
if [ X"$CVSTAG" == X"HEAD" ]; then |
if [ -d $_d -a -e $_d/CVS ]; then |
_cvstag="" |
R="-r$TAG" |
fi |
[ "$TAG" = "HEAD" ] && R="-A" |
cd $d && cvs -q -z6 update $_cvstag -Pd |
echo [$_d] cvs update $R -Pd |
|
cd $_d && cvs update $R -Pd || exit 255 |
|
fi |
done |
done |
} |
} |
|
|
build_kernel() { |
build_kernel() { |
echo "---------- Build and install a new kernel ----------" |
echo "---------- Build and install a new kernel ----------" |
cd /usr/src/sys/arch/$ARCH/conf |
local _status=0 |
config $KERNEL |
unset DESTDIR RELEASEDIR |
cd ../compile/$KERNEL |
|
make clean depend && make |
cd /usr/src/sys/arch/$ARCH/compile/$KERNEL |
cp /bsd /bsd.old && cp bsd / |
_status=$? |
|
|
|
if [ $_status -eq 0 ]; then |
|
make obj && make config && make && make install |
|
_status=$? |
|
fi |
|
|
|
if [ $_status -ne 0 ]; then |
|
echo Kernel Build Failed |
|
exit $_status |
|
fi |
} |
} |
|
|
build_system() { |
build_system() { |
echo "---------- Build a new system ----------" |
echo "---------- Build a new system ----------" |
rm -rf /usr/obj/* |
local _status=0 |
cd /usr/src && nice make obj |
unset DESTDIR RELEASEDIR |
cd /usr/src/etc && export DESTDIR=/ && make distrib-dirs |
local DESTDIR RELEASEDIR |
cd /usr/src && nice make build |
|
# Update /etc, /var, and /dev/MAKEDEV by hand. |
mkdir -p /usr/obj |
|
chown $BUILDUSER:wheel /usr/obj |
|
chmod 755 /usr/obj |
|
empty_dir /usr/obj & |
|
|
|
cd /usr/src |
|
_status=$? |
|
|
|
if [ $_status -eq 0 ]; then |
|
nice make $BUILD_ARGS obj && nice make $BUILD_ARGS build |
|
_status=$? |
|
fi |
|
|
|
if [ $_status -ne 0 ]; then |
|
echo System Build Failed |
|
exit $_status |
|
fi |
|
|
|
echo Update /etc, /var, and /dev/MAKEDEV, either by hand or using sysmerge\(8\). |
} |
} |
|
|
make_system_release() { |
make_system_release() { |
echo "---------- Make and validate the system release ----------" |
echo "---------- Make and validate the system release ----------" |
cd /usr/src/distrib/crunch && make obj depend && make all install |
|
export DESTDIR=$DEST; export RELEASEDIR=$RELEASE |
local _status=0 |
if (-e $DESTDIR); then |
local DESTDIR RELEASEDIR |
mkdir $DESTDIR/old- |
|
mv $DESTDIR/* $DESTDIR/old- 2>/dev/null |
export DESTDIR=$DEST/base; export RELEASEDIR=$RELEASE |
rm -rf $DESTDIR/old- & |
|
fi |
|
mkdir -p $DESTDIR $RELEASEDIR |
mkdir -p $DESTDIR $RELEASEDIR |
cd /usr/src/etc && nice make release |
empty_dir $DESTDIR & |
cd /usr/src/distrib/sets && sh checkflist |
chown -R $BUILDUSER:wheel $DESTDIR $RELEASEDIR |
|
chmod -R 700 $DESTDIR $RELEASEDIR |
|
|
|
if [ $_status -eq 0 ]; then |
|
cd /usr/src/etc && nice make release |
|
_status=$? |
|
fi |
|
|
|
if [ $_status -eq 0 ]; then |
|
cd /usr/src/distrib/sets && sh checkflist |
|
_status=$? |
|
fi |
|
|
unset DESTDIR RELEASEDIR |
unset DESTDIR RELEASEDIR |
|
if [ $_status -ne 0 ]; then |
|
echo System Release Failed |
|
exit $_status |
|
fi |
} |
} |
|
|
build_xenocara() { |
build_xenocara() { |
echo "---------- Build and install xenocara ----------" |
echo "---------- Build and install xenocara ----------" |
rm -rf /usr/xobj/* |
local _status=0 |
|
local DESTDIR RELEASEDIR |
|
unset DESTDIR RELEASEDIR |
|
|
|
mkdir -p /usr/xobj |
|
chown $BUILDUSER:wheel /usr/xobj |
|
chmod 755 /usr/xobj |
|
empty_dir /usr/xobj & |
|
|
cd $XSRCDIR |
cd $XSRCDIR |
make bootstrap |
_status=$? |
make obj |
|
make build |
if [ $_status -eq 0 ]; then |
|
make $BUILD_ARGS bootstrap |
|
_status=$? |
|
fi |
|
|
|
if [ $_status -eq 0 ]; then |
|
make $BUILD_ARGS obj |
|
_status=$? |
|
fi |
|
|
|
if [ $_status -eq 0 ]; then |
|
make $BUILD_ARGS build |
|
_status=$? |
|
fi |
|
|
|
if [ $_status -ne 0 ]; then |
|
echo Xenocara Build Failed |
|
exit $_status |
|
fi |
} |
} |
|
|
make_xenocara_release() { |
make_xenocara_release() { |
echo "---------- Make and validate the xenocara release ----------" |
echo "---------- Make and validate the xenocara release ----------" |
export DESTDIR=$DEST RELEASEDIR=$RELEASE |
local _status=0 |
if (-e $DESTDIR); then |
local DESTDIR RELEASEDIR |
mkdir $DESTDIR/old- |
|
mv $DESTDIR/* $DESTDIR/old- 2>/dev/null |
export DESTDIR=$DEST/xbase; export RELEASEDIR=$RELEASE |
rm -rf $DESTDIR/old- & |
|
fi |
|
mkdir -p $DESTDIR $RELEASEDIR |
mkdir -p $DESTDIR $RELEASEDIR |
cd $XSRCDIR |
empty_dir $DESTDIR & |
nice make release |
chown -R $BUILDUSER:wheel $DESTDIR $RELEASEDIR |
|
chmod -R 755 $DESTDIR $RELEASEDIR |
|
|
|
if [ $_status -eq 0 ]; then |
|
cd $XSRCDIR && nice make release |
|
_status=$? |
|
fi |
|
|
unset DESTDIR RELEASEDIR |
unset DESTDIR RELEASEDIR |
|
if [ $_status -ne 0 ]; then |
|
echo Xenocara Release Failed |
|
exit $_status |
|
fi |
} |
} |
|
|
usage() { |
usage() { |
|
|
echo " system-release - Make and validate the system release" |
echo " system-release - Make and validate the system release" |
echo " xenocara - Build and install xenocara" |
echo " xenocara - Build and install xenocara" |
echo " xenocara-release - Make and validate the xenocara release" |
echo " xenocara-release - Make and validate the xenocara release" |
|
echo " full - xenocara, xenocara-release, system, system-release" |
echo |
echo |
} |
|
|
|
if [ $# = 0 ]; then usage; exit 1; fi |
|
|
|
if [ `whoami` != "root" ]; then |
if [ `whoami` != "root" ]; then |
echo "You must be root to create a release." |
echo "You must be root to build a release." |
exit 1 |
|
fi |
fi |
|
} |
|
|
START=`date` |
START=`date` |
echo |
echo |
|
|
echo " Kernel: $KERNEL-$ARCH" |
echo " Kernel: $KERNEL-$ARCH" |
echo " Dest: $DEST" |
echo " Dest: $DEST" |
echo "Release: $RELEASE" |
echo "Release: $RELEASE" |
|
if [ X"$CVSROOT" != X"" ]; then |
|
echo " Root: $CVSROOT" |
|
fi |
echo |
echo |
|
|
|
if [ $# = 0 ]; then usage; exit 1; fi |
|
|
|
if [ `whoami` != "root" ]; then |
|
echo "You must be root to build a release." |
|
exit 1 |
|
fi |
|
|
for i in $* |
for i in $* |
do |
do |
case $i in |
case $i in |
full-release) |
|
build_xenocara |
|
build_system |
|
make_xenocara_release |
|
make_system_release |
|
;; |
|
update) |
update) |
update_sources |
update_sources |
;; |
;; |
|
|
;; |
;; |
xenocara-release) |
xenocara-release) |
make_xenocara_release |
make_xenocara_release |
|
;; |
|
full) |
|
build_xenocara |
|
make_xenocara_release |
|
build_system |
|
make_system_release |
;; |
;; |
*) |
*) |
echo "---------- Abort! Abort! ----------" |
echo "---------- Abort! Abort! ----------" |