summaryrefslogtreecommitdiffstats
path: root/usr.sbin/freebsd-update
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2007-11-08 13:06:38 +0000
committercperciva <cperciva@FreeBSD.org>2007-11-08 13:06:38 +0000
commit0033cd00be808341b0532f104df8a5c40837b5c5 (patch)
tree157607016bd6e6c59a172de905d2c99a7ae4446a /usr.sbin/freebsd-update
parent4780de32f2215ac673e12a962d571b381f236903 (diff)
downloadFreeBSD-src-0033cd00be808341b0532f104df8a5c40837b5c5.zip
FreeBSD-src-0033cd00be808341b0532f104df8a5c40837b5c5.tar.gz
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
Diffstat (limited to 'usr.sbin/freebsd-update')
-rw-r--r--usr.sbin/freebsd-update/freebsd-update.sh16
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 3c2ec9d..6fd8bde 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 |
OpenPOWER on IntegriCloud