File: subversion-tools.postinst

package info (click to toggle)
subversion 1.4.2dfsg1-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 37,268 kB
  • ctags: 32,888
  • sloc: ansic: 406,472; python: 38,378; sh: 15,248; cpp: 9,604; ruby: 8,313; perl: 5,308; java: 4,576; lisp: 3,860; xml: 3,298; makefile: 856
file content (54 lines) | stat: -rw-r--r-- 1,590 bytes parent folder | download | duplicates (5)
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