File: preinst

package info (click to toggle)
logdata-anomaly-miner 0.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 712 kB
  • ctags: 500
  • sloc: python: 4,959; xml: 314; sh: 47; makefile: 13
file content (50 lines) | stat: -rwxr-xr-x 1,744 bytes parent folder | download | duplicates (5)
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
#!/bin/sh
# preinst script for logdata-anomaly-miner
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <new-preinst> `install'
#        * <new-preinst> `install' <old-version>
#        * <new-preinst> `upgrade' <old-version>
#        * <old-preinst> `abort-upgrade' <new-version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
    install)
# Create the user to run the analysis service.
    analysisGroup="aminer"
    if [ "$(getent group "${analysisGroup}")" = "" ]; then
# Add a separate group for aitmon.
# The group does not need to be a system group, but low gid is
# preferable to avoid mixing with user groups. Using '--system'
# flag would cause gid allocation to go down from UID_MIN, not
# up from SYS_GID_MIN, so avoid using --system.
        groupadd -K GID_MIN=100 -K GID_MAX=1000 "${analysisGroup}"
    fi

    analysisUser="aminer"
    if [ "$(getent passwd "${analysisUser}")" = "" ]; then
# Add a system user, set home directory to nonexisting directory
# to avoid loading of user-defined files. Create user without
# using '--system' flag, thus allocating UIDs upwards.
        useradd -M --shell /usr/sbin/nologin --gid "${analysisGroup}" -K PASS_MAX_DAYS=-1 -K UID_MIN=100 -K UID_MAX=999 --home /nonexistent "${analysisUser}"
# There is no way to make useradd ommit assignment of subuids,
# so remove them immediately on affected systems.
        if test -e /etc/subuid; then
            usermod --del-subuids 1-4294967295 --del-subgids 1-4294967295 "${analysisUser}"
        fi
    fi
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0