summaryrefslogtreecommitdiffstats
path: root/usr.sbin/freebsd-update
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2006-11-25 07:30:12 +0000
committercperciva <cperciva@FreeBSD.org>2006-11-25 07:30:12 +0000
commitdfe35d545b55b8589aac7c6cd049136abecf1516 (patch)
treea3eea2195e8286a731783fb685662526f36ec44b /usr.sbin/freebsd-update
parent224cafa6b03efdb09569a90000ff61fcd409730c (diff)
downloadFreeBSD-src-dfe35d545b55b8589aac7c6cd049136abecf1516.zip
FreeBSD-src-dfe35d545b55b8589aac7c6cd049136abecf1516.tar.gz
Three minor bug fixes:
1. When downloading metadata files, make sure we only download each file once; without this fix, "freebsd-update fetch" will fail the first time it is run if there have been no updates yet for the installed release. 2. If the FOO kernel is installed in /boot/kernel instead of /boot/FOO and the /boot/FOO directory does not exist, don't try to update /boot/FOO. This is an issue only where an update involves adding a new kernel module. 3. When removing files and directories, operate in reverse lexographical order, in order to ensure that files are removed before the directory which contains them. MFC after: 3 days
Diffstat (limited to 'usr.sbin/freebsd-update')
-rw-r--r--usr.sbin/freebsd-update/freebsd-update.sh26
1 files changed, 18 insertions, 8 deletions
diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh
index 9db0c6c..f290db1 100644
--- a/usr.sbin/freebsd-update/freebsd-update.sh
+++ b/usr.sbin/freebsd-update/freebsd-update.sh
@@ -997,7 +997,8 @@ fetch_metadata () {
if [ ! -f "files/${Y}.gz" ]; then
echo ${Y};
fi
- done > filelist
+ done |
+ sort -u > filelist
if [ -s filelist ]; then
echo -n "Fetching `wc -l < filelist | tr -d ' '` "
@@ -1077,16 +1078,24 @@ fetch_filter_metadata () {
rm $1.all $1.tmp
}
-# Filter the metadata file $1 by adding lines with
-# /boot/`uname -i`
-# replaced by
-# /boot/kernel
-# (or more generally, `sysctl -n kern.bootfile` minus the trailing "/kernel").
+# Filter the metadata file $1 by adding lines with "/boot/`uname -i`"
+# replaced by ${KERNELDIR} (which is `sysctl -n kern.bootfile` minus the
+# trailing "/kernel"); and if "/boot/`uname -i`" does not exist, remove
+# the original lines which start with that.
+# Put another way: Deal with the fact that the FOO kernel is sometimes
+# installed in /boot/FOO/ and is sometimes installed elsewhere.
fetch_filter_kernel_names () {
- grep ^/boot/`uname -i` $1 |
- sed -e "s,/boot/`uname -i`,${KERNELDIR}," |
+ KERNCONF=`uname -i`
+
+ grep ^/boot/${KERNCONF} $1 |
+ sed -e "s,/boot/${KERNCONF},${KERNELDIR},g" |
sort - $1 > $1.tmp
mv $1.tmp $1
+
+ if ! [ -d /boot/${KERNCONF} ]; then
+ grep -v ^/boot/${KERNCONF} $1 > $1.tmp
+ mv $1.tmp $1
+ fi
}
# For all paths appearing in $1 or $3, inspect the system
@@ -1746,6 +1755,7 @@ install_delete () {
# Generate subindex of old files we want to nuke
sort -k 1,1 -t '|' $1 |
join -t '|' -v 1 - newfiles |
+ sort -r -k 1,1 -t '|' |
cut -f 1,2 -d '|' |
tr '|' ' ' > killfiles
OpenPOWER on IntegriCloud