=================================================================== RCS file: /cvs/openbsd/update_openbsd/update_openbsd,v retrieving revision 1.104 retrieving revision 1.108 diff -u -r1.104 -r1.108 --- openbsd/update_openbsd/update_openbsd 2017/12/11 02:53:13 1.104 +++ openbsd/update_openbsd/update_openbsd 2018/02/08 19:07:06 1.108 @@ -1,5 +1,5 @@ #!/bin/sh -# $AFresh1: update_openbsd,v 1.103 2017/12/11 02:50:09 andrew Exp $ +# $AFresh1: update_openbsd,v 1.107 2018/02/08 18:46:46 andrew Exp $ # # Copyright (c) 2012 Andrew Fresh # @@ -52,6 +52,10 @@ #what $1 | sed -ne 's/[[:blank:]]\{1,\}//p' } +kernel_is_multiprocessor() { + printf "find cpu*\nexit\n" | config -e $1 2>/dev/null | grep -q "cpu\* at " +} + version_in() { local _proto=${FTP%%://*} local _file @@ -239,8 +243,9 @@ cd $KERNEL_ROOT BOOT_KERNEL=$( find_boot_kernel ) BOOT_KERNEL_VERSION=$( kernel_file_version $BOOT_KERNEL ) - cd $OLDPWD - umount_boot_device + if [ $(sysctl -n hw.ncpufound) -gt 1 ] || kernel_is_multiprocessor $BOOT_KERNEL; then + BOOT_KERNEL=bsd.mp + fi BOOTED_KERNEL_VERSION=`sysctl -n kern.version` NEW_KERNEL_VERSION="" @@ -251,15 +256,19 @@ 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 - if [ X"$INSTALL_KERNELS" != X"bsd.mp" ]; then - local _ncpu=$(sysctl -n hw.ncpufound) - [ $_ncpu -gt 1 ] && INSTALL_KERNELS="$INSTALL_KERNELS bsd.mp" - fi - # or just bsd otherwise - if [ X"${INSTALL_KERNELS% *}" != X"bsd" ]; then - INSTALL_KERNELS="$INSTALL_KERNELS bsd" - fi + + # We want to update all kernels that exist + # either in the $KERNEL_ROOT or in / + for b in bsd bsd.mp; do + [ -e $b -o -e /$b ] || continue + if [ X"${INSTALL_KERNELS% *}" != X"$b" ]; then + INSTALL_KERNELS="$INSTALL_KERNELS $b" + fi + done + + cd $OLDPWD + umount_boot_device + BOOT_KERNELS=$INSTALL_KERNELS INSTALL_KERNELS="$INSTALL_KERNELS bsd.rd" } @@ -450,9 +459,9 @@ if [ X"$BOOT_KERNEL_VERSION" != X"$NEW_KERNEL_VERSION" ]; then echo "===> Backing up $BOOT_KERNEL to ${_d}obsd" if [ $mount_is_msdos ]; then - cp $BOOT_KERNEL ${_d}obsd + cp ${_d}$BOOT_KERNEL ${_d}obsd else - ln -f $BOOT_KERNEL ${_d}obsd + ln -f ${_d}$BOOT_KERNEL ${_d}obsd fi if [ $? -ne 0 ]; then echo "Error copying old kernel!" >&2 @@ -600,7 +609,7 @@ . ${HOME}/.update_openbsdrc fi -MIRROR=${MIRROR:=http://fastly.cdn.openbsd.org/pub/OpenBSD} +MIRROR=${MIRROR:=http://cdn.openbsd.org/pub/OpenBSD} FTP_CMD=${FTP_CMD:=ftp -V} DESTDIR=${DESTDIR:=/}