[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.2 and 1.38

version 1.2, 2006/10/11 00:48:15 version 1.38, 2017/02/16 07:08:49
Line 1 
Line 1 
 #!/bin/sh  #!/bin/sh
   # $AFresh1: release.sh,v 1.37 2015/11/27 22:36:12 andrew Exp $
 #  #
 # Copyright (c) 2002 - 2006, FenderQ  # Copyright (c) 2002, 2008 Steven Roberts <sroberts@fenderq.com>
 # All rights reserved.  
 #  #
 # Redistribution and use in source and binary forms, with or without  # Permission to use, copy, modify, and distribute this software for any
 # modification, are permitted provided that the following conditions are met:  # purpose with or without fee is hereby granted, provided that the above
   # copyright notice and this permission notice appear in all copies.
 #  #
 #   * Redistributions of source code must retain the above copyright  # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 #     notice, this list of conditions and the following disclaimer.  # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 #   * Redistributions in binary form must reproduce the above copyright  # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 #     notice, this list of conditions and the following disclaimer in the  # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 #     documentation and/or other materials provided with the distribution.  # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 #   * Neither the name of FenderQ nor the names of its contributors  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 #     may be used to endorse or promote products derived from this software  # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #     without specific prior written permission.  
 #  #
 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"  
 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE  
 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE  
 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE  
 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR  
 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF  
 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS  
 # 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)  
 #  
   
   local _origtag=${TAG}
   TAG=`uname -sr | tr '[:lower:] .' '[:upper:]_'`
   KERNEL="GENERIC"
   ARCH=`machine`
 DEST="/usr/dest"  DEST="/usr/dest"
 RELEASE="/usr/release"  RELEASE="/home/releasedir"
 CVSTAG="OPENBSD_3_9"  XSRCDIR="/usr/xenocara"
 #SOURCES="src ports XF4"  PORTSPATH="/usr/ports"
 SOURCES="src ports"  BUILDUSER=build
   
 # Anonymous CVS - http://www.openbsd.org/anoncvs.html  if [ -e /etc/mk.conf ]; then
 CVSROOT="anoncvs@anoncvs3.usa.openbsd.org:/cvs"      . /etc/mk.conf
   fi
   if [ -e /etc/release.conf ]; then
       . /etc/release.conf
   fi
 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/*  if [ X"$DEST" = X"" ]; then
                 cvs -q -z6 checkout -r$CVSTAG -P $d      echo PLEASE SET \$DEST! >&2
         done      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
   # 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
                 cd /usr && cvs -q -z6 update -r$CVSTAG -Pd $d  for _d in /usr/src "${XSRCDIR}" "${PORTSPATH}"; do
         done      if [ -d $_d -a -e $_d/CVS ]; then
           R="-r$TAG"
           [ "$TAG" = "HEAD" ] && R="-A"
           echo [$_d] cvs update $R -Pd
           cd $_d &&  cvs update $R -Pd || exit 255
       fi
   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  
         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  
 }  
   
 make_release() {  mkdir -p /usr/obj
         echo "********** Make and validate the system release **********"  chown $BUILDUSER:wheel /usr/obj
         cd /usr/src/distrib/crunch && make obj depend all install  chmod 755              /usr/obj
         export DESTDIR=$DEST RELEASEDIR=$RELEASE  empty_dir /usr/obj &
         rm -rf $DESTDIR  
         mkdir -p $DESTDIR $RELEASEDIR  
         cd /usr/src/etc && nice make release  
         cd /usr/src/distrib/sets && sh checkflist  
         unset DESTDIR RELEASEDIR  
 }  
   
 build_XF4() {  cd /usr/src
         echo "********** Build and install XF4 **********"  _status=$?
         rm -rf /usr/Xbuild  
         mkdir -p /usr/Xbuild  if [ $_status -eq 0 ]; then
         cd /usr/ports/lang/tcl/8.4 && make install      nice make $BUILD_ARGS obj && nice make $BUILD_ARGS build
         cd /usr/ports/x11/tk/8.4 && make install      _status=$?
         cd /usr/Xbuild && lndir /usr/XF4 && nice make build  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_release_XF4() {  make_system_release() {
         echo "********** Make and validate the XF4 release **********"  echo "---------- Make and validate the system release ----------"
         export DESTDIR=$DEST RELEASEDIR=$RELEASE  
         rm -rf $DESTDIR  local _status=0
         mkdir -p $DESTDIR $RELEASEDIR  local DESTDIR RELEASEDIR
         nice make release  
         unset DESTDIR RELEASEDIR  export DESTDIR=$DEST/base; export RELEASEDIR=$RELEASE
   mkdir -p $DESTDIR $RELEASEDIR
   empty_dir $DESTDIR &
   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
   if [ $_status -ne 0 ]; then
       echo System Release Failed
       exit $_status
   fi
 }  }
   
 clean_everything() {  build_xenocara() {
         echo "********** Clean everything **********"  echo "---------- Build and install xenocara ----------"
         rm -rf /usr/obj/* $DEST /usr/Xbuild  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
   _status=$?
   
   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
 }  }
   
 usage() {  make_xenocara_release() {
         echo "Usage: $0 options"  echo "---------- Make and validate the xenocara release ----------"
         echo  local _status=0
         echo "Options:"  local DESTDIR RELEASEDIR
         echo  
         echo "  install            - Install sources"  export DESTDIR=$DEST/xbase; export RELEASEDIR=$RELEASE
         echo "  update             - Update sources"  mkdir -p $DESTDIR $RELEASEDIR
         echo "  kernel             - Build and install a new kernel"  empty_dir $DESTDIR &
         echo "  system             - Build a new system"  chown -R $BUILDUSER:wheel $DESTDIR $RELEASEDIR
         echo "  release            - Make and validate the system release"  chmod -R 755              $DESTDIR $RELEASEDIR
         echo "  xwindow            - Build and install XF4"  
         echo "  xwindow-release    - Make and validate the XF4 release"  if [ $_status -eq 0 ]; then
         echo "  clean              - Clean everything"      cd $XSRCDIR && nice make release
         echo      _status=$?
   fi
   
   unset DESTDIR RELEASEDIR
   if [ $_status -ne 0 ]; then
       echo Xenocara Release Failed
       exit $_status
   fi
 }  }
   
   usage() {
   echo "  Usage: $0 <options>"
   echo
   echo "Options:"
   echo
   echo "  update           - Update sources"
   echo "  kernel           - Build and install a new kernel"
   echo "  system           - Build a new system"
   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             - xenocara, xenocara-release, system, system-release"
   echo
 if [ `whoami` != "root" ]; then  if [ `whoami` != "root" ]; then
         echo "You probably should be root instead of `whoami` to run this safely."  echo "You must be root to build a release."
         exit 1  
 fi  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 [ `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
                 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.2  
changed lines
  Added in v.1.38

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