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

Last change on this file since 2115 was 2115, checked in by joamuran, 3 years ago

Encrypting credentials

File size: 1.1 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"
10LOGS_DIR="/tmp/taskslog"
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        # Generating keys
20        if [ ! -e ${CONFIG_PATH}/private_key.pem ]; then
21                openssl genrsa -out ${CONFIG_PATH}/private_key.pem 2048
22                openssl rsa -in ${CONFIG_PATH}/private_key.pem -out ${CONFIG_PATH}/public_key.pem -outform PEM -pubout
23        fi
24
25        # Generating links
26
27        ln -s  ${APP_NAME} ${LINK_NAME} || true
28        ln -s ${N4D_CERT_PATH} ${N4D_CERT_LINK} || true
29        ln -s ${LOGS_DIR} ${APP_NAME}/logs || true
30        ln -s ${CONFIG_PATH}/public_key.pem ${APP_NAME} || true
31       
32       
33        if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
34                . /usr/share/apache2/apache2-maintscript-helper
35                apache2_invoke ensite admin-center
36                invoke-rc.d apache2 reload
37        fi
38               
39
40    ;;
41
42    abort-upgrade|abort-remove|abort-deconfigure)
43        rm ${LINK_NAME}
44    ;;
45
46    *)
47        echo "postinst called with unknown argument \`$1'" >&2
48        exit 1
49    ;;
50esac
51
52#DEBHELPER#
53
54exit 0
Note: See TracBrowser for help on using the repository browser.