Logoj0ke.net Open Build Service > Projects > Apache > apache2 > find_mpm
Sign Up | Log In

File find_mpm of Package apache2 (Revision 35)

Currently displaying revision 35, show latest

 
1
#!/bin/bash
2
3
: ${apache_link:=/usr/sbin/httpd2}
4
5
. /usr/share/apache2/load_configuration
6
7
if ! ${mpm_set:=false}; then 
8
    if [ -z "$APACHE_MPM" ]; then 
9
        # guess
10
        for i in $r/$apache_link-*; do 
11
            test -f $i || continue
12
            i=$(basename $i)
13
            i=${i#*-}
14
            installed_mpms=(${installed_mpms[*]} $i)
15
        done
16
        if [ -z "${installed_mpms[*]}" ]; then
17
            echo >&2 ${warn}Apache binary ${apache_link#*-} not found. No MPM package installed? $norm
18
            echo >&2 Hint: install the apache2-prefork package, and try again.
19
        fi
20
        if [ ${#installed_mpms[*]} = 1 ]; then
21
            APACHE_MPM=${installed_mpms[*]}
22
        else
23
            case ${installed_mpms[*]} in
24
            *prefork*)  APACHE_MPM=prefork;;
25
            *worker*)   APACHE_MPM=worker;;
26
            *event*)    APACHE_MPM=event;;
27
            *leader*)   APACHE_MPM=leader;;
28
            *metuxmpm*) APACHE_MPM=metuxmpm;;
29
            *threadpool*)   APACHE_MPM=threadpool;;
30
            esac
31
        fi
32
33
    fi
34
    if [ -x $apache_link-$APACHE_MPM ]; then
35
        ln -sf $apache_link-$APACHE_MPM $apache_link
36
        echo $apache_link-$APACHE_MPM
37
    else
38
        echo >&2 ${warn}$apache_link-$APACHE_MPM is not a valid httpd2 binary. 
39
        echo >&2 Check your APACHE_MPM setting.$norm
40
        exit 1
41
    fi
42
        
43
    export APACHE_MPM mpm_set=true
44
fi
45
46
47