aboutsummaryrefslogtreecommitdiffstats
path: root/www/apache13-fp/files/apache.sh.tmpl
blob: fce5178396040c6f610e94a2412f58bd04101a50 (plain) (blame)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
#

#
# Create New FrontPage suidkey
#

new_key() {

    CUR_UMASK=`umask`
    skdir=PREFIX/frontpage/version4.0/apache-fp
    PERL=PERL5

    if [ -x PREFIX/libexec/apache/mod_frontpage.so ]
    then

        #NOTE: We need Perl 5, to generate a new key
        if [ -x ${PERL} ]
        then
            umask 077
            ${PERL} -e '@a=(split(//, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*-=_+")); print((map {$a[rand(scalar @a)]} (1..128)), "\n");' > $skdir/suidkey
            umask ${CUR_UMASK}
        fi
    fi

}

#
# Main
#

if [ -x PREFIX/libexec/apache/mod_frontpage.so ]
then
    MODULES="_FP"
fi

case "$1" in

start)
        if [ -x PREFIX/sbin/apachectl ]
        then
        new_key
        PREFIX/sbin/apachectl start${MODULES} && echo -n ' httpd'
    fi
    ;;

stop)
    if [ -r /var/run/httpd.pid ]
    then
        PREFIX/sbin/apachectl stop && echo -n ' httpd'
    fi
    ;;

*)
    echo "usage: $0 {start|stop}" 1>&2
    exit 64
    ;;

esac