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

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

fixed

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