Fix "freebsd-update rollback" applied to minor-version upgrades: Old

shared object files which have the same name as currently-installed
shared object files should be reinstalled after binaries are rolled
back.  The order for rolling back updates is therefore
1. Install any old shared object files which can be installed without
overwriting a new shared object file.
2. Rollback everything which isn't a shared object or kernel file.
3. Rollback any shared object files which we didn't deal with in (1).
4. Rollback to the old kernel.

Bug reported by:	Jan Henrik Sylvester
MFC after:		3 days
This commit is contained in:
Colin Percival 2007-11-16 13:57:41 +00:00
parent 1bf7496cff
commit 1ec4fb3aa4

View File

@ -2628,9 +2628,16 @@ rollback_setup_rollback () {
# Install old files, delete new files, and update linker.hints
rollback_files () {
# Install old shared library files
# Install old shared library files which don't have the same path as
# a new shared library file.
grep -vE '^/boot/' $1/INDEX-NEW |
grep -E '/lib/.*\.so\.[0-9]+' |
cut -f 1 -d '|' |
sort > INDEX-NEW.libs.flist
grep -vE '^/boot/' $1/INDEX-OLD |
grep -E '/lib/.*\.so\.[0-9]+' > INDEX-OLD
grep -E '/lib/.*\.so\.[0-9]+' |
sort -k 1,1 -t '|' - |
join -t '|' -v 1 - INDEX-NEW.libs.flist > INDEX-OLD
install_from_index INDEX-OLD || return 1
# Deal with files which are neither kernel nor shared library
@ -2641,6 +2648,13 @@ rollback_files () {
install_from_index INDEX-OLD || return 1
install_delete INDEX-NEW INDEX-OLD || return 1
# Install any old shared library files which we didn't install above.
grep -vE '^/boot/' $1/INDEX-OLD |
grep -E '/lib/.*\.so\.[0-9]+' |
sort -k 1,1 -t '|' - |
join -t '|' - INDEX-NEW.libs.flist > INDEX-OLD
install_from_index INDEX-OLD || return 1
# Delete unneeded shared library files
grep -vE '^/boot/' $1/INDEX-OLD |
grep -E '/lib/.*\.so\.[0-9]+' > INDEX-OLD