[BACK]Return to release.sh CVS log [TXT][DIR] Up to [local] / openbsd / update_openbsd

Diff for /openbsd/update_openbsd/release.sh between version 1.13 and 1.34

version 1.13, 2007/11/19 22:08:37 version 1.34, 2012/05/27 21:48:56
Line 1 
Line 1 
 #!/bin/sh  #!/bin/sh
 # $RedRiver: release.sh,v 1.12 2007/09/09 21:40:41 andrew Exp $  # $AFresh1: release.sh,v 1.33 2010/11/01 22:39:44 andrew Exp $
 # Copyright (c) 2002 - 2006, FenderQ  
 # All rights reserved.  
 #  #
 # Redistribution and use in source and binary forms, with or without  # Copyright (c) 2002, 2008 Steven Roberts <sroberts@fenderq.com>
 # modification, are permitted provided that the following conditions are met:  
 #  #
 #   * Redistributions of source code must retain the above copyright  # Permission to use, copy, modify, and distribute this software for any
 #     notice, this list of conditions and the following disclaimer.  # purpose with or without fee is hereby granted, provided that the above
 #   * Redistributions in binary form must reproduce the above copyright  # copyright notice and this permission notice appear in all copies.
 #     notice, this list of conditions and the following disclaimer in the  
 #     documentation and/or other materials provided with the distribution.  
 #   * Neither the name of FenderQ nor the names of its contributors  
 #     may be used to endorse or promote products derived from this software  
 #     without specific prior written permission.  
 #  #
 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"  # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE  # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE  # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE  # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR  # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS  # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN  
 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)  
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE  
 # POSSIBILITY OF SUCH DAMAGE.  
 #  #
 # --------------------------------------------  
 # OpenBSD - Release Building Shell Script v3.9  
 #  
 # FenderQ.com - Internet Security Solutions  
 # http://www.fenderq.com/  
 #  
 # SEE ALSO release(8)  
 #  
   
 DEST="/usr/dest"  local _origtag=${TAG}
 RELEASE="/usr/release"  TAG=`uname -sr | tr '[:lower:] .' '[:upper:]_'`
 CVSTAG=${CVSTAG:=`uname -sr | tr '[:lower:] .' '[:upper:]_'`}  KERNEL="GENERIC"
 #SOURCES="src ports XF4"  ARCH=`machine`
 #SOURCES="src ports"  DEST="/home/destdir"
 SOURCES="src ports XF4"  RELEASE="/home/releasedir"
   XSRCDIR="/usr/xenocara"
   PORTSPATH="/usr/ports"
   
 # Anonymous CVS - http://www.openbsd.org/anoncvs.html  if [ -e /etc/release.conf ]; then
 #CVSROOT="anoncvs@anoncvs3.usa.openbsd.org:/cvs"      . /etc/release.conf
 #CVSROOT="anoncvs@anoncvs1.usa.openbsd.org:/cvs"  fi
 CVSROOT="anoncvs@rt.fm:/cvs"  
 export CVSROOT  export CVSROOT
   
 install_sources() {  if [ X"" != X"${_origtag}" ]; then
         echo "********** Install sources **********"      TAG=$_origtag
         cd /usr  fi
         for d in $SOURCES; do  
                 rm -rf $d/*  
                 cvs -q -z6 checkout -r$CVSTAG -P $d  # See http://www.openbsd.org/anoncvs.html for instructions on fetching the
         done  # 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() {  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=-A          echo [$_d] cvs update -r$TAG -Pd
                 fi          cd $_d &&  cvs update -r$TAG -Pd || exit 255
                 cd /usr && cvs -q -z6 update $_cvstag -Pd $d      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/i386/conf  local _status=0
         config GENERIC  unset DESTDIR RELEASEDIR
         cd ../compile/GENERIC  cd /usr/src/sys/arch/$ARCH/conf
         make clean depend && make  config $KERNEL
         cp /bsd /bsd.old && cp bsd /  cd ../compile/$KERNEL
   make clean depend && make
   _status=$?
   if [ $_status == 0 ]; then
       make install
       _status=$?
   fi
   if [ $_status != 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  empty_dir /usr/obj &
         cd /usr/src && nice make build  cd /usr/src && nice make obj
   _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_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 all install  local _status=0
         export DESTDIR=$DEST RELEASEDIR=$RELEASE  export DESTDIR=$DEST; export RELEASEDIR=$RELEASE
         rm -rf $DESTDIR/*  if [ X"$DESTDIR" == X"" ]; then
         mkdir -p $DESTDIR $RELEASEDIR          echo PLEASE SET \$DEST! >2&
         cd /usr/src/etc && nice make release          exit
         cd /usr/src/distrib/sets && sh checkflist  fi
         ls $RELEASEDIR | grep -v index.txt | sort > $RELEASEDIR/index.txt  mkdir -p $DESTDIR $RELEASEDIR
         unset DESTDIR RELEASEDIR  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_XF4() {  build_xenocara() {
         echo "********** Build and install XF4 **********"  echo "---------- Build and install xenocara ----------"
         rm -rf /usr/Xbuild  local _status=0
         mkdir -p /usr/Xbuild  unset DESTDIR RELEASEDIR
         cd /usr/ports/lang/tcl/8.4 && make install  empty_dir /usr/xobj &
         cd /usr/ports/x11/tk/8.4 && make install  cd $XSRCDIR
         cd /usr/Xbuild && lndir /usr/XF4 && nice 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_release_XF4() {  make_xenocara_release() {
         echo "********** Make and validate the XF4 release **********"  echo "---------- Make and validate the xenocara release ----------"
         export DESTDIR=$DEST RELEASEDIR=$RELEASE  local _status=0
         rm -rf $DESTDIR/*  export DESTDIR=$DEST;export RELEASEDIR=$RELEASE
         mkdir -p $DESTDIR $RELEASEDIR  if [ X"$DESTDIR" == X"" ]; then
         cd /usr/Xbuild && nice make release          echo PLEASE SET \$DEST! >2&
         cd /usr/Xbuild/distrib/sets && sh checkflist          exit
         ls $RELEASEDIR | grep -v index.txt | sort > $RELEASEDIR/index.txt  fi
         unset DESTDIR RELEASEDIR  mkdir -p $DESTDIR $RELEASEDIR
   empty_dir $DESTDIR &
   cd $XSRCDIR
   _status=$?
   if [ $_status == 0 ]; then
       nice make release
       _status=$?
   fi
   unset DESTDIR RELEASEDIR
   if [ $_status != 0 ]; then
       echo Xenocara Release Failed
       exit $_status
   fi
 }  }
   
 clean_everything() {  
         echo "********** Clean everything **********"  
         rm -rf /usr/obj/* $DEST/* /usr/Xbuild  
 }  
   
 usage() {  usage() {
         echo "Usage: $0 options"  echo "  Usage: $0 <options>"
         echo  echo
         echo "Options:"  echo "Options:"
         echo  echo
         echo "  install            - Install sources"  echo "  update           - Update sources"
         echo "  update             - Update sources"  echo "  kernel           - Build and install a new kernel"
         echo "  kernel             - Build and install a new kernel"  echo "  system           - Build a new system"
         echo "  system             - Build a new system"  echo "  system-release   - Make and validate the system release"
         echo "  release            - Make and validate the system release"  echo "  xenocara         - Build and install xenocara"
         echo "  xwindow            - Build and install XF4"  echo "  xenocara-release - Make and validate the xenocara release"
         echo "  xwindow-release    - Make and validate the XF4 release"  echo "  full             - xenocara, xenocara-release, system, system-release"
         echo "  clean              - Clean everything"  echo
         echo  
 }  }
   
   if [ X"" == X"${SUDO}" -a `whoami` != "root" ]; then
   echo "You must be root or set SUDO to build a release."
   exit 1
   fi
   
 START=`date`  START=`date`
 echo  echo
 echo "***** OpenBSD - Release Building *****"  echo ".: release.sh - building an OpenBSD release :."
   echo "----------------------------------------------"
 echo  echo
 echo "Dest: $DEST"  echo "    Tag: $TAG"
   echo " Kernel: $KERNEL-$ARCH"
   echo "   Dest: $DEST"
 echo "Release: $RELEASE"  echo "Release: $RELEASE"
 echo "CVS Server: $CVSROOT"  if [ X"$CVSROOT" != X"" ]; then
 echo "CVS Revision Tag: $CVSTAG"          echo "   Root: $CVSROOT"
   fi
 echo  echo
   
 if [ $# = 0 ]; then usage; exit 1; fi  if [ $# = 0 ]; then usage; exit 1; fi
   
 if [ `id -u` != "0" ]; then  
         echo "You probably should be root instead of `whoami` to run this safely."  
         exit 1  
 fi  
   
 for i in $*  for i in $*
 do  do
         case $i in  case $i in
                 install)  update)
                 install_sources  update_sources
                 ;;  ;;
                 update)  kernel)
                 update_sources  build_kernel
                 ;;  ;;
                 kernel)  system)
                 build_kernel  build_system
                 ;;  ;;
                 system)  system-release)
                 build_system  make_system_release
                 ;;  ;;
                 release)  xenocara)
                 make_release  build_xenocara
                 ;;  ;;
                 xwindow)  xenocara-release)
                 build_XF4  make_xenocara_release
                 ;;  ;;
                 xwindow-release)  full)
                 make_release_XF4  build_xenocara
                 ;;  make_xenocara_release
                 clean)  build_system
                 clean_everything  make_system_release
                 ;;  ;;
                 *)  *)
                 echo "********** Abort! Abort! **********"  echo "---------- Abort! Abort! ----------"
                 echo "Invalid option encountered: $i"  echo "Invalid option encountered: $i"
                 echo "Exiting......."  echo "Exiting......."
                 echo  echo
                 exit 1  exit 1
                 ;;  ;;
         esac  esac
 done  done
 echo  echo
 echo "Start Time  : $START"  echo " Start Time : $START"
 echo "Finish Time : `date`"  echo "Finish Time : `date`"
 echo  echo

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.34

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>