File: python-babel.preinst

package info (click to toggle)
python-babel 1.3%2Bdfsg.1-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 69,060 kB
  • ctags: 1,644
  • sloc: xml: 582,663; python: 9,389; makefile: 216; sh: 188
file content (42 lines) | stat: -rw-r--r-- 1,208 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
#!/bin/sh

set -e

error() {
	echo "error: $1" >&2
	exit 1
}

##
## Preinst functions to replace a directory with a symlink
##
dir_to_symlink_preinst() {
	local PATHNAME="$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 [ -n "$DPKG_MAINTSCRIPT_NAME" ] || error "environment variable DPKG_MAINTSCRIPT_NAME is required" 
	[ -n "$1" ] || error "maintainer script parameters are missing"

	[ -n "$2" ] && [ ! -h "$PATHNAME" ] && [ -d "$PATHNAME" ] && dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
		mv -f "$PATHNAME" "${PATHNAME}.dpkg-backup"
		mkdir "$PATHNAME"
		touch "$PATHNAME/.dpkg-staging-dir"
	fi
}

if [ "$1" = "install" -o "$1" = "upgrade" ] ; then
	if [ -e /usr/lib/python2.6/dist-packages/babel ] ; then
		dir_to_symlink_preinst /usr/lib/python2.6/dist-packages/babel/localedata ../../../../share/python-babel-localedata/localedata 1.3+dfsg.1-2.1~ python-babel -- "$@"
	fi
	dir_to_symlink_preinst /usr/lib/python2.7/dist-packages/babel/localedata ../../../../share/python-babel-localedata/localedata 1.3+dfsg.1-2.1~ python-babel -- "$@"
fi

#DEBHELPER#

exit 0