Project

General

Profile

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

root / debian / corbo.postinst @ e090253d

1
#! /bin/sh
2

    
3
set -e
4

    
5
NAME="corbo"
6
USER=$NAME
7
GROUP=$NAME
8
CONFIG_DIR="/etc/$NAME"
9
MANAGE_SCRIPT="/usr/bin/$NAME-manage"
10

    
11
case "$1" in
12
  configure)
13

    
14
    # make sure the administrative user exists
15
    if ! getent passwd $USER >/dev/null; then
16
      adduser --disabled-password  --quiet --system \
17
        --no-create-home --home /var/lib/$NAME \
18
        --gecos "$NAME user" --group $USER
19
    fi
20
    # ensure dirs ownership
21
    chown $USER:$GROUP /var/log/$NAME
22
    chown $USER:$GROUP /var/lib/$NAME/collectstatic
23
    chown $USER:$GROUP /var/lib/$NAME/tenants
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

    
34
  triggered)
35
      su -s /bin/sh -c "$MANAGE_SCRIPT hobo_deploy --redeploy" $USER
36
  ;;
37

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

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

    
47
#DEBHELPER#
48

    
49
exit 0
(9-9/16)