File: subversion-tools.postinst

package info (click to toggle)
subversion 1.6.12dfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 48,292 kB
  • ctags: 47,714
  • sloc: ansic: 578,414; python: 77,551; sh: 13,100; ruby: 12,194; cpp: 10,097; java: 8,428; lisp: 7,702; perl: 7,320; makefile: 1,035; xml: 759; sql: 62
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