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

Diff for /openbsd/update_openbsd/update_openbsd between version 1.44 and 1.53

version 1.44, 2012/12/09 04:08:37 version 1.53, 2013/11/09 21:58:26
Line 1 
Line 1 
 #!/bin/sh  #!/bin/sh
 # $AFresh1: update_openbsd,v 1.43 2012/12/09 04:06:57 andrew Exp $  # $AFresh1: update_openbsd,v 1.52 2013/10/20 00:26:35 andrew Exp $
 #  #
 # Copyright (c) 2012 Andrew Fresh <andrew@afresh1.com>  # Copyright (c) 2012 Andrew Fresh <andrew@afresh1.com>
 #  #
Line 185 
Line 185 
   
     # We want to default to what we had      # We want to default to what we had
     INSTALL_KERNELS="${BOOT_KERNEL#/}"      INSTALL_KERNELS="${BOOT_KERNEL#/}"
       # if the boot kernel was our specially named bsd.sp, we install from bsd
       if [ X"$INSTALL_KERNELS" == X"bsd.sp" ]; then
           INSTALL_KERNELS="bsd"
       fi
     # with a second option of an mp kernel if is is a likely candidate      # with a second option of an mp kernel if is is a likely candidate
     if [ X"$INSTALL_KERNELS" != X"bsd.mp" ]; then      if [ X"$INSTALL_KERNELS" != X"bsd.mp" ]; then
         local _ncpu=$(sysctl -n hw.ncpufound)          local _ncpu=$(sysctl -n hw.ncpufound)
Line 211 
Line 215 
     local _v=$FILE_VER      local _v=$FILE_VER
   
     for _b in $INSTALL_KERNELS; do      for _b in $INSTALL_KERNELS; do
         if [ -e /${_b} -a ! -e ./${_b} ]; then          if [ ! -e ./${_b} ]; then
             echo $FTP_CMD ${FTP}/${_b}              echo $FTP_CMD ${FTP}/${_b}
             $FTP_CMD ${FTP}/${_b}              $FTP_CMD ${FTP}/${_b}
         fi          fi
Line 329 
Line 333 
         exit 1          exit 1
     fi      fi
   
     echo "Backing up $BOOT_KERNEL to /obsd"      if [ X"$BOOT_KERNEL_VERSION" != X"$NEW_KERNEL_VERSION" ]; then
     $SUDO ln -f $BOOT_KERNEL /obsd          echo "Backing up $BOOT_KERNEL to /obsd"
     if [ $? -ne 0 ]; then          $SUDO ln -f $BOOT_KERNEL /obsd
         echo "Error copying old kernel!" >&2          if [ $? -ne 0 ]; then
         exit 1              echo "Error copying old kernel!" >&2
               exit 1
           fi
     fi      fi
   
     cd $RELEASEDIR      cd $RELEASEDIR
Line 390 
Line 396 
   
     local _v=$FILE_VER      local _v=$FILE_VER
   
     if [ $CUR_VER != $NEW_VER -a ! -e /sbin/oreboot ]; then  
         $SUDO cp /sbin/reboot /sbin/oreboot  
         if [ $? -ne 0 ]; then  
             echo "Error copying old reboot command!" >&2  
             exit 1  
         fi  
         echo "/sbin/reboot copied to /sbin/oreboot"  
     fi  
   
     local _sets=`ls *${_v}.tgz | grep -v ^base `      local _sets=`ls *${_v}.tgz | grep -v ^base `
     for _f in ${_sets} base${_v}.tgz; do      for _f in ${_sets} base${_v}.tgz; do
         _path=$DESTDIR          _path=$DESTDIR
