View | Details | Raw Unified | Return to bug 11404
Collapse All | Expand All

(-)a/debian/scripts/koha-create (-14 / +48 lines)
Lines 123-128 getinstancemysqldatabase() { Link Here
123
    xmlstarlet sel -t -v 'yazgfs/config/database' "/etc/koha/sites/$1/koha-conf.xml"
123
    xmlstarlet sel -t -v 'yazgfs/config/database' "/etc/koha/sites/$1/koha-conf.xml"
124
}
124
}
125
125
126
check_apache_config()
127
{
128
129
    # Check that mpm_itk is installed and enabled
130
    if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'mpm_itk'; then
131
        # Check Apache version
132
        APACHE_DISABLE_MPM_MSG=""
133
        if /usr/sbin/apache2ctl -v | grep -q "Server version: Apache/2.4"; then
134
            # mpm_event or mpm_worker need to be disabled first. mpm_itk depends
135
            # on mpm_prefork, which is enabled if needed. See
136
            # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734865
137
            if /usr/sbin/apachectl -M 2> /dev/null | grep -q 'mpm_event'; then
138
                APACHE_DISABLE_MPM_MSG=" sudo a2dismod mpm_event ;"
139
            elif /usr/sbin/apachectl -M 2> /dev/null | grep -q 'mpm_worker'; then
140
                APACHE_DISABLE_MPM_MSG=" sudo a2dismod mpm_worker ;"
141
            # else mpm_prefork: a2enmod mpm_itk works
142
            fi
143
        # else Apache 2.2: a2enmod mpm_itk works
144
        fi
145
146
        cat 1>&2  <<EOM
147
148
Koha requires mpm_itk to be enabled within Apache in order to run.
149
Typically this can be enabled with:
150
151
   $APACHE_DISABLE_MPM_MSG sudo a2enmod mpm_itk
152
EOM
153
154
        die
155
    fi
156
157
    # Check that mod_rewrite is installed and enabled.
158
    if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'rewrite_module'; then
159
        cat 1>&2  <<EOM
160
161
Koha requires mod_rewrite to be enabled within Apache in order to run.
162
Typically this can be enabled with:
163
164
    sudo a2enmod rewrite
165
EOM
166
        die
167
    fi
168
}
169
126
set_biblios_indexing_mode()
170
set_biblios_indexing_mode()
127
{
171
{
128
    local indexing_mode=$1
172
    local indexing_mode=$1
Lines 373-379 elif [ "$CLO_MEMCACHED_SERVERS" != "" ] || \ Link Here
373
417
374
Error: you provided memcached configuration switches but memcached is not enabled.
418
Error: you provided memcached configuration switches but memcached is not enabled.
375
Please set USE_MEMCACHED="yes" on /etc/koha/koha-sites.conf or use the
419
Please set USE_MEMCACHED="yes" on /etc/koha/koha-sites.conf or use the
376
--use-memcached optio switch to enable it.
420
--use-memcached option switch to enable it.
377
421
378
EOF`
422
EOF`
379
423
Lines 391-408 then Link Here
391
    die "This script must be run with root privileges."
435
    die "This script must be run with root privileges."
392
fi
436
fi
393
437
394
# Check that mod_rewrite is installed so we can bail out if it's not.
438
# Check everything is ok with Apache, die otherwise
395
if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'rewrite_module'
439
check_apache_config
396
then
397
    cat 1>&2  <<EOM
398
399
Koha requires mod_rewrite to be enabled within Apache in order to run.
400
Typically this can be enabled with:
401
402
    sudo a2enmod rewrite
403
EOM
404
    die
405
fi
406
440
407
opacdomain="$OPACPREFIX$name$OPACSUFFIX$DOMAIN"
441
opacdomain="$OPACPREFIX$name$OPACSUFFIX$DOMAIN"
408
intradomain="$INTRAPREFIX$name$INTRASUFFIX$DOMAIN"
442
intradomain="$INTRAPREFIX$name$INTRASUFFIX$DOMAIN"
Lines 493-499 eof Link Here
493
527
494
    # Generate and install Apache site-available file and log dir.
528
    # Generate and install Apache site-available file and log dir.
495
    generate_config_file apache-site.conf.in \
529
    generate_config_file apache-site.conf.in \
496
        "/etc/apache2/sites-available/$name"
530
        "/etc/apache2/sites-available/$name.conf"
497
    mkdir "/var/log/koha/$name"
531
    mkdir "/var/log/koha/$name"
498
    chown "$username:$username" "/var/log/koha/$name"
532
    chown "$username:$username" "/var/log/koha/$name"
499
533
(-)a/debian/scripts/koha-disable (-2 / +4 lines)
Lines 34-46 warn() Link Here
34
is_enabled()
34
is_enabled()
35
{
35
{
36
    local instancename=$1
36
    local instancename=$1
37
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
37
38
38
    if ! is_instance $instancename; then
39
    if ! is_instance $instancename; then
39
        return 1
40
        return 1
40
    fi
41
    fi
41
42
42
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
43
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
43
            "/etc/apache2/sites-available/$instancename" ; then
44
            "$instancefile" ; then
44
        return 1
45
        return 1
45
    else
46
    else
46
        return 0
47
        return 0
Lines 63-72 is_instance() Link Here
63
disable_instance()
64
disable_instance()
64
{
65
{
65
    local instancename=$1
66
    local instancename=$1
67
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
66
68
67
    if is_enabled $instancename; then
69
    if is_enabled $instancename; then
68
        sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-disable.conf\)$:\1:' \
70
        sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-disable.conf\)$:\1:' \
69
          "/etc/apache2/sites-available/$instancename"
71
          "$instancefile"
70
        return 0
72
        return 0
71
    else
73
    else
72
        return 1
74
        return 1
(-)a/debian/scripts/koha-dump (-2 / +3 lines)
Lines 54-67 mysqldump --databases --host="$mysqlhost" \ Link Here
54
chown "root:$name-koha" "$dbdump"
54
chown "root:$name-koha" "$dbdump"
55
chmod g+r "$dbdump"
55
chmod g+r "$dbdump"
56
56
57
instancefile="$name.conf"
57
58
58
# Dump configs, logs, etc.
59
# Dump configs, logs, etc.
59
metadump="$backupdir/$name-$date.tar.gz"
60
metadump="$backupdir/$name-$date.tar.gz"
60
echo "* configs, logs to $metadump"
61
echo "* configs, logs to $metadump"
61
tar -C / -czf "$metadump" \
62
tar -C / -czf "$metadump" \
62
    "etc/koha/sites/$name" \
63
    "etc/koha/sites/$name" \
63
    "etc/apache2/sites-available/$name" \
64
    "etc/apache2/sites-available/$instancefile" \
64
    "etc/apache2/sites-enabled/$name" \
65
    "etc/apache2/sites-enabled/$instancefile" \
65
    "var/lib/koha/$name" \
66
    "var/lib/koha/$name" \
66
    "var/log/koha/$name"
67
    "var/log/koha/$name"
67
68
(-)a/debian/scripts/koha-enable (-2 / +4 lines)
Lines 34-46 warn() Link Here
34
is_enabled()
34
is_enabled()
35
{
35
{
36
    local instancename=$1
36
    local instancename=$1
37
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
37
38
38
    if ! is_instance $instancename; then
39
    if ! is_instance $instancename; then
39
        return 1
40
        return 1
40
    fi
41
    fi
41
42
42
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
43
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
43
            "/etc/apache2/sites-available/$instancename" ; then
44
            "$instancefile" ; then
44
        return 1
45
        return 1
45
    else
46
    else
46
        return 0
47
        return 0
Lines 63-72 is_instance() Link Here
63
enable_instance()
64
enable_instance()
64
{
65
{
65
    local instancename=$1
66
    local instancename=$1
67
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
66
68
67
    if ! is_enabled $instancename; then
69
    if ! is_enabled $instancename; then
68
        sed -i 's:^\(\s*Include /etc/koha/apache-shared-disable.conf\)$:#\1:' \
70
        sed -i 's:^\(\s*Include /etc/koha/apache-shared-disable.conf\)$:#\1:' \
69
            "/etc/apache2/sites-available/$instancename"
71
            "$instancefile"
70
        return 0
72
        return 0
71
    else
73
    else
72
        return 1
74
        return 1
(-)a/debian/scripts/koha-list (-1 / +2 lines)
Lines 28-36 die() Link Here
28
is_enabled()
28
is_enabled()
29
{
29
{
30
    local instancename=$1
30
    local instancename=$1
31
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
31
32
32
    if grep '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
33
    if grep '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
33
            "/etc/apache2/sites-available/$instancename" > /dev/null
34
            "$instancefile" > /dev/null
34
    then
35
    then
35
        return 1
36
        return 1
36
    else
37
    else
(-)a/debian/scripts/koha-remove (-2 / +5 lines)
Lines 68-75 eof Link Here
68
    
68
    
69
    # If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails.
69
    # If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails.
70
    koha-stop-zebra $name || /bin/true
70
    koha-stop-zebra $name || /bin/true
71
    [ -f "/etc/apache2/sites-available/$name" ]  && \
71
72
        rm "/etc/apache2/sites-available/$name"
72
    instancefile="$name.conf"
73
74
    [ -f "/etc/apache2/sites-available/$instancefile" ]  && \
75
        rm "/etc/apache2/sites-available/$instancefile"
73
    [ -f "/etc/koha/sites/$name/koha-conf.xml" ] && \
76
    [ -f "/etc/koha/sites/$name/koha-conf.xml" ] && \
74
        rm "/etc/koha/sites/$name/koha-conf.xml"
77
        rm "/etc/koha/sites/$name/koha-conf.xml"
75
    [ -f "/etc/koha/sites/$name/zebra-biblios.cfg" ] && \
78
    [ -f "/etc/koha/sites/$name/zebra-biblios.cfg" ] && \
(-)a/debian/scripts/koha-restart-zebra (-1 / +2 lines)
Lines 32-44 warn() Link Here
32
is_enabled()
32
is_enabled()
33
{
33
{
34
    local instancename=$1
34
    local instancename=$1
35
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
35
36
36
    if ! is_instance $instancename; then
37
    if ! is_instance $instancename; then
37
        return 1
38
        return 1
38
    fi
39
    fi
39
40
40
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
41
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
41
            "/etc/apache2/sites-available/$instancename" ; then
42
            "$instancefile" ; then
42
        return 1
43
        return 1
43
    else
44
    else
44
        return 0
45
        return 0
(-)a/debian/scripts/koha-start-zebra (-1 / +2 lines)
Lines 32-44 warn() Link Here
32
is_enabled()
32
is_enabled()
33
{
33
{
34
    local instancename=$1
34
    local instancename=$1
35
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
35
36
36
    if ! is_instance $instancename; then
37
    if ! is_instance $instancename; then
37
        return 1
38
        return 1
38
    fi
39
    fi
39
40
40
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
41
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
41
            "/etc/apache2/sites-available/$instancename" ; then
42
            "$instancefile" ; then
42
        return 1
43
        return 1
43
    else
44
    else
44
        return 0
45
        return 0
(-)a/debian/scripts/koha-stop-zebra (-2 / +2 lines)
Lines 32-44 warn() Link Here
32
is_enabled()
32
is_enabled()
33
{
33
{
34
    local instancename=$1
34
    local instancename=$1
35
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
35
36
36
    if ! is_instance $instancename; then
37
    if ! is_instance $instancename; then
37
        return 1
38
        return 1
38
    fi
39
    fi
39
40
40
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
41
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
41
            "/etc/apache2/sites-available/$instancename" ; then
42
            "$instancefile" ; then
42
        return 1
43
        return 1
43
    else
44
    else
44
        return 0
45
        return 0
45
- 

Return to bug 11404