| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | if [scip-shell system . . `[`. "$1" != "configure" ]; then |
| 6 | exit 0 |
| 7 | fi |
| 8 | |
| 9 | . /usr/share/debconf/confmodulescip-shell source . . `/usr/share/debconf/confmodule`. |
| 10 | db_version 2.0 || [scip-shell system . . `[`. $? -lt 30 ] |
| 11 | |
| 12 | cd /usr/share/ldap-account-manager/config-samples/profilesscip-shell filesystem . . `/usr/share/ldap-account-manager/config-samples/profiles`. |
| 13 | files=`lsscip-shell system . . ls. -a default.*` |
| 14 | for file in $files; do |
| 15 | if [scip-shell system . . `[`. ! -f /var/lib/ldap-account-manager/config/templates/profiles/$file ]; then |
| 16 | cpscip-shell system . . cp. $file /var/lib/ldap-account-manager/config/templates/profiles/$file |
| 17 | chownscip-shell system . . chown. www-data /var/lib/ldap-account-manager/config/templates/profiles/$file |
| 18 | fi |
| 19 | done |
| 20 | cd /usr/share/ldap-account-manager/config-samples/pdfscip-shell filesystem . . `/usr/share/ldap-account-manager/config-samples/pdf`. |
| 21 | files=`lsscip-shell system . . ls. -a default.*` |
| 22 | for file in $files; do |
| 23 | if [scip-shell system . . `[`. ! -f /var/lib/ldap-account-manager/config/templates/pdf/$file ]; then |
| 24 | cpscip-shell system . . cp. $file /var/lib/ldap-account-manager/config/templates/pdf/$file |
| 25 | chownscip-shell system . . chown. www-data /var/lib/ldap-account-manager/config/templates/pdf/$file |
| 26 | fi |
| 27 | done |
| 28 | cd /usr/share/ldap-account-manager/config-samples/pdf/logosscip-shell filesystem . . `/usr/share/ldap-account-manager/config-samples/pdf/logos`. |
| 29 | files=`lsscip-shell system . . ls. -a *.jpg` |
| 30 | for file in $files; do |
| 31 | cpscip-shell system . . cp. $file /var/lib/ldap-account-manager/config/templates/pdf/logos/$file |
| 32 | chownscip-shell system . . chown. www-data /var/lib/ldap-account-manager/config/templates/pdf/logos/$file |
| 33 | done |
| 34 | |
| 35 | chmodscip-shell system . . chmod. 700 /var/lib/ldap-account-manager/configscip-shell filesystem . . `/var/lib/ldap-account-manager/config`. |
| 36 | chmodscip-shell system . . chmod. 700 /var/lib/ldap-account-manager/tmpscip-shell filesystem . . `/var/lib/ldap-account-manager/tmp`. |
| 37 | chmodscip-shell system . . chmod. 700 /var/lib/ldap-account-manager/sessscip-shell filesystem . . `/var/lib/ldap-account-manager/sess`. |
| 38 | chmodscip-shell system . . chmod. 600 /etc/ldap-account-manager/config.cfgscip-shell filesystem . . `/etc/ldap-account-manager/config.cfg`. |
| 39 | set +e |
| 40 | lsscip-shell system . . ls. -l /var/lib/ldap-account-manager/config/*.conf | grepscip-shell system . . grep. -v ".sample." &> /dev/nullscip-shell filesystem . . `/dev/null`. |
| 41 | cfgFilesExist=$? |
| 42 | set -e |
| 43 | if [scip-shell system . . `[`. $cfgFilesExist -ne 0 ]; then |
| 44 | cpscip-shell system . . cp. /var/lib/ldap-account-manager/config/unix.sample.confscip-shell filesystem . . `/var/lib/ldap-account-manager/config/unix.sample.conf`. /var/lib/ldap-account-manager/config/lam.confscip-shell filesystem . . `/var/lib/ldap-account-manager/config/lam.conf`. |
| 45 | chownscip-shell system . . chown. www-data /var/lib/ldap-account-manager/config/lam.confscip-shell filesystem . . `/var/lib/ldap-account-manager/config/lam.conf`. |
| 46 | fi |
| 47 | chmodscip-shell system . . chmod. 600 /var/lib/ldap-account-manager/config/*.conf |
| 48 | if [scip-shell system . . `[`. "$1" = "configure" ]; then |
| 49 | db_get "ldap-account-manager/alias" |
| 50 | alias="$RET" |
| 51 | perlscip-shell system . . perl. -pi -e "s/Alias \/.* \/usr\/share\/ldap-account-manager/Alias \/$alias \/usr\/share\/ldap-account-manager/g"\ |
| 52 | /etc/ldap-account-manager/apache.confscip-shell filesystem . . `/etc/ldap-account-manager/apache.conf`. |
| 53 | db_get "ldap-account-manager/config-webserver" |
| 54 | webservers="$RET" |
| 55 | restart="" |
| 56 | for server in $webservers; do |
| 57 | server=${server%,} |
| 58 | testscip-shell system . . test. -x /usr/sbin/$server || continue |
| 59 | case "$server" in |
| 60 | apache2) |
| 61 | if [scip-shell system . . `[`. -h /etc/$server/conf.d/ldap-account-manager ]; then |
| 62 | rmscip-shell system . . rm. -f /etc/$server/conf.d/ldap-account-manager |
| 63 | fi |
| 64 | if [scip-shell system . . `[`. -d /etc/$server/conf-available ]; then |
| 65 | testscip-shell system . . test. -x /usr/sbin/a2queryscip-shell filesystem . . `/usr/sbin/a2query`. && testscip-shell system . . test. -x /usr/sbin/a2enconfscip-shell filesystem . . `/usr/sbin/a2enconf`. || continue |
| 66 | if [scip-shell system . . `[`. ! -e /etc/$server/conf-available/ldap-account-manager.conf ]; then |
| 67 | if [scip-shell system . . `[`. -h /etc/$server/conf-available/ldap-account-manager.conf ]; then |
| 68 | rmscip-shell system . . rm. /etc/$server/conf-available/ldap-account-manager.conf |
| 69 | fi |
| 70 | lnscip-shell system . . ln. -s /etc/ldap-account-manager/apache.confscip-shell filesystem . . `/etc/ldap-account-manager/apache.conf`. /etc/$server/conf-available/ldap-account-manager.conf |
| 71 | fi |
| 72 | a2query -q -c ldap-account-manager || a2enconf -q ldap-account-manager |
| 73 | restart="$restart $server" |
| 74 | fi |
| 75 | ;; |
| 76 | esac |
| 77 | done |
| 78 | db_get "ldap-account-manager/restart-webserver" |
| 79 | if [scip-shell system . . `[`. "$RET" = "true" ]; then |
| 80 | for server in $restart; do |
| 81 | server=${server%,} |
| 82 | if [scip-shell system . . `[`. `whichscip-shell system . . which. invoke-rc.d` ]; then |
| 83 | set +e |
| 84 | invoke-rc.dscip-shell system . . `invoke-rc.d`. $server reload |
| 85 | set -e |
| 86 | fi |
| 87 | done |
| 88 | fi |
| 89 | fi |
| 90 | |
| 91 | #DEBHELPER# |
| 92 | |
| 93 | db_stop |
| 94 | |
| 95 | exit 0 |