File: libglobus-gssapi-error-doc.postrm

package info (click to toggle)
globus-gssapi-error 5.4-3~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 1,400 kB
  • sloc: sh: 11,131; ansic: 367; makefile: 133
file content (46 lines) | stat: -rw-r--r-- 1,137 bytes parent folder | download
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
#!/bin/sh

set -e

##
## Functions to replace a symlink with a directory
## Backported from jessie's version of dpkg-maintscript-helper
##
symlink_to_dir() {
	local SYMLINK="$1"
	local SYMLINK_TARGET="$2"
	local LASTVERSION="$3"
	local PACKAGE="$4"

	# Skip remaining parameters up to --
	while [ "$1" != "--" -a $# -gt 0 ]; do shift; done
	shift

	if [ "$1" = "purge" ] && [ -h "${SYMLINK}.dpkg-backup" ]; then
	    rm -f "${SYMLINK}.dpkg-backup"
	fi
	if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ] &&
	   [ -n "$2" ] &&
	   [ ! -e "$SYMLINK" ] && [ -h "${SYMLINK}.dpkg-backup" ] &&
	   symlink_match "${SYMLINK}.dpkg-backup" "$SYMLINK_TARGET" &&
	   dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
		echo "Restoring backup of $SYMLINK ..."
		mv "${SYMLINK}.dpkg-backup" "$SYMLINK"
	fi
}

symlink_match()
{
	local SYMLINK="$1"
	local SYMLINK_TARGET="$2"

	[ "$(readlink $SYMLINK)" = "$SYMLINK_TARGET" ] || \
	[ "$(readlink -f $SYMLINK)" = "$SYMLINK_TARGET" ]
}

#DEBHELPER#

symlink_to_dir \
    /usr/share/doc/libglobus-gssapi-error-doc \
    libglobus-gssapi-error-dev 5.4-2~ \
    libglobus-gssapi-error-doc -- "$@"