=================================================================== RCS file: /cvs/openbsd/update_openbsd/update_openbsd,v retrieving revision 1.115 retrieving revision 1.124 diff -u -r1.115 -r1.124 --- openbsd/update_openbsd/update_openbsd 2018/12/16 20:55:03 1.115 +++ openbsd/update_openbsd/update_openbsd 2019/03/31 22:10:01 1.124 @@ -1,5 +1,5 @@ #!/bin/sh -# $AFresh1: update_openbsd,v 1.114 2018/12/16 20:49:58 andrew Exp $ +# $AFresh1: update_openbsd,v 1.123 2019/03/02 01:05:59 andrew Exp $ # # Copyright (c) 2012 Andrew Fresh # @@ -172,7 +172,7 @@ if [ X"" != X"${MIRROR}" -a X"" == X"${_v}" ]; then if [ X"No" != X"${FORCE_DIR}" ]; then _dir=${FORCE_DIR} - elif sysctl kern.version | grep -q -- '-current '; then + elif sysctl kern.version | grep -q -e '-current ' -e '-beta '; then _dir=snapshots FORCE_DIR=snapshots else @@ -251,10 +251,13 @@ fi cd $KERNEL_ROOT - BOOT_KERNEL=$( find_boot_kernel ) - BOOT_KERNEL_VERSION=$( kernel_file_version $BOOT_KERNEL ) - if [ $(sysctl -n hw.ncpufound) -gt 1 ] || kernel_is_multiprocessor $BOOT_KERNEL; then + BOOTED_KERNEL=$( find_boot_kernel ) + BOOT_KERNEL_VERSION=$( kernel_file_version $BOOTED_KERNEL ) + + if [ $(sysctl -n hw.ncpufound) -gt 1 ] || kernel_is_multiprocessor $BOOTED_KERNEL; then BOOT_KERNEL=bsd.mp + else + BOOT_KERNEL=$BOOTED_KERNEL fi BOOTED_KERNEL_VERSION=`sysctl -n kern.version` @@ -486,19 +489,19 @@ [ $_d != / ] && mount | grep -q " on ${_d%/} .* msdos" && mount_is_msdos=1 if [ "$EFI_BOOT" -a -d /mnt/efi/boot ]; then - echo "Copying $EFI_BOOT to /mnt/efi/boot/$EFI_BOOT" + echo "Copying $EFI_BOOT to /mnt/efi/boot/" ( cd /mnt/efi/boot \ - && cp "$RELEASEDIR/$EFI_BOOT" "n$EFI_BOOT" + && cp "$RELEASEDIR/$EFI_BOOT" "n$EFI_BOOT" \ && mv "n$EFI_BOOT" "$EFI_BOOT" ) fi if [ X"$BOOT_KERNEL_VERSION" != X"$NEW_KERNEL_VERSION" ]; then - echo "===> Backing up ${_d}$BOOT_KERNEL to ${_d}obsd" + echo "===> Backing up ${_d}$BOOTED_KERNEL to ${_d}obsd" if [ $mount_is_msdos ]; then - cp ${_d}$BOOT_KERNEL ${_d}obsd + cp ${_d}$BOOTED_KERNEL ${_d}obsd else - ln -f ${_d}$BOOT_KERNEL ${_d}obsd + ln -f ${_d}$BOOTED_KERNEL ${_d}obsd fi if [ $? -ne 0 ]; then echo "Error copying old kernel!" >&2 @@ -646,6 +649,9 @@ . ${HOME}/.update_openbsdrc fi +if [ -z "$MIRROR" -a -e /etc/installurl ]; then + MIRROR=$(< /etc/installurl) +fi MIRROR=${MIRROR:=http://cdn.openbsd.org/pub/OpenBSD} FTP_CMD=${FTP_CMD:=ftp -V} @@ -715,7 +721,7 @@ echo "===> Last booted:\n$BOOTED_KERNEL_VERSION" if [ X"$BOOT_KERNEL_VERSION" != X"$BOOTED_KERNEL_VERSION" \ -a X"$BOOT_KERNEL_VERSION" != X"$NEW_KERNEL_VERSION" ]; then - echo "Next boot (unless replaced):\n$BOOT_KERNEL_VERSION" + echo "Next boot $BOOTED_KERNEL (unless replaced):\n$BOOT_KERNEL_VERSION" fi if [ -n "$NEW_KERNEL_VERSION" ]; then echo "===> New $BOOT_KERNEL:\n$NEW_KERNEL_VERSION"; @@ -760,6 +766,11 @@ echo Removing /sbin/oreboot rm -f /sbin/oreboot fi + + echo "===> Relinking to create unique kernel..." + sha256 -h /var/db/kernel.SHA256 /bsd + /usr/libexec/reorder_kernel + update_etc OPENUP=$( which openup 2>/dev/null ) @@ -767,6 +778,10 @@ echo "==> UPDATING WITH $OPENUP" $OPENUP else + if [ X"snapshots" != X"$FORCE_DIR" ]; then + echo '==> RUNNING SYSPATCH' + syspatch + fi echo '==> UPDATING PACKAGES' pkg_add -u fi