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

Last change on this file since 4487 was 4487, checked in by hectorgh, 4 years ago

making sure it installs smoothly

File size: 1.5 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        # Creating link for index.php to main.php
35        [ -L ${LINK_NAME}/index.php ] || ln -s  ${LINK_NAME}/main.php ${LINK_NAME}/index.php
36       
37       
38        if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
39                . /usr/share/apache2/apache2-maintscript-helper
40                apache2_invoke ensite admin-center || true
41                invoke-rc.d apache2 reload || true
42        fi
43               
44
45    ;;
46
47    abort-upgrade|abort-remove|abort-deconfigure)
48        rm ${LINK_NAME}
49    ;;
50
51    *)
52        echo "postinst called with unknown argument \`$1'" >&2
53        exit 1
54    ;;
55esac
56
57#DEBHELPER#
58
59exit 0
Note: See TracBrowser for help on using the repository browser.