diff options
author | Colin Percival <cperciva@FreeBSD.org> | 2007-11-08 13:06:38 +0000 |
---|---|---|
committer | Colin Percival <cperciva@FreeBSD.org> | 2007-11-08 13:06:38 +0000 |
commit | 2328d598d9c620bae06b03f7049a0fdf59f50905 (patch) | |
tree | 157607016bd6e6c59a172de905d2c99a7ae4446a /usr.sbin | |
parent | a10b45505a52d17b6efb98c7edf98448f2893b4a (diff) | |
download | src-2328d598d9c620bae06b03f7049a0fdf59f50905.tar.gz src-2328d598d9c620bae06b03f7049a0fdf59f50905.zip |
Two minor improvements uncovered by work on upgrading between releases:
* When installing updates, make sure that securelevel <= 0. Otherwise
we can't remove the schg flag from files.
* When preparing to download updates, check to see if we already have
them sitting in the /files/ directory. This saves bandwidth if users
run "freebsd-update fetch" more than once without installing updates
in between.
While I'm here, bump the copyright date.
MFC after: 3 days
Notes
Notes:
svn path=/head/; revision=173441
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/freebsd-update/freebsd-update.sh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 3c2ec9d83ad6..6fd8bde77d53 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -1,7 +1,7 @@ #!/bin/sh #- -# Copyright 2004-2006 Colin Percival +# Copyright 2004-2007 Colin Percival # All rights reserved # # Redistribution and use in source and binary forms, with or without @@ -538,6 +538,13 @@ install_check_params () { exit 1 fi + # Check that securelevel <= 0. Otherwise we can't update schg files. + if [ `sysctl -n kern.securelevel` -gt 0 ]; then + echo "Updates cannot be installed when the system securelevel" + echo "is greater than zero." + exit 1 + fi + # Check that we have a working directory _WORKDIR_bad="Directory does not exist or is not writable: " if ! [ -d "${WORKDIR}" -a -w "${WORKDIR}" ]; then @@ -1356,7 +1363,12 @@ fetch_files_prepare () { # List of files wanted cut -f 2 -d '|' < $3.hashes | - sort -u > files.wanted + sort -u | + while read HASH; do + if ! [ -f files/${HASH}.gz ]; then + echo ${HASH} + fi + done > files.wanted # Generate a list of unmodified files comm -12 $1.hashes $2.hashes | |