source: admin-center/trunk/fuentes/debian/admin-center.postinst @ 3126

Last change on this file since 3126 was 3126, checked in by joamuran, 4 years ago

fixed

File size: 1.3 KB
Line 
1#!/bin/sh
2# postinst script for admin-center
3#
4# see: dh_installdeb(1)
5
6set -e
7
8LINK_NAME="/var/www/admin-center"
9APP_NAME="/usr/share/admin-center"
10# LOGS_DIR="/run/taskmanager"
11N4D_CERT_PATH="/etc/n4d/cert/n4dcert.pem"
12N4D_CERT_LINK="${APP_NAME}/n4dcert.pem"
13CONFIG_PATH="/etc/admin-center"
14
15
16case "$1" in
17    configure)
18
19        [ -d ${CONFIG_PATH} ] || mkdir ${CONFIG_PATH}
20
21        # Generating keys
22        if [ ! -e ${CONFIG_PATH}/private_key.pem ]; then 
23                openssl genrsa -out ${CONFIG_PATH}/private_key.pem 2048
24                openssl rsa -in ${CONFIG_PATH}/private_key.pem -out ${CONFIG_PATH}/public_key.pem -outform PEM -pubout
25        fi
26
27        # Generating links
28
29        [ -L ${LINK_NAME} ] || ln -s  ${APP_NAME} ${LINK_NAME}
30        [ -L ${N4D_CERT_LINK} ] || ln -s ${N4D_CERT_PATH} ${N4D_CERT_LINK}
31        # [ -L ${APP_NAME}/logs ] || ln -s ${LOGS_DIR} ${APP_NAME}/logs || true
32        [ -L ${APP_NAME}/public_key.pem ] || ln -s ${CONFIG_PATH}/public_key.pem ${APP_NAME}/public_key.pem || true
33       
34       
35        if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
36                . /usr/share/apache2/apache2-maintscript-helper
37                apache2_invoke ensite admin-center
38                invoke-rc.d apache2 reload
39        fi
40               
41
42    ;;
43
44    abort-upgrade|abort-remove|abort-deconfigure)
45        rm ${LINK_NAME}
46    ;;
47
48    *)
49        echo "postinst called with unknown argument \`$1'" >&2
50        exit 1
51    ;;
52esac
53
54#DEBHELPER#
55
56exit 0
Note: See TracBrowser for help on using the repository browser.