#!/bin/bash # # PostInst for llxcfg-httpd # Jr # Updated by Peri set -e APACHE_CRT="apache.crt" reload_apache() { if apache2ctl configtest 2>/dev/null; then invoke-rc.d apache2 force-reload || true else echo "Your apache2 configuration is broken, so we're not restarting it for you." fi } # main case "$1" in configure) #Enabling ssl module if it is not loaded already if [ ! -e /etc/apache2/mods-enabled/ssl.load ]; then a2enmod ssl >/dev/null || true fi #Enabling ssl module if it is not loaded already if [ ! -e /etc/apache2/mods-enabled/rewrite.load ]; then a2enmod rewrite >/dev/null || true fi #Generating (if no exist), default cert for apache2 localhost JR(Test) if ! lliurex-pki -s "$APACHE_CRT" > /dev/null 2>/dev/null ; then lliurex-pki -n "$APACHE_CRT" -u www-data -g www-data --selfsigned --rsa >/dev/null 2>/dev/null || true fi rc=0 HTTP_PKI_CRT="$(lliurex-pki -s "$APACHE_CRT")" || rc=$? if [ $rc -eq 0 ] ; then llxcfg-systemvars add HTTP_PKI_CRT="$HTTP_PKI_CRT" fi reload_apache ;; abort-upgrade|abort-remove|abort-deconfigure) echo "postinst called with argument \`$1'" >&2 exit 1 ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0