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
This commit is contained in:
Colin Percival 2007-11-08 13:06:38 +00:00
parent a10b45505a
commit 2328d598d9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173441

View File

@ -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 |