Debian Codegraph @

debian/apertium-apy.postinst

raw
1 #!/bin/sh
2 # postinst script for apertium
3 #
4 # see: dh_installdeb(1)
5
6 set -e
7
8 # summary of how this script can be called:
9 # * <postinst> `configure' <most-recently-configured-version>
10 # * <old-postinst> `abort-upgrade' <new version>
11 # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12 # <new-version>
13 # * <postinst> `abort-remove'
14 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15 # <failed-install-package> <version> `removing'
16 # <conflicting-package> <version>
17 # for details, see https://www.debian.org/doc/debian-policy/ or
18 # the debian-policy package
19
20
21 case "$1" in
22 configure)
23 # make sure that the apertium user exists. Simplest portable way to check
24 # is to chown something, so we'll create the directories that we need here.
25
26 makedir() {
27 if [ ! -d $1 ]; then
28 mkdir $1
29 fi
30 chown $2 $1 && chmod $3 $1
31 }
32
33 cd /var/log
34 makedir apertium root:root 700
35 chgrp apertium apertium 2>/dev/null || addgroup --system apertium
36 chown apertium apertium 2>/dev/null || adduser --system --home /var/lib/apertium --no-create-home \
37 --disabled-password --ingroup apertium apertium
38 # Now that we have the user ready, chown & chmod the log dir
39 makedir apertium apertium:apertium 700
40 ;;
41
42 abort-upgrade|abort-remove|abort-deconfigure)
43 ;;
44
45 *)
46 echo "postinst called with unknown argument \`$1'" >&2
47 exit 1
48 ;;
49 esac
50
51 # dh_installdeb will replace this with shell code automatically
52 # generated by other debhelper scripts.
53
54 #DEBHELPER#
55
56 exit 0