=================================================================== RCS file: /cvs/openbsd/update_openbsd/update_openbsd,v retrieving revision 1.100 retrieving revision 1.101 diff -u -r1.100 -r1.101 --- openbsd/update_openbsd/update_openbsd 2017/12/11 01:48:08 1.100 +++ openbsd/update_openbsd/update_openbsd 2017/12/11 02:34:10 1.101 @@ -1,5 +1,5 @@ #!/bin/sh -# $AFresh1: update_openbsd,v 1.99 2017/12/11 01:45:45 andrew Exp $ +# $AFresh1: update_openbsd,v 1.100 2017/12/11 01:48:08 andrew Exp $ # # Copyright (c) 2012 Andrew Fresh # @@ -96,28 +96,25 @@ boot_device_mounted="" mount_boot_device() { - if [ "boot_device_mounted" ]; then - echo $boot_device_mounted - return - fi + [ "boot_device_mounted" ] && return local default_mount=$( df -lnP /bsd | sed -ne 's!/dev/.* !!p' ) local boot_mount=$( mount | sed -ne "s!^$BOOT_DEVICE on \([^ ]*\).*!\1!p" ) if [ ! "$boot_mount" ]; then - mount $BOOT_DEVICE /mnt - boot_device_mounted=/mnt - echo /mnt + mount $BOOT_DEVICE /mnt + boot_device_mounted="" + KERNEL_ROOT=/mnt elif [ "$boot_mount" != "$default_mount" ]; then - echo $boot_mount/ + KERNEL_ROOT=$boot_mount/ else - echo ${default_mount%/}/ + KERNEL_ROOT=${default_mount%/}/ fi } umount_boot_device() { - [ "$boot_device_mounted" ] && umount $boot_device_mounted + [ "$boot_device_mounted" ] && umount $BOOT_DEVICE boot_device_mounted="" } @@ -217,6 +214,9 @@ FTP=${MIRROR}/${_dir}/`machine` fi + KERNEL_ROOT="" + [ -z "$BOOT_DEVICE" ] && set_boot_device + BOOT_KERNEL=`( \ echo bsd; \ [ -e /boot.conf ] && sed -E '/^ *(set +image|boot) +/!d ; \ @@ -404,13 +404,13 @@ if [ ! "$_d" ]; then default_mount=$( df -lnP /bsd | sed -ne 's!/dev/.* !!p' ) - boot_mount=$( mount_boot_device ) + mount_boot_device - if [ "$boot_mount" != "$default_mount" ]; then + if [ "$KERNEL_ROOT" != "$default_mount" ]; then local _ik="$INSTALL_KERNELS" INSTALL_KERNELS="${BOOT_KERNEL#/} bsd.rd" - install_kernels $boot_mount/ + install_kernels $KERNEL_ROOT INSTALL_KERNELS="$_ik" fi @@ -593,7 +593,6 @@ export PKG_PATH TRUSTED_PKG_PATH set_version -[ -z "$BOOT_DEVICE" ] && set_boot_device TRUSTED_PKG_PATH=${TRUSTED_PKG_PATH:=/usr/ports/packages/`machine -a`/all} if [ "$FORCE_DIR" = "No" ]; then