Projet

Général

Profil

Télécharger (1,09 ko) Statistiques
| Branche: | Tag: | Révision:

root / debian / u-auth.postinst @ 456248ac

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
34
    /usr/lib/u-auth/u-auth setup-radius
35
  ;;
36

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

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

    
46
#DEBHELPER#
47

    
48
exit 0
(16-16/16)