Project

General

Profile

Download (1.13 KB) Statistics
| Branch: | Tag: | Revision:

root / debian / u-auth.postinst @ 75a981d9

1
#! /bin/sh
2

    
3
set -e
4

    
5
NAME="u-auth"
6
USER=$NAME
7
GROUP=$NAME
8
CONFIG_DIR="/etc/$NAME"
9

    
10
case "$1" in
11
  configure)
12

    
13
    # make sure the administrative user exists
14
    if ! getent passwd $USER >/dev/null; then
15
      adduser --disabled-password  --quiet --system \
16
        --no-create-home --home /var/lib/$NAME \
17
        --gecos "$NAME user" --group $USER
18
    fi
19
    # ensure dirs ownership
20
    chown $USER:$GROUP /var/log/$NAME
21
    chown $USER:$GROUP /var/lib/$NAME/collectstatic
22
    chown $USER:$GROUP /var/lib/$NAME/static
23
    chown $USER:$GROUP /var/lib/$NAME/media
24
    # create a secret file
25
    SECRET_FILE=$CONFIG_DIR/secret
26
    if [ ! -f $SECRET_FILE ]; then
27
        echo -n "Generating Django secret..." >&2
28
        cat /dev/urandom | tr -dc [:alnum:]-_\!\%\^:\; | head -c70 > $SECRET_FILE
29
        chown root:$GROUP $SECRET_FILE
30
        chmod 0440 $SECRET_FILE
31
    fi
32

    
33
    /usr/lib/u-auth/u-auth setup-slapd && /usr/lib/u-auth/u-auth setup-slapd && /usr/lib/u-auth/u-auth setup-radius
34
  ;;
35

    
36
  abort-upgrade|abort-remove|abort-deconfigure)
37
  ;;
38

    
39
  *)
40
    echo "postinst called with unknown argument \`$1'" >&2
41
    exit 1
42
  ;;
43
esac
44

    
45
#DEBHELPER#
46

    
47
exit 0
(16-16/16)