diff options
author | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2019-05-14 14:27:50 +0000 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2019-05-14 14:27:50 +0000 |
commit | d31d46c58913b7fc7b3e4fbfaa4682fca16f9dd0 (patch) | |
tree | 5ba844ff90b53899cf4ff643d04f03e913168f14 /usr.sbin | |
parent | 985a2ecd25c6ae0323c36eaddffe762ad568a220 (diff) |
Revert my recent sysupgrade changes; it broke unattended upgrades for
espie@. Need to look deeper.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/sysupgrade/sysupgrade.sh | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/usr.sbin/sysupgrade/sysupgrade.sh b/usr.sbin/sysupgrade/sysupgrade.sh index 6b16d494fb8..3f8a7f92e19 100644 --- a/usr.sbin/sysupgrade/sysupgrade.sh +++ b/usr.sbin/sysupgrade/sysupgrade.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: sysupgrade.sh,v 1.20 2019/05/13 02:25:16 ajacoutot Exp $ +# $OpenBSD: sysupgrade.sh,v 1.21 2019/05/14 14:27:49 ajacoutot Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015 Robert Peichaer <rpe@openbsd.org> @@ -24,6 +24,7 @@ set -e umask 0022 ARCH=$(uname -m) +SETSDIR=/home/_sysupgrade ug_err() { @@ -56,17 +57,6 @@ unpriv() return ${_rc} } -# df(1) is run twice to sort our prefered FS list first -get_prefetcharea() { - { df -kl /{tmp,home,usr{/local,}}; df -kl ;} | - while read a a a a m m; do - [[ $m == /@(tmp|home|usr/@(src,obj,xobj))@(|/*) ]] && - ((a > 524288)) && echo $m && break - [[ $m == @(|/*) ]] && - ((a > 524288 * 4)) && echo $m && break - done -} - # Remove all occurrences of first argument from list formed by the remaining # arguments. rmel() { @@ -128,20 +118,16 @@ else URL=${MIRROR}/${NEXT_VERSION}/${ARCH}/ fi -SETSDIR=$(mktemp -d -p $(get_prefetcharea) .sysupgrade.XXXXXXXXXX) - -if [[ -n ${SETSDIR} ]]; then - install -d -o 0 -g 0 -m 0755 ${SETSDIR} - cat <<-__EOT >/auto_upgrade.conf - Location of sets = disk - Pathname to the sets = ${SETSDIR} - Set name(s) = done - Directory does not contain SHA256.sig. Continue without verification = yes - __EOT - ${KEEP} || echo "rm -rf -- \"${SETSDIR}\"" >>/etc/rc.firsttime - +if [[ -e ${SETSDIR} ]]; then + eval $(stat -s ${SETSDIR}) + [[ $st_uid -eq 0 ]] || + ug_err "${SETSDIR} needs to be owned by root:wheel" + [[ $st_gid -eq 0 ]] || + ug_err "${SETSDIR} needs to be owned by root:wheel" + [[ $st_mode -eq 040755 ]] || + ug_err "${SETSDIR} is not a directory with permissions 0755" else - ug_err "Not enough space to fetch sets" + mkdir -p ${SETSDIR} fi cd ${SETSDIR} @@ -194,6 +180,8 @@ if [[ -n ${DL} ]]; then unpriv cksum -qC SHA256 ${DL} fi +${KEEP} && > keep + cp bsd.rd /nbsd.upgrade ln -f /nbsd.upgrade /bsd.upgrade rm /nbsd.upgrade |