File: conquest-server.postinst

package info (click to toggle)
conquest 8.1-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,984 kB
  • ctags: 3,086
  • sloc: ansic: 39,393; sh: 8,540; yacc: 446; makefile: 296; lex: 146
file content (55 lines) | stat: -rw-r--r-- 1,937 bytes parent folder | download | duplicates (2)
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
52
53
54
55
#! /bin/sh
# postinst script for conquest-server

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see /usr/share/doc/packaging-manual/
#
# quoting from the policy:
#     Any necessary prompting should almost always be confined to the
#     post-installation script, and should be protected with a conditional
#     so that unnecessary prompting doesn't happen if a package's
#     installation fails and the `postinst' is called with `abort-upgrade',
#     `abort-remove' or `abort-deconfigure'.
CONQUESTGROUP=conquest

case "$1" in
    configure)
    if CONQUESTGRENT="$(getent group $CONQUESTGROUP)"; then
	    # the group already exists! check that it's a system account
	    if [ "`echo $CONQUESTGRENT | cut -d : -f 3`" -ge 1000 ] ; then
		    # the group is a user group! abort!
		    echo "error: a \"$CONQUESTGROUP\" group with gid>=1000 already exists on your system.  Please remove it before installing this package."
		    exit 1
	    fi
    else
	    addgroup --system "$CONQUESTGROUP"
    fi

    chgrp "$CONQUESTGROUP" /usr/lib/games/conquest/conqdriv /usr/games/conqai /etc/conquest /usr/games/conquestd
    chmod 2755 /usr/lib/games/conquest/conqdriv /usr/games/conqai /usr/games/conquestd

    [ -f /var/games/conquest/conquest_common.img ] || /usr/games/conqoper -C
    [ -f /var/games/conquest/conquest.log ] || /usr/games/conqoper -Ie

    ;;

    abort-upgrade|abort-remove|abort-deconfigure)

    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 0
    ;;
esac

exit 0