Line 418 
Line 415 
     done      done
   
     echo Extracted all sets.      echo Extracted all sets.
   }
   
   install_sendmail_smtp_auth() {
     if [ -e ${RELEASEDIR}/sendmail-smtp_auth.gz ]; then      if [ -e ${RELEASEDIR}/sendmail-smtp_auth.gz ]; then
         gzcat ${RELEASEDIR}/sendmail-smtp_auth.gz > \          gzcat ${RELEASEDIR}/sendmail-smtp_auth.gz > \
             ${RELEASEDIR}/sendmail-smtp_auth              ${RELEASEDIR}/sendmail-smtp_auth
Line 439 
Line 438 
 update_etc() {  update_etc() {
     echo '### UPDATING ETC ###'      echo '### UPDATING ETC ###'
     if [ ! -e $SYSMERGE ]; then      if [ ! -e $SYSMERGE ]; then
         SYSMERGE=          echo "ERROR: Can't find sysmerge!" >&2
           exit 1;
     fi      fi
   
     if [ X"" == X"$SYSMERGE" ]; then      if [ X"" == X"$RELEASEDIR" ]; then
         if [ -e /var/tmp/temproot ]; then          echo "ERROR: no source for etc!" >&2
             MERGEMASTER=`which mergemaster`          exit 1
       fi
   
             if [ $? != 0 ]; then      cd $RELEASEDIR
                 $SUDO pkg_add -i mergemaster  
   
                 MERGEMASTER=`which mergemaster`      local _v=$FILE_VER
                 if [ $? != 0 ]; then      local _args=""
                     echo ERROR: mergemaster not installed! >&2      if [ -e etc${_v}.tgz ]; then
                     exit 1          _args="$_args -s etc${_v}.tgz"
                 fi      fi
             fi      if [ -e xetc${_v}.tgz ]; then
           _args="$_args -x xetc${_v}.tgz"
             echo '### RUNNING MERGEMASTER ###'      fi
             $SUDO $MERGEMASTER -irv      if [ X"" == X"$_args" ]; then
         else          echo ERROR: No upgrade sets found! >&2
             echo "ERROR: no source for etc!" >&2  
             exit 1  
         fi  
     else      else
         if [ X"" == X"$RELEASEDIR" ]; then          echo '### RUNNING SYSMERGE ###'
             echo "ERROR: no source for etc!" >&2          $SUDO $SYSMERGE $_args
             exit 1  
         else  
             cd $RELEASEDIR  
         fi  
   
         local _v=$FILE_VER  
         local _args=""  
         if [ -e etc${_v}.tgz ]; then  
             _args="$_args -s etc${_v}.tgz"  
         fi  
         if [ -e xetc${_v}.tgz ]; then  
             _args="$_args -x xetc${_v}.tgz"  
         fi  
         if [ X"" == X"$_args" ]; then  
             echo ERROR: No upgrade sets found! >&2  
         else  
             echo '### RUNNING SYSMERGE ###'  
             if sysmerge 2>&1 | grep -- -a >/dev/null; then  
                 _args="-a $_args"  
             fi  
             $SUDO $SYSMERGE $_args  
         fi  
     fi      fi
   
       cd $OLDPWD
 }  }
   
   
Line 554 
Line 531 
     echo "ctrl+C to cancel, enter to continue anyway" >&2      echo "ctrl+C to cancel, enter to continue anyway" >&2
     local _temp      local _temp
     read _temp      read _temp
       NEW_KERNEL_VERSION=$BOOT_KERNEL_VERSION
 fi  fi
   
 if [ -n "$SUDO" -a $CUR_VER != $NEW_VER ]; then  if [ -n "$SUDO" -a $CUR_VER != $NEW_VER ]; then
Line 574 
Line 552 
     $SUDO -v -p "sudo Password: "      $SUDO -v -p "sudo Password: "
 fi  fi
   
   if [ X"$NEW_KERNEL_VERSION" != X"$BOOTED_KERNEL_VERSION" \
        -a ! -e /sbin/oreboot ]; then
       $SUDO cp /sbin/reboot /sbin/oreboot
       if [ $? -ne 0 ]; then
           echo "Error copying old reboot command!" >&2
           exit 1
       fi
       echo "/sbin/reboot copied to /sbin/oreboot"
   fi
   
 install_kernels  install_kernels
 install_sets  install_sets
   
 if [ $CUR_VER == $NEW_VER ]; then  if [ X"$NEW_KERNEL_VERSION" == X"$BOOTED_KERNEL_VERSION" ]; then
       install_sendmail_smtp_auth
   
     if [ -e /sbin/oreboot ]; then      if [ -e /sbin/oreboot ]; then
         echo Removing /sbin/oreboot          echo Removing /sbin/oreboot
         $SUDO rm -f /sbin/oreboot          $SUDO rm -f /sbin/oreboot
Line 599 
Line 589 
 echo New kernel installed.  Please reboot!  echo New kernel installed.  Please reboot!
 if [ -e /sbin/oreboot ]; then  if [ -e /sbin/oreboot ]; then
     echo Possibly using /sbin/oreboot      echo Possibly using /sbin/oreboot
 fi  
   
 local _send_dmesg=`dirname $0`/send_dmesg  
 if [ -e "$_send_dmesg" ]; then  
     if [ -e $RELEASEDIR/.send_dmesg ]; then  
         $_send_dmesg  
         rm -f $RELEASEDIR/.send_dmesg  
     elif [ X"$CUR_VER" != X"$NEW_VER" ]; then  
         touch $RELEASEDIR/.send_dmesg  
     fi  
 fi  fi

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.53

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