[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.110 and 1.111

version 1.110, 2018/10/01 00:31:27 version 1.111, 2018/12/16 20:12:16
Line 1 
Line 1 
 #!/bin/sh  #!/bin/sh
 # $AFresh1: update_openbsd,v 1.109 2018/02/08 19:08:01 andrew Exp $  # $AFresh1: update_openbsd,v 1.110 2018/09/30 23:31:27 andrew Exp $
 #  #
 # Copyright (c) 2012 Andrew Fresh <andrew@afresh1.com>  # Copyright (c) 2012 Andrew Fresh <andrew@afresh1.com>
 #  #
Line 84 
Line 84 
 }  }
   
 set_boot_device() {  set_boot_device() {
         BOOT_DEVICE=$( df -nP /bsd | sed -ne 's! .*/$!!p' )          BOOT_DEVICE=$( df -lnP /bsd | sed -ne 's! .*/$!!p' )
   
         root_disk=$( echo $BOOT_DEVICE |          root_disk=$( echo $BOOT_DEVICE |
             sed -e 's,/dev/\([a-z]*[0-9]\)[a-z].*,\1,' )              sed -e 's,/dev/\([a-z]*[0-9]\)[a-z].*,\1,' )
Line 103 
Line 103 
     [ "$boot_device_mounted" ] && return      [ "$boot_device_mounted" ] && return
     [ "$BOOT_DEVICE" ] || return      [ "$BOOT_DEVICE" ] || return
   
     local default_mount=$( df -lnP /bsd | sed -ne 's!/dev/.* !!p' )  
     local boot_mount=$( mount |      local boot_mount=$( mount |
             sed -ne "s!^$BOOT_DEVICE on \([^ ]*\).*!\1!p" )              sed -ne "s!^$BOOT_DEVICE on \([^ ]*\).*!\1!p" )
   
     if [ ! "$boot_mount" ]; then      if [ ! "$boot_mount" ]; then
         mount $BOOT_DEVICE /mnt          mount $BOOT_DEVICE /mnt
         boot_device_mounted=1          boot_device_mounted=1
         KERNEL_ROOT=/mnt  
     elif [ "$boot_mount" != "$default_mount" ]; then  
         KERNEL_ROOT=$boot_mount/  
     else  
         KERNEL_ROOT=${default_mount%/}/  
     fi      fi
 }  }
   
Line 149 
Line 143 
   
     local _cv=`echo $CUR_VER | sed -e 's/\.//'`      local _cv=`echo $CUR_VER | sed -e 's/\.//'`
     local _nv=`echo $NEW_VER | sed -e 's/\.//'`      local _nv=`echo $NEW_VER | sed -e 's/\.//'`
     local _v      local _v _d _pkr
   
     if [ X"No" != X"$FORCE_DIR" -a -d $FORCE_DIR ]; then      if [ X"No" != X"$FORCE_DIR" -a -d $FORCE_DIR ]; then
         _dir=$FORCE_DIR          _dir=$FORCE_DIR
Line 241 
Line 235 
     [ -z "$BOOT_DEVICE" ] && set_boot_device      [ -z "$BOOT_DEVICE" ] && set_boot_device
   
     mount_boot_device      mount_boot_device
   
       # _pkr == possible_kernel_roots
       _pkr=/
       [ "$BOOT_DEVICE" ] && _pkr="/mnt/ $_pkr"
   
       for _d in $_pkr; do
           KERNEL_ROOT=$( df -lnP ${_d}bsd 2>/dev/null | sed -ne 's!/dev/.* !!p' )
           [ "$KERNEL_ROOT" ] && break
       done
   
       if ![ "$KERNEL_ROOT" ]; then
           echo "Unable to find KERNEL_ROOT, tried $_pkr" >&2
           exit 2
       fi
   
     cd $KERNEL_ROOT      cd $KERNEL_ROOT
     BOOT_KERNEL=$( find_boot_kernel )      BOOT_KERNEL=$( find_boot_kernel )
     BOOT_KERNEL_VERSION=$( kernel_file_version $BOOT_KERNEL )      BOOT_KERNEL_VERSION=$( kernel_file_version $BOOT_KERNEL )
Line 425 
Line 434 
   
 install_kernels() {  install_kernels() {
     local _d="$1"      local _d="$1"
     local default_mount  
     local boot_mount      local boot_mount
     local mount_is_msdos      local mount_is_msdos
   
     if [ "$_d" ]; then      if [ "$_d" ]; then
       _d=$( readlink -nf "$_d" )        _d=$( readlink -nf "$_d" )
     else      else
         default_mount=$( df -lnP /bsd | sed -ne 's!/dev/.* !!p' )  
         mount_boot_device          mount_boot_device
   
         if [ "$KERNEL_ROOT" != "$default_mount" ]; then          if [ "$KERNEL_ROOT" != "/" ]; then
                 local _ik="$INSTALL_KERNELS"                  local _ik="$INSTALL_KERNELS"
                 INSTALL_KERNELS="$BOOT_KERNEL bsd.rd"                  INSTALL_KERNELS="$BOOT_KERNEL bsd.rd"
   
Line 446 
Line 453 
   
         umount_boot_device          umount_boot_device
   
         install_kernels $default_mount          install_kernels /
         return          return
     fi      fi
   
Line 457 
Line 464 
         exit 1          exit 1
     fi      fi
   
       [ $_d != / ] && _d=${_d%/}/
     [ $_d != / ] && mount | grep -q " on ${_d%/} .* msdos" && mount_is_msdos=1      [ $_d != / ] && mount | grep -q " on ${_d%/} .* msdos" && mount_is_msdos=1
     [ $_d != / ] && $_d=$_d/  
   
     if [ X"$BOOT_KERNEL_VERSION" != X"$NEW_KERNEL_VERSION" ]; then      if [ X"$BOOT_KERNEL_VERSION" != X"$NEW_KERNEL_VERSION" ]; then
         echo "===> Backing up $BOOT_KERNEL to ${_d}obsd"          echo "===> Backing up $BOOT_KERNEL to ${_d}obsd"

Legend:
Removed from v.1.110  
changed lines
  Added in v.1.111

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