File: lighttpd.postinst

package info (click to toggle)
lighttpd 1.4.82-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,800 kB
  • sloc: ansic: 103,536; perl: 2,720; sh: 783; yacc: 726; makefile: 715
file content (33 lines) | stat: -rw-r--r-- 1,156 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /bin/sh -e
# postinst script for lighttpd

set -e

if [ "$1" = "configure" ]; then
        # Enable 99-unconfigured.conf if lighttpd has not been configured
        #   (if /var/www/html/index.html does not exist or is not readable)
        #   (if index-file.names is unmodified from default lighttpd.conf)
        nconfs=$(ls /etc/lighttpd/conf-enabled/*.conf 2>/dev/null | wc -l)
        if [ "$nconfs" = "0" -a ! -r "/var/www/html/index.html" ]; then
            idx=$(grep index-file\\.names /etc/lighttpd/lighttpd.conf \
                    2>/dev/null | sed -E 's/[ \t]+/ /g')
            if [ "$idx" = 'index-file.names = ( "index.php", "index.html" )' ] \
              && lighty-enable-mod unconfigured; then
                if [ ! -r /var/www/html/index.lighttpd.html ]; then
                    cp /usr/share/lighttpd/index.html /var/www/html/index.lighttpd.html
                fi
            fi
        fi
fi

# dh_installinit will call this function upon failure of rc.d invocation
# Fixes: #383425
start_failed()
{
	echo "Failed to start Lighttpd. Maybe another webserver is already listening on port 80?"
	exit 0
}

#DEBHELPER#

exit 0