version 1.100, 2017/12/11 01:48:08 |
version 1.102, 2017/12/11 02:36:03 |
|
|
#!/bin/sh |
#!/bin/sh |
# $AFresh1: update_openbsd,v 1.99 2017/12/11 01:45:45 andrew Exp $ |
# $AFresh1: update_openbsd,v 1.101 2017/12/11 02:34:10 andrew Exp $ |
# |
# |
# Copyright (c) 2012 Andrew Fresh <andrew@afresh1.com> |
# Copyright (c) 2012 Andrew Fresh <andrew@afresh1.com> |
# |
# |
|
|
|
|
boot_device_mounted="" |
boot_device_mounted="" |
mount_boot_device() { |
mount_boot_device() { |
if [ "boot_device_mounted" ]; then |
[ "boot_device_mounted" ] && return |
echo $boot_device_mounted |
|
return |
|
fi |
|
|
|
local default_mount=$( df -lnP /bsd | sed -ne 's!/dev/.* !!p' ) |
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=/mnt |
boot_device_mounted=1 |
echo /mnt |
KERNEL_ROOT=/mnt |
elif [ "$boot_mount" != "$default_mount" ]; then |
elif [ "$boot_mount" != "$default_mount" ]; then |
echo $boot_mount/ |
KERNEL_ROOT=$boot_mount/ |
else |
else |
echo ${default_mount%/}/ |
KERNEL_ROOT=${default_mount%/}/ |
fi |
fi |
} |
} |
|
|
umount_boot_device() { |
umount_boot_device() { |
[ "$boot_device_mounted" ] && umount $boot_device_mounted |
[ "$boot_device_mounted" ] && umount $BOOT_DEVICE |
boot_device_mounted="" |
boot_device_mounted="" |
} |
} |
|
|
|
|
FTP=${MIRROR}/${_dir}/`machine` |
FTP=${MIRROR}/${_dir}/`machine` |
fi |
fi |
|
|
|
KERNEL_ROOT="" |
|
[ -z "$BOOT_DEVICE" ] && set_boot_device |
|
|
BOOT_KERNEL=`( \ |
BOOT_KERNEL=`( \ |
echo bsd; \ |
echo bsd; \ |
[ -e /boot.conf ] && sed -E '/^ *(set +image|boot) +/!d ; \ |
[ -e /boot.conf ] && sed -E '/^ *(set +image|boot) +/!d ; \ |
|
|
|
|
if [ ! "$_d" ]; then |
if [ ! "$_d" ]; then |
default_mount=$( df -lnP /bsd | sed -ne 's!/dev/.* !!p' ) |
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" |
local _ik="$INSTALL_KERNELS" |
INSTALL_KERNELS="${BOOT_KERNEL#/} bsd.rd" |
INSTALL_KERNELS="${BOOT_KERNEL#/} bsd.rd" |
|
|
install_kernels $boot_mount/ |
install_kernels $KERNEL_ROOT |
|
|
INSTALL_KERNELS="$_ik" |
INSTALL_KERNELS="$_ik" |
fi |
fi |
|
|
export PKG_PATH TRUSTED_PKG_PATH |
export PKG_PATH TRUSTED_PKG_PATH |
|
|
set_version |
set_version |
[ -z "$BOOT_DEVICE" ] && set_boot_device |
|
|
|
TRUSTED_PKG_PATH=${TRUSTED_PKG_PATH:=/usr/ports/packages/`machine -a`/all} |
TRUSTED_PKG_PATH=${TRUSTED_PKG_PATH:=/usr/ports/packages/`machine -a`/all} |
if [ "$FORCE_DIR" = "No" ]; then |
if [ "$FORCE_DIR" = "No" ]; then |