File: python3-babel.postinst

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 (41 lines) | stat: -rw-r--r-- 1,246 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
#!/bin/sh

set -e

##
## Postinst functions to replace a directory with a symlink
##
dir_to_symlink_postinst() {
	local PATHNAME="$1"
	local SYMLINK_TARGET="$2"
	local LASTVERSION="$3"
	local PACKAGE="$4"

	while [ "$1" != "--" -a $# -gt 0 ]; do shift; done
	shift

	if [ -d "${PATHNAME}.dpkg-backup" ] && [ ! -h "$PATHNAME" ] && [ -d "$PATHNAME" ] && [ -f "$PATHNAME/.dpkg-staging-dir" ] ; then
		# Move the contents of the staging directory to the symlink target,
		# as those are all new files installed between this package being
		# unpacked and configured.
		rm "$PATHNAME/.dpkg-staging-dir"
		find "$PATHNAME" -mindepth 1 -print0 | xargs -0 -i% mv -f "%" "$SYMLINK_TARGET/"

		# Remove the staging directory.
		rmdir "$PATHNAME"

		# Do the actual switch.
		ln -s "$SYMLINK_TARGET" "$PATHNAME"

		# We are left behind the old files owned by this package in the backup
		# directory, just remove it.
		rm -rf "${PATHNAME}.dpkg-backup"
	fi
}

if [ "$1" = "configure" ] ; then
	update-alternatives --install /usr/bin/pybabel pybabel /usr/bin/pybabel-python3 200
	dir_to_symlink_postinst /usr/lib/python3/dist-packages/babel/localedata ../../../../share/python-babel-localedata/localedata 1.3+dfsg.1-2.1~ python3-babel -- "$@"
fi

#DEBHELPER#