#!/bin/sh # vim: set shiftwidth=3 expandtab cindent: echo "You're probably better off using the Makefile I use" echo "now for this purpose @" echo "http://iki.fi/heko/utils/scripts/Makefile" exit 1 # A simple script to automate the update process of OpenBSD. # Mainly targetted at people who go through the process daily. # (To be precise, this was in the first place targetted at the # author, not the general public.) # For complete instructions on upgrading, see release(8) # and the upgrade mini-faq at # http://www.openbsd.org/faq/upgrade-minifaq.html # The author places the script in the public domain. The script # may be freely distributed. The below warranty statement is # Copyright (C) 2000 Terry Pratchett. # "This script is provided without warranty of any kind as to # reliability, accuracy, existence or otherwise or fitness for # any particular purpose and the author specifically does not warrant, # guarantee, imply or make any representations as to its # merchantability for any particular purpose and furthermore shall # have no liability for or responsibility to you or any other person, # entity or deity with respect of any loss or damage whatsoever caused # by this device or object or by any attempts to destroy it by hammering # it against a wall or dropping it into a deep well or any other means # whatsoever and moreover asserts that you indicate your acceptance of # this agreement or any other agreement that may be substituted at any # time by coming within five miles of the product or observing it # through large telescopes or by other means because you are such an # easily cowed moron who will happily accept arrogant and unilateral # conditions on a piece of highly priced garbage that you would not # dream of accepting on a bag of dog biscuits and is used solely at # your own risk." # -- Terry Pratchett, The Truth (adapted) # Some assumptions: # ##################################################################### # o $update_logfile is a logfile that the executer has append-access # to. It will record the proceedings of all builds. This is nice # for checking out when the system was last recompiled, and possibly # also of some interest if you want to see how much time an update # takes. Especially if you try hard to track -current you will # want to make sure that your /etc and /var are up-to-date. # o $kernel_update_logfile is a logfile that will only include the # latest date when the kernel configuration was checked; this is used # to automate the diff process. # o GCC and libiberty update is not needed. (See # http://www.openbsd.org/faq/upgrade-minifaq.html#1.8; also # section on libiberty on # http://www.openbsd.org/faq/upgrade-minifaq.html#4.2 # ) # o If you do not run the script as root, you have SUDO defined # in /etc/make.conf and you have the right to /usr/src tree as # the user you execute the script as. # o The following config. # Config # ##################################################################### set +C local_cvsrep=/cvs supfile="${local_cvsrep}/supfile" update_logfile=/etc/cvs-update kernel_update_logfile=/etc/kernel-update system_update_logfile=/etc/system-update newroot=/builds/newroot build_maindir=/builds xf4lndir=$build_maindir/xf4-build xf4destdir=$build_maindir/xf4-dest xf4releasedir=$build_maindir/xf4-release sysdestdir=$build_maindir/dest sysreleasedir=$build_maindir/release kernel_dir=/bsds srcdir=/usr/src objdir=/usr/obj xf4dir=/usr/XF4 builddate="`date -u '+%Y-%m-%d'`" tmpdir=/var/tmp/sysbuild/$builddate df_files="$local_cvsrep $newroot $build_maindir $xf4lndir $xf4destdir $xf4releasedir $sysdestdir $sysreleasedir $srcdir $objdir $xf4dir $tmpdir" # Configuration file for your kernel CUSTOM_CONFIG=HEIKKI # Architechture you're building for arch=i386 # SUDO is defined in places, so don't globber over it. Use '' to # skip SUDO if you're running this as root. LOCAL_SUDO='sudo' if [ "`whoami`" = "root" ]; then LOCAL_SUDO='' fi # Create and chown $df_files echo "Creating and chowning $df_files..." ${LOCAL_SUDO} mkdir -p $df_files ${LOCAL_SUDO} chown `whoami` $df_files # Allocate a logfile. tmpfile="`mktemp $tmpdir/cvs.up.XXXXXX 2>&1`" if [ $? -ne 0 ]; then echo "Creating tmpfile failed: $tmpfile" exit_with_bell 1 fi # Check CVSROOT from SSH configuration. use_ssh_config=0 # You will need OBSDCVS in environment, or to comment this one out. # I use this personally because I use a local CVS server for my # own development. export CVSROOT=$OBSDCVS # CVSCONFIG is only for show; in specific it is shown in "logfiles". if [ "$use_ssh_config" == "1" ]; then CVSCONFIG="$CVSROOT -- `grep -A8 -i 'host[ ]*openbsd' /etc/ssh_config 2>&1`" else CVSCONFIG="$CVSROOT" fi if [ -f "$supfile" ]; then CVSUPCONFIG="`grep host $supfile`" fi CVSUPCONFIG=${CVSUPCONFIG:-none} echo "NOTICE: This should produce a bell!" echo -e '\a' verifyblurp="(use 'y' or 'yes' to verify) " if [ -e "$local_cvsrep" ]; then echo "Update local repository $local_cvsrep with cvsup? $verifyblurp" read updatelocal fi updatelocal=${updatelocal:-no} echo "Update $srcdir from CVS $CVSROOT? $verifyblurp" read update echo "Take CVS from which date? (Enter for -current); ' 23:59' will be appended" read cvsdate update=${update:-no} echo "Make custom kernel? $verifyblurp" read makecustomkernel makecustomkernel=${makecustomkernel:-no} echo "Make generic kernel? $verifyblurp" read makegenerickernel makegenerickernel=${makegenerickernel:-no} echo "Make generic kernel with debugs? $verifyblurp" read makegenericwithdebugs makegenericwithdebugs=${makegenericwithdebugs:-no} echo "Make build? $verifyblurp" read makebuild makebuild=${makebuild:-no} if [ ${makebuild} = "yes" ] || [ ${makebuild} = "y" ]; then echo "Clean before build? $verifyblurp" read cleanbuild cleanbuild=${cleanbuild:-no} else cleanbuild=no fi echo "Make release? $verifyblurp" read makerelease makerelease=${makerelease:-no} echo "Update $xf4dir from CVS $CVSROOT? $verifyblurp" echo "(NOTE: requires super-user permissions) " read xupdate xupdate=${xupdate:-no} echo "Make X build? $verifyblurp" echo "(NOTE: requires super-user permissions) " read makexbuild makexbuild=${makexbuild:-no} echo "Make X release? $verifyblurp" echo "(NOTE: requires super-user permissions) " read makexrelease makexrelease=${makexrelease:-no} echo "diff /etc and /var? $verifyblurp" read diffetcvar diffetcvar=${diffetcvar:-no} # XXX: See rest of release(8). bellforever() { period_between_bells=1800 bells_at_once=100 while [ 1 ]; do i=0 while [ $i -lt $bells_at_once ]; do sleep 0.000010 echo -e -n '\a' i=$((i+1)) done sleep $period_between_bells done } exit_with_bell() { errorcode=$1 i=0 echo "*** EXIT :: code $1" echo "Beep beep beep..." bellforever exit $errorcode } # Misc checks # ##################################################################### # Check permission touch $update_logfile if [ $? -ne 0 ]; then echo "Error :: $?" exit_with_bell 1 fi cd $srcdir # More interaction # ##################################################################### if [ -n "$LOCAL_SUDO" ]; then echo "Updating sudo timestamp so I can go to sleep" $LOCAL_SUDO -v fi # Functions # ##################################################################### success_buildlog() { message=$1 append_buildlog $message } error_buildlog() { error=$1 log=$2 loglines=$3 message=$4 error_tmpfile=`mktemp $tmpdir/err.XXXXXX` if [ $? -ne 0 ]; then echo "Creating tmpfile failed: $error_tmpfile" exit_with_bell 1 fi cat > $error_tmpfile <> $error_tmpfile 2>&1 append_buildlog_file $error_tmpfile exit_with_bell 1 } # This is a clumsy cut-and-paste thing but I couldn't think of a better # way for now... # XXX TODO: clean this crap. append_buildlog_file() { local_tmpfile=`mktemp $tmpdir/msg.XXXXXX` if [ $? -ne 0 ]; then echo "Creating tmpfile failed: $local_tmpfile" exit_with_bell 1 fi cat > $local_tmpfile <&1 | uniq` EOF cat $* >> $local_tmpfile cat $local_tmpfile cat $local_tmpfile >> $update_logfile rm -f $local_tmpfile } append_buildlog() { local_tmpfile=`mktemp $tmpdir/msg.XXXXXX` if [ $? -ne 0 ]; then echo "Creating tmpfile failed: $local_tmpfile" exit_with_bell 1 fi cat > $local_tmpfile <&1 | uniq` EOF cat $local_tmpfile cat $local_tmpfile >> $update_logfile rm -f $local_tmpfile } # Show the configuration. # ##################################################################### tmpfile2=`mktemp $tmpdir/config.XXXXXX 2>&1` if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 20 \ "Failed to create temporary file: $tmpfile2" fi cat > $tmpfile2 <&1` (UTC) Update local CVS: $updatelocal System from CVS: $update X from CVS: $xupdate Make custom kernel: $makecustomkernel Make generic kernel: $makegenerickernel Make generic w/dbg: $makegenericwithdebugs Make build: $makebuild Clean before build: $cleanbuild Make release: $makerelease Make build X: $makexbuild Make release X: $makexrelease CVS from date: $cvsdate Diff /etc and /var: $diffetcvar Sleep: $sleep Bells: $bells New root: $newroot Local CVS rep: $local_cvsrep Newroot: $newroot Build maindir: $build_maindir XF4 lndir: $xf4lndir XF4 destdir: $xf4destdir XF4 release dir: $xf4releasedir System destdir: $sysdestdir System release dir: $sysreleasedir Source directory: $srcdir Object directory: $objdir XF4 source dir: $xf4dir Temporary dir: $tmpdir /etc/mk.conf: EOF cat /etc/mk.conf >> $tmpfile2 echo "" >> $tmpfile2 cat >> $tmpfile2 <> $tmpfile 2>&1 fi if [ $? -ne 0 ]; then echo "Error $?" error_buildlog "$?" "$tmpfile" 20 \ "The system source update from $CVSROOT failed" fi success_buildlog \ "OK: The system source has been updated from CVS: $CVSROOT" echo "$cvsdate" > $system_update_logfile else cvsdate="`cat $system_update_logfile`" fi # Make a custom kernel # ##################################################################### madekernel=0 if [ -n "$makecustomkernel" ] && ( [ "$makecustomcustomkernel" = "yes" ] || [ "$makecustomkernel" = "y" ] ); then if [ -s $kernel_update_logfile ]; then cd $srcdir/sys lastdate=`cat $kernel_update_logfile` success_buildlog \ "START: kernel config diff from $CVSROOT and with -D $lastdate" cvstmp=`mktemp $tmpdir/qcvs.XXXXXX 2>&1` if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 10 \ "Failed creating temporary file: $cvstmp" fi # Diff returns 0 if the files differ, 1 otherwise # (This goes for both diff and cvs diff) if ! cvs -t diff -D "$lastdate" \ -uN conf/GENERIC arch/$arch/conf/GENERIC >> $cvstmp 2>&1 ; then date -u '+%Y-%m-%d %H:%M' > $kernel_update_logfile success_buildlog \ "OK: The kernel source configuration SHOULD be checked after this" cat $cvstmp >> $tmpfile cat $cvstmp error_buildlog "$?" "$tmpfile" 20 \ "Kernel configuration has changed - check" fi cat $cvstmp >> $tmpfile cat $cvstmp fi # XXX we just *hope* there isn't another compilation going on # But we just *hope* that elsewhere too :-) cd $srcdir/sys/arch/$arch/compile 2>&1 olddirs="`ls -1 -d * | grep -v CVS`" if [ -z "$olddirs" ]; then success_buildlog "OK: No old build directories" else success_buildlog "START: Removing old directories $olddirs" rm -rf $olddirs >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 \ "rm -rf old compile directories $olddirs failed" fi fi cd $srcdir/sys/arch/$arch/conf success_buildlog "START: kernel config of $CUSTOM_CONFIG in $arch" config ./$CUSTOM_CONFIG >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 20 \ "The kernel source configuration failed" fi cd $srcdir/sys/arch/$arch/compile/$CUSTOM_CONFIG 2>&1 success_buildlog "START: kernel make clean of $CUSTOM_CONFIG in $arch" make clean >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 \ "Make clean in kernel source failed" fi success_buildlog "START: kernel make all of $CUSTOM_CONFIG in $arch" make all >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 \ "Make all in kernel source failed" fi success_buildlog "OK: kernel make all of $CUSTOM_CONFIG in $arch" bsd_dir="$kernel_dir/$cvsdate" mkdir -p $bsd_dir if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 10 \ "mkdir -p $bsd_dir failed" fi bsd_dest="$bsd_dir/$CUSTOM_CONFIG" cp -f ./bsd $bsd_dest >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 10 \ "Copying ./bsd to $bsd_dest failed" fi success_buildlog "OK: Copying ./bsd to $bsd_dest kernel" $LOCAL_SUDO chown root.wheel $bsd_dest >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 10 \ "Chowning $bsd_dest to root.wheel failed" fi success_buildlog "OK: chown $bsd_dest to root.wheel" if [ -f ./bsd.gdb ]; then cp -f ./bsd.gdb $bsd_dest.gdb >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 10 \ "Copying ./bsd.gdb to $bsd_dest.gdb failed" fi success_buildlog "OK: Copying ./bsd.gdb to $bsd_dest.gdb kernel" $LOCAL_SUDO chown root.wheel $bsd_dest.gdb >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 10 \ "Chowning $bsd_dest.gdb to root.wheel failed" fi success_buildlog "OK: chown $bsd_dest.gdb to root.wheel" fi madekernel=1 fi # Make a GENERIC kernel # ##################################################################### if [ -n "$makegenerickernel" ] && ( [ "$makegenerickernel" = "yes" ] || [ "$makegenerickernel" = "y" ] ); then if [ -n "$makegenericwithdebugs" ] && ( [ "$makegenericwithdebugs" = "yes" ] || [ "makegenericwithdebugs" = "y" ] ); then kernelname=GENERIC.plusDEBUGS else kernelname=GENERIC fi echo "(Using kernelname $kernelname)" cd $srcdir/sys/arch/$arch/conf success_buildlog \ "START: kernel config of $kernelname in $arch" cat GENERIC DEBUGS > GENERIC.plusDEBUGS config ./$kernelname >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 20 \ "The kernel source configuration failed" fi cd $srcdir/sys/arch/$arch/compile/$kernelname 2>&1 success_buildlog \ "START: kernel make clean of $kernelname in $arch" make clean >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 \ "Make clean in kernel source of $kernelname failed" fi success_buildlog \ "START: kernel make all of $kernelname in $arch" make all >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 \ "Make all in kernel source failed" fi success_buildlog \ "OK: kernel make all of $kernelname in $arch" bsd_dir="$kernel_dir/$cvsdate" mkdir -p $bsd_dir if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 10 \ "mkdir -p $bsd_dir failed" fi bsd_dest="$bsd_dir/$kernelname" cp -f ./bsd $bsd_dest >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 10 \ "Copying ./bsd to $bsd_dest failed" fi success_buildlog "OK: Copying ./bsd to $bsd_dest kernel" $LOCAL_SUDO chown root.wheel $bsd_dest >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 10 \ "Chowning $bsd_dest to root.wheel failed" fi success_buildlog "OK: chown $bsd_dest to root.wheel" if [ -f ./bsd.gdb ]; then cp -f ./bsd.gdb $bsd_dest.gdb >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 10 \ "Copying ./bsd.gdb to $bsd_dest.gdb failed" fi success_buildlog "OK: Copying ./bsd.gdb to $bsd_dest.gdb kernel" $LOCAL_SUDO chown root.wheel $bsd_dest.gdb >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 10 \ "Chowning $bsd_dest.gdb to root.wheel failed" fi success_buildlog "OK: chown $bsd_dest.gdb to root.wheel" fi madekernel=1 fi # Reboot if we made a kernel # ##################################################################### if [ "$madekernel" = "1" ]; then echo "********************" echo "** Please reboot now" echo "********************" exit_with_bell 0 fi # Clean before userland build # ##################################################################### if [ -n "$cleanbuild" ] && ( [ "$cleanbuild" = "yes" ] || [ "$cleanbuild" = "y" ] ); then success_buildlog "START: clean before build" success_buildlog "START: Removing $objdir/*" rm -rf $objdir/* >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "make cleandir failed" fi success_buildlog "OK: rm -rf $objdir/* ok" success_buildlog "START: Making obj" make obj >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "make obj failed" fi success_buildlog "OK: make obj ok" for command in \ "cd /usr/src/share/mk && /usr/bin/sudo make install" \ "cd /usr/src/include && make prereq && /usr/bin/sudo make includes" \ "/usr/bin/sudo make cleandir"; do success_buildlog "START: $command" eval $command >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "$command failed" fi success_buildlog "OK: $command" done success_buildlog "OK: clean before build ok" fi # Make the userland # ##################################################################### if [ -n "$makebuild" ] && ( [ "$makebuild" = "yes" ] || [ "$makebuild" = "y" ] ); then success_buildlog "START: Making build" for command in \ "cd /usr/src/lib && make depend && make && NOMAN=1 /usr/bin/sudo make install" \ "cd /usr/src/gnu/lib && make depend && make && NOMAN=1 /usr/bin/sudo make install" \ "cd /usr/src/kerberosIV/lib && make depend && make && NOMAN=1 /usr/bin/sudo make install" \ "cd /usr/src/kerberosV/lib && make depend && make && NOMAN=1 /usr/bin/sudo make install" \ "cd /usr/src/gnu/usr.bin/perl && make -f Makefile.bsd-wrapper depend && make -f Makefile.bsd-wrapper perl.lib && /usr/bin/sudo make -f Makefile.bsd-wrapper install.lib" \ "make depend && make && /usr/bin/sudo make install"; do success_buildlog "START: $command" eval $command >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "$command failed" fi success_buildlog "OK: $command" done success_buildlog "OK: make build ok" fi # Make a release # ##################################################################### if [ -n "$makerelease" ] && ( [ "$makerelease" = "yes" ] || [ "$makerelease" = "y" ] ); then export DESTDIR=$sysdestdir export RELEASEDIR=$sysreleasedir success_buildlog "START: Removing $sysdestdir and $sysreleasedir" ${LOCAL_SUDO} rm -rf $sysdestdir $sysreleasedir >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 \ "rm -rf $sysdestdir $sysreleasedir failed" fi success_buildlog "OK: rm -rf $sysdestdir $sysreleasedir ok" success_buildlog "START: mkdir $sysdestdir $sysreleasedir" ${LOCAL_SUDO} mkdir $sysdestdir $sysreleasedir if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 \ "mkdir $sysdestdir $sysreleasedir failed" fi success_buildlog "OK: mkdir $sysdestdir $sysreleasedir ok" cd $srcdir/etc success_buildlog "START: Making release in $srcdir/etc" ${LOCAL_SUDO} make SUDO='' release >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 \ "make release in $srcdir/etc failed" fi success_buildlog "OK: make release in $srcdir/etc ok" cd $srcdir/distrib/sets success_buildlog "START: Doing checkflist checks" ${LOCAL_SUDO} csh checkflist >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 \ csh checkflist fi success_buildlog "OK: csh checkflist ok" fi # Clean up # ##################################################################### if [ -n "$makebuild" ] && ( [ "$makebuild" = "yes" ] || [ "$makebuild" = "y" ] ); then cd $srcdir success_buildlog "START: Making cleandir" make cleandir >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "make cleandir failed" fi success_buildlog "OK: Make cleandir ok" success_buildlog "START: Removing $objdir/*" rm -rf $objdir/* >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "make cleandir failed" fi success_buildlog "OK: rm -rf $objdir/* ok" fi # Update X from CVS # ##################################################################### if [ -n "$xupdate" ] && \ ( [ "$xupdate" = "yes" ] || [ "$xupdate" = "y" ] ); then success_buildlog "START: XFree update from CVS: $CVSCONFIG" cd $xf4dir cvs -q up -dPA >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 20 \ "XFree update from $CVSROOT failed" fi rm -f $tmpfile success_buildlog \ "OK: XFree source has been updated from CVS: $CVSROOT" fi # Make X11R6 (build) # ##################################################################### if [ -n "$makexbuild" ] && ( [ "$makexbuild" = "yes" ] || [ "$makexbuild" = "y" ] ); then success_buildlog "START: Removing $xf4lndir/*" rm -rf $xf4lndir/* >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "rm -rf $xflndir failed" fi success_buildlog "OK: rm -rf $xf4lndir/* ok" success_buildlog "START: mkdir -p $xf4lndir" mkdir -p $xf4lndir >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "mkdir -p $xflndir failed" fi success_buildlog "OK: mkdir -p $xf4lndir ok" cd $xf4lndir success_buildlog "START: Doing lndir $xf4dir" lndir $xf4dir >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "lndir $xf4dir failed" fi success_buildlog "OK: lndir $xf4dir ok" success_buildlog "START: Making build for X" make build >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "make build for X failed" fi success_buildlog "OK: Make build for X ok" echo "********************************************************" echo "** Update /etc/X11/xdm from $DESTDIR/etc/X11/xdm by hand" echo "********************************************************" echo fi # Make X11R6 (release) # ##################################################################### if [ -n "$makexrelease" ] && ( [ "$makexrelease" = "yes" ] || [ "$makexrelease" = "y" ] ); then cd $xf4lndir # Oops, these didn't fit in the $xf4dir partition after all.. DESTDIR=$xf4destdir RELEASEDIR=$xf4releasedir export DESTDIR RELEASEDIR success_buildlog "START: Removing old XF release and dest dirs ${DESTDIR} and ${RELEASEDIR}" rm -rf ${DESTDIR} ${RELEASEDIR} >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "rm -rf ${DESTDIR} ${RELEASEDIR} failed" fi success_buildlog "OK: rm -rf ${DESTDIR} ${RELEASEDIR} ok" mkdir -p ${DESTDIR} ${RELEASEDIR} if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "mkdir -p ${DESTDIR} ${RELEASEDIR} failed" fi success_buildlog "START: Making release for X" make release >>$tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "make release for X failed" fi success_buildlog "OK: Make release for X ok" fi # Check /etc, /var and /dev # ##################################################################### if [ -n "$diffetcvar" ] && ( [ "$diffetcvar" = "yes" ] || [ "$diffetcvar" = "y" ] ); then $LOCAL_SUDO mkdir -p $newroot >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 "mkdir -p $newroot failed" fi export DESTDIR=$newroot success_buildlog "START: rm -rf $newroot/* $newroot/.*" $LOCAL_SUDO rm -rf $newroot/* $newroot/.* >> $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog $? $tmpfile 20 "rm -rf $newroot/* $newroot/.* failed" fi success_buildlog "OK: rm -rf $newroot/* $newroot/.* ok" success_buildlog "START: making distribution-etc-root-var to $DESTDIR" cd $srcdir/etc && $LOCAL_SUDO make distribution-etc-root-var >> \ $tmpfile 2>&1 if [ $? -ne 0 ]; then error_buildlog "$?" "$tmpfile" 40 \ "make distribution-etc-root-var failed" fi success_buildlog "OK: making distribution-etc-root-var ok" $LOCAL_SUDO chown -R heikki.wheel $newroot for dir in var etc; do success_buildlog \ "START: Diff $newroot/$dir to /$dir to $newroot/$dir/$dir.patch" echo "Warning -- this is not -uN patch, but a less verbose patch" echo "just to give you a grasp of what has changed" cd $newroot/$dir for f in *; do if echo $f | grep -q messages; then continue fi echo ==== $f >> $dir.patch $LOCAL_SUDO diff -r /$dir/$f $f >> $dir.patch 2>&1 done success_buildlog "OK: $newroot/$dir/$dir.patch done" done cd $newroot for singlefile in dev/MAKEDEV dev/MAKEDEV.local; do success_buildlog \ "START: Diff $newroot/$singlefile to /$singlefile to $newroot/$singlefile.patch" echo "Warning -- this is not -uN patch, but a less verbose patch" echo "just to give you a grasp of what has changed" $LOCAL_SUDO diff -r /$singlefile $singlefile >> $singlefile.patch 2>&1 done fi echo "*****************************************************************" echo "** Don't forget to update /etc, /var and /dev from $newroot!" echo "*****************************************************************" echo echo "*****************************************************************" echo "** Update any third party packages in /usr/ports by hand!" echo "*****************************************************************" echo exit_with_bell 0