1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
#!/bin/sh -e
#DEBHELPER#
# Old subversion packages had a /usr/lib/subversion which is now in /usr/share.
# Create symlink for same, but this will fail if any files existed in
# /usr/lib/subversion which did not come from subversion-tools. That includes
# local admin files and files from other packages - but no such files exist
# in the Debian archive so these will be non-Debian packages.
#
# Yes, this whole situation is ugly. See bug #330824.
pkg=subversion-tools
olddir=/usr/lib/subversion
newdir=/usr/share/subversion
linktgt=../share/subversion
tmphack=$(getent passwd root | cut -f6 -d:)/${pkg}_upgrade_hack
if [ -L $olddir ]; then exit 0; fi
warn () { echo >&2 "$pkg: $*"; }
explain () {
warn ""
warn "As of Debian subversion 1.2.3dfsg1-1, $olddir"
warn "will be a link to $newdir."
warn "Please move all files out of $olddir and retry"
warn " dpkg --configure $pkg"
warn "If this is not possible, you may instead run"
warn " touch '$tmphack'"
warn " dpkg --configure $pkg"
warn "and the symlink will not be created."
exit 1
}
if [ -e "$tmphack" ]; then
warn "WARNING: $tmphack found"
warn "NOT creating link: $olddir -> $linktgt"
rm -f "$tmphack" || true
exit 0
fi
if [ -d $olddir ] &&
! find $olddir -depth -type d -print0 | xargs -0r rmdir; then
warn "Files exist in $olddir:"
cd $olddir; find . -type f | sed "s,^./,$pkg: ,"
warn "These files were either created locally or included"
warn "in a non-Debian package."
explain
fi
if [ -e $olddir ]; then
warn "$olddir exists but is not a directory."
explain
fi
ln -s $linktgt $olddir
|