File: wesnoth-1.14-core.postinst

package info (click to toggle)
wesnoth-1.14 1%3A1.14.15-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 829,408 kB
  • sloc: cpp: 229,143; java: 29,664; python: 22,851; lisp: 7,550; javascript: 3,074; sh: 2,993; xml: 1,772; perl: 1,501; ansic: 1,083; makefile: 260; php: 98; sql: 47; sed: 44
file content (51 lines) | stat: -rw-r--r-- 1,363 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
47
48
49
50
51
#!/bin/sh
# postinst script for wesnoth-1.14-core
# Copyright 2010-2012 by Rhonda D'Vine <rhonda@debian.org>
# Licensed under MIT

set -e

divert_oldfiles()
{
	# programs
	for i in wesnoth wesnoth-smallgui wesnoth-editor; do
		if dpkg-divert --list /usr/games/$i | grep -q /usr/games/$i; then
			dpkg-divert --remove --package wesnoth-1.14-core \
				--rename /usr/games/$i 2>/dev/null || true
		fi
	done

	# manpages
	for i in ca_ES@valencia cs da de en_GB es et fi fr gl hu it ja \
		lt nl pl sk sr sr@latin sv tr zh_CN zh_TW; do
		if dpkg-divert --list /usr/share/man/$i/man6/wesnoth.6.gz | grep -q /usr/share/man/$i/man6/wesnoth.6.gz; then
			dpkg-divert --remove --package wesnoth-1.14-core \
				--rename /usr/share/man/$i/man6/wesnoth.6.gz 2>/dev/null || true
		fi
	done
}

setup_alternatives()
{
	# man 6 wesnoth
	slaves=$(for man in /usr/share/man/*/man6/wesnoth-1.14.6.gz; do \
		lang=$(echo $man | sed -e 's#.*/man/##;s#/man6.*##;'); \
		echo -n " --slave /usr/share/man/$lang/man6/wesnoth.6.gz wesnoth.$lang.6.gz $man"; \
	done)
	slaves="$slaves --slave /usr/share/man/man6/wesnoth.6.gz wesnoth.6.gz /usr/share/man/man6/wesnoth-1.14.6.gz"

	update-alternatives --install /usr/games/wesnoth wesnoth \
		/usr/games/wesnoth-1.14 114 \
		$slaves
}

case "$1" in
	configure|reconfigure)
		divert_oldfiles
		setup_alternatives
	;;
esac

#DEBHELPER#

exit 0