aboutsummaryrefslogtreecommitdiffstats
path: root/www/raqdevil/pkg-install
blob: 5b60bc77f9e8e06f59f6dfa15fbdebd165e409a3 (plain) (blame)
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
56
#!/bin/sh

PREF=${PREFIX:-$PKG_PREFIX}
PATH=/bin:/usr/sbin:/usr/bin

case $2 in
POST-INSTALL)
    GROUP=users

    if pw group show "${GROUP}" 2>/dev/null; then
        echo "You already have a group \"${GROUP}\", so I will use it."
    else
        if pw groupadd ${GROUP}; then
            echo "Added group \"${GROUP}\"."
        else
            echo "Adding group \"${GROUP}\" failed..."
            exit 1
        fi
    fi

    /usr/bin/touch /etc/mail/access;

    mkdir -p ${PREF}/raqdevil/ui/web/base/sitestats/img;
    chown www:wheel ${PREF}/raqdevil/ui/web/base/sitestats/img;
    mkdir -p ${PREF}/raqdevil/sessions;

    /usr/bin/touch ${PREF}/etc/apache2/httpd.local.conf
    /usr/bin/touch ${PREF}/etc/apache2/httpd.raqdevil.conf

    # generate certificates if required
    CERTPATH=${PREF}/admserv/certs
    KEYPATH=${CERTPATH}/key
    CSRPATH=${CERTPATH}/request
    CRTPATH=${CERTPATH}/certificate

    mkdir -p ${CERTPATH}

    if [ ! -f ${KEYPATH} ]; then
            openssl genrsa -out ${KEYPATH} 2048
    fi
    if [ ! -f ${CSRPATH} ]; then
            openssl req -new -key ${KEYPATH} -out ${CSRPATH}
    fi
    if [ ! -f ${CRTPATH} ]; then
            openssl x509 -req -days 365 -in ${CSRPATH} -signkey ${KEYPATH} -out ${CRTPATH}
    fi

    # fix up the apache httpd.conf file using database values
    # probably should use /usr/local/raqdevil/bin/cce_construct instead
    # to make a package install work correctly
    ${PREF}/raqdevil/constructor/base/apache/processAdvise.pl


    ( cd /etc/namedb; sh /etc/namedb/make-localhost )
    ;;
esac