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

(-)a/debian/koha-common.install (+1 lines)
Lines 7-12 debian/unavailable.html usr/share/koha/intranet/htdocs Link Here
7
debian/unavailable.html                     usr/share/koha/opac/htdocs
7
debian/unavailable.html                     usr/share/koha/opac/htdocs
8
debian/templates/*                          etc/koha
8
debian/templates/*                          etc/koha
9
debian/scripts/koha-functions.sh            usr/share/koha/bin
9
debian/scripts/koha-functions.sh            usr/share/koha/bin
10
debian/scripts/koha-config                  usr/sbin
10
debian/scripts/koha-create                  usr/sbin
11
debian/scripts/koha-create                  usr/sbin
11
debian/scripts/koha-create-dirs             usr/sbin
12
debian/scripts/koha-create-dirs             usr/sbin
12
debian/scripts/koha-disable                 usr/sbin
13
debian/scripts/koha-disable                 usr/sbin
(-)a/debian/koha-common.postinst (-121 / +13 lines)
Lines 131-257 EOF Link Here
131
    fi
131
    fi
132
fi
132
fi
133
133
134
log4perl_component()
135
{
136
    local config=$1
137
    local component=$2
138
139
    if grep -q "log4perl.logger.$component" $config; then
140
        return 0
141
    else
142
        return 1
143
    fi
144
}
145
146
# Take care of the instance's log4perl.conf file
147
for site in $(koha-list); do
148
    log4perl_config="/etc/koha/sites/$site/log4perl.conf"
149
    if ! log4perl_component $log4perl_config "z3950"; then
150
        cat <<EOF >> $log4perl_config
151
log4perl.logger.z3950 = WARN, Z3950
152
log4perl.appender.Z3950=Log::Log4perl::Appender::File
153
log4perl.appender.Z3950.filename=/var/log/koha/$site/z3950-error.log
154
log4perl.appender.Z3950.mode=append
155
log4perl.appender.Z3950.layout=PatternLayout
156
log4perl.appender.Z3950.layout.ConversionPattern=[%d] [%p] %m %l%n
157
log4perl.appender.Z3950.utf8=1
158
159
EOF
160
    fi
161
162
    if ! log4perl_component $log4perl_config "api"; then
163
        cat <<EOF >> $log4perl_config
164
log4perl.logger.api = WARN, API
165
log4perl.appender.API=Log::Log4perl::Appender::File
166
log4perl.appender.API.filename=/var/log/koha/$site/api-error.log
167
log4perl.appender.API.mode=append
168
log4perl.appender.API.layout=PatternLayout
169
log4perl.appender.API.layout.ConversionPattern=[%d] [%p] %m %l%n
170
log4perl.appender.API.utf8=1
171
172
EOF
173
    fi
174
done
175
176
for site in $(koha-list); do
177
    log4perl_config="/etc/koha/sites/$site/log4perl.conf"
178
    if ! log4perl_component $log4perl_config "sip"; then
179
        cat <<EOF >> $log4perl_config
180
log4perl.logger.sip = DEBUG, SIP
181
log4perl.appender.SIP=Log::Log4perl::Appender::File
182
log4perl.appender.SIP.filename=/var/log/koha/$site/sip.log
183
log4perl.appender.SIP.mode=append
184
log4perl.appender.SIP.layout=PatternLayout
185
log4perl.appender.SIP.layout.ConversionPattern=[%d] [%P] [%p] %X{accountid}@%X{peeraddr}: %m %l%n
186
log4perl.appender.SIP.utf8=1
187
188
EOF
189
    fi
190
done
191
192
for site in $(koha-list); do
193
    log4perl_config="/etc/koha/sites/$site/log4perl.conf"
194
    if ! log4perl_component $log4perl_config "plack-opac"; then
195
        cat <<EOF >> $log4perl_config
196
log4perl.logger.plack-opac = WARN, PLACKOPAC
197
log4perl.appender.PLACKOPAC=Log::Log4perl::Appender::File
198
log4perl.appender.PLACKOPAC.filename=/var/log/koha/$site/plack-opac-error.log
199
log4perl.appender.PLACKOPAC.mode=append
200
log4perl.appender.PLACKOPAC.layout=PatternLayout
201
log4perl.appender.PLACKOPAC.layout.ConversionPattern=[%d] [%p] %m%n
202
log4perl.appender.PLACKOPAC.utf8=1
203
204
EOF
205
    fi
206
done
207
208
for site in $(koha-list); do
209
    log4perl_config="/etc/koha/sites/$site/log4perl.conf"
210
    if ! log4perl_component $log4perl_config "plack-api"; then
211
        cat <<EOF >> $log4perl_config
212
log4perl.logger.plack-api = WARN, PLACKAPI
213
log4perl.appender.PLACKAPI=Log::Log4perl::Appender::File
214
log4perl.appender.PLACKAPI.filename=/var/log/koha/$site/plack-api-error.log
215
log4perl.appender.PLACKAPI.mode=append
216
log4perl.appender.PLACKAPI.layout=PatternLayout
217
log4perl.appender.PLACKAPI.layout.ConversionPattern=[%d] [%p] %m%n
218
log4perl.appender.PLACKAPI.utf8=1
219
220
EOF
221
    fi
222
done
223
224
for site in $(koha-list); do
225
    log4perl_config="/etc/koha/sites/$site/log4perl.conf"
226
    if ! log4perl_component $log4perl_config "plack-intranet"; then
227
        cat <<EOF >> $log4perl_config
228
log4perl.logger.plack-intranet = WARN, PLACKINTRANET
229
log4perl.appender.PLACKINTRANET=Log::Log4perl::Appender::File
230
log4perl.appender.PLACKINTRANET.filename=/var/log/koha/$site/plack-intranet-error.log
231
log4perl.appender.PLACKINTRANET.mode=append
232
log4perl.appender.PLACKINTRANET.layout=PatternLayout
233
log4perl.appender.PLACKINTRANET.layout.ConversionPattern=[%d] [%p] %m%n
234
log4perl.appender.PLACKINTRANET.utf8=1
235
236
EOF
237
    fi
238
done
239
240
for site in $(koha-list); do
241
    log4perl_config="/etc/koha/sites/$site/log4perl.conf"
242
    if ! log4perl_component $log4perl_config "worker"; then
243
        cat <<EOF >> $log4perl_config
244
log4perl.logger.worker = WARN, WORKER
245
log4perl.appender.WORKER=Log::Log4perl::Appender::Screen
246
log4perl.appender.WORKER.stderr=1
247
log4perl.appender.WORKER.layout=PatternLayout
248
log4perl.appender.WORKER.layout.ConversionPattern=[%d] [%p] %m %l%n
249
log4perl.appender.WORKER.utf8=1
250
251
EOF
252
    fi
253
done
254
255
for site in $(koha-list); do
134
for site in $(koha-list); do
256
    kohaconfig="/etc/koha/sites/$site/koha-conf.xml"
135
    kohaconfig="/etc/koha/sites/$site/koha-conf.xml"
257
    logdir="$( xmlstarlet sel -t -v 'yazgfs/config/logdir' $kohaconfig )"
136
    logdir="$( xmlstarlet sel -t -v 'yazgfs/config/logdir' $kohaconfig )"
Lines 271-276 for zfile in $( find /etc/koha/sites -name zebra-authorities-dom.cfg -or -name z Link Here
271
    perl -p -i -e 's{^modulePath: /usr/lib/idzebra-2.0/modules$}{modulePath: /usr/lib/idzebra-2.0/modules:/usr/lib/x86_64-linux-gnu/idzebra-2.0/modules:/usr/lib/i386-linux-gnu/idzebra-2.0/modules:/usr/lib/aarch64-linux-gnu/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabi/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabihf/idzebra-2.0/modules:/usr/lib/mips-linux-gnu/idzebra-2.0/modules:/usr/lib/mipsel-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc64le-linux-gnu/idzebra-2.0/modules:/usr/lib/s390x-linux-gnu/idzebra-2.0/modules}' $zfile
150
    perl -p -i -e 's{^modulePath: /usr/lib/idzebra-2.0/modules$}{modulePath: /usr/lib/idzebra-2.0/modules:/usr/lib/x86_64-linux-gnu/idzebra-2.0/modules:/usr/lib/i386-linux-gnu/idzebra-2.0/modules:/usr/lib/aarch64-linux-gnu/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabi/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabihf/idzebra-2.0/modules:/usr/lib/mips-linux-gnu/idzebra-2.0/modules:/usr/lib/mipsel-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc64le-linux-gnu/idzebra-2.0/modules:/usr/lib/s390x-linux-gnu/idzebra-2.0/modules}' $zfile
272
done
151
done
273
152
153
if [ "$1" = "configure" ]; then
154
    for site in $(koha-list); do
155
        log4perl_file="/etc/koha/sites/$site/log4perl.conf"
156
        temp_file=$(mktemp)
157
        chmod 640 $temp_file
158
        chown $site-koha:$site-koha $temp_file
159
        koha-config --create-log4perl $site > $temp_file
160
        ucf --debconf-ok $temp_file $log4perl_file
161
        ucfr koha-common $log4perl_file
162
        rm $temp_file
163
    done
164
fi
165
274
db_stop
166
db_stop
275
167
276
rabbitmq-plugins enable rabbitmq_stomp
168
rabbitmq-plugins enable rabbitmq_stomp
(-)a/debian/koha-core.install (+1 lines)
Lines 7-12 debian/unavailable.html usr/share/koha/intranet/htdocs Link Here
7
debian/unavailable.html                     usr/share/koha/opac/htdocs
7
debian/unavailable.html                     usr/share/koha/opac/htdocs
8
debian/templates/*                          etc/koha
8
debian/templates/*                          etc/koha
9
debian/scripts/koha-functions.sh            usr/share/koha/bin
9
debian/scripts/koha-functions.sh            usr/share/koha/bin
10
debian/scripts/koha-config                  usr/sbin
10
debian/scripts/koha-create                  usr/sbin
11
debian/scripts/koha-create                  usr/sbin
11
debian/scripts/koha-create-dirs             usr/sbin
12
debian/scripts/koha-create-dirs             usr/sbin
12
debian/scripts/koha-disable                 usr/sbin
13
debian/scripts/koha-disable                 usr/sbin
(-)a/debian/koha-core.postinst (-121 / +13 lines)
Lines 131-257 EOF Link Here
131
    fi
131
    fi
132
fi
132
fi
133
133
134
log4perl_component()
135
{
136
    local config=$1
137
    local component=$2
138
139
    if grep -q "log4perl.logger.$component" $config; then
140
        return 0
141
    else
142
        return 1
143
    fi
144
}
145
146
# Take care of the instance's log4perl.conf file
147
for site in $(koha-list); do
148
    log4perl_config="/etc/koha/sites/$site/log4perl.conf"
149
    if ! log4perl_component $log4perl_config "z3950"; then
150
        cat <<EOF >> $log4perl_config
151
log4perl.logger.z3950 = WARN, Z3950
152
log4perl.appender.Z3950=Log::Log4perl::Appender::File
153
log4perl.appender.Z3950.filename=/var/log/koha/$site/z3950-error.log
154
log4perl.appender.Z3950.mode=append
155
log4perl.appender.Z3950.layout=PatternLayout
156
log4perl.appender.Z3950.layout.ConversionPattern=[%d] [%p] %m %l%n
157
log4perl.appender.Z3950.utf8=1
158
159
EOF
160
    fi
161
162
    if ! log4perl_component $log4perl_config "api"; then
163
        cat <<EOF >> $log4perl_config
164
log4perl.logger.api = WARN, API
165
log4perl.appender.API=Log::Log4perl::Appender::File
166
log4perl.appender.API.filename=/var/log/koha/$site/api-error.log
167
log4perl.appender.API.mode=append
168
log4perl.appender.API.layout=PatternLayout
169
log4perl.appender.API.layout.ConversionPattern=[%d] [%p] %m %l%n
170
log4perl.appender.API.utf8=1
171
172
EOF
173
    fi
174
done
175
176
for site in $(koha-list); do
177
    log4perl_config="/etc/koha/sites/$site/log4perl.conf"
178
    if ! log4perl_component $log4perl_config "sip"; then
179
        cat <<EOF >> $log4perl_config
180
log4perl.logger.sip = DEBUG, SIP
181
log4perl.appender.SIP=Log::Log4perl::Appender::File
182
log4perl.appender.SIP.filename=/var/log/koha/$site/sip.log
183
log4perl.appender.SIP.mode=append
184
log4perl.appender.SIP.layout=PatternLayout
185
log4perl.appender.SIP.layout.ConversionPattern=[%d] [%P] [%p] %X{accountid}@%X{peeraddr}: %m %l%n
186
log4perl.appender.SIP.utf8=1
187
188
EOF
189
    fi
190
done
191
192
for site in $(koha-list); do
193
    log4perl_config="/etc/koha/sites/$site/log4perl.conf"
194
    if ! log4perl_component $log4perl_config "plack-opac"; then
195
        cat <<EOF >> $log4perl_config
196
log4perl.logger.plack-opac = WARN, PLACKOPAC
197
log4perl.appender.PLACKOPAC=Log::Log4perl::Appender::File
198
log4perl.appender.PLACKOPAC.filename=/var/log/koha/$site/plack-opac-error.log
199
log4perl.appender.PLACKOPAC.mode=append
200
log4perl.appender.PLACKOPAC.layout=PatternLayout
201
log4perl.appender.PLACKOPAC.layout.ConversionPattern=[%d] [%p] %m%n
202
log4perl.appender.PLACKOPAC.utf8=1
203
204
EOF
205
    fi
206
done
207
208
for site in $(koha-list); do
209
    log4perl_config="/etc/koha/sites/$site/log4perl.conf"
210
    if ! log4perl_component $log4perl_config "plack-api"; then
211
        cat <<EOF >> $log4perl_config
212
log4perl.logger.plack-api = WARN, PLACKAPI
213
log4perl.appender.PLACKAPI=Log::Log4perl::Appender::File
214
log4perl.appender.PLACKAPI.filename=/var/log/koha/$site/plack-api-error.log
215
log4perl.appender.PLACKAPI.mode=append
216
log4perl.appender.PLACKAPI.layout=PatternLayout
217
log4perl.appender.PLACKAPI.layout.ConversionPattern=[%d] [%p] %m%n
218
log4perl.appender.PLACKAPI.utf8=1
219
220
EOF
221
    fi
222
done
223
224
for site in $(koha-list); do
225
    log4perl_config="/etc/koha/sites/$site/log4perl.conf"
226
    if ! log4perl_component $log4perl_config "plack-intranet"; then
227
        cat <<EOF >> $log4perl_config
228
log4perl.logger.plack-intranet = WARN, PLACKINTRANET
229
log4perl.appender.PLACKINTRANET=Log::Log4perl::Appender::File
230
log4perl.appender.PLACKINTRANET.filename=/var/log/koha/$site/plack-intranet-error.log
231
log4perl.appender.PLACKINTRANET.mode=append
232
log4perl.appender.PLACKINTRANET.layout=PatternLayout
233
log4perl.appender.PLACKINTRANET.layout.ConversionPattern=[%d] [%p] %m%n
234
log4perl.appender.PLACKINTRANET.utf8=1
235
236
EOF
237
    fi
238
done
239
240
for site in $(koha-list); do
241
    log4perl_config="/etc/koha/sites/$site/log4perl.conf"
242
    if ! log4perl_component $log4perl_config "worker"; then
243
        cat <<EOF >> $log4perl_config
244
log4perl.logger.worker = WARN, WORKER
245
log4perl.appender.WORKER=Log::Log4perl::Appender::Screen
246
log4perl.appender.WORKER.stderr=1
247
log4perl.appender.WORKER.layout=PatternLayout
248
log4perl.appender.WORKER.layout.ConversionPattern=[%d] [%p] %m %l%n
249
log4perl.appender.WORKER.utf8=1
250
251
EOF
252
    fi
253
done
254
255
for site in $(koha-list); do
134
for site in $(koha-list); do
256
    kohaconfig="/etc/koha/sites/$site/koha-conf.xml"
135
    kohaconfig="/etc/koha/sites/$site/koha-conf.xml"
257
    logdir="$( xmlstarlet sel -t -v 'yazgfs/config/logdir' $kohaconfig )"
136
    logdir="$( xmlstarlet sel -t -v 'yazgfs/config/logdir' $kohaconfig )"
Lines 271-276 for zfile in $( find /etc/koha/sites -name zebra-authorities-dom.cfg -or -name z Link Here
271
    perl -p -i -e 's{^modulePath: /usr/lib/idzebra-2.0/modules$}{modulePath: /usr/lib/idzebra-2.0/modules:/usr/lib/x86_64-linux-gnu/idzebra-2.0/modules:/usr/lib/i386-linux-gnu/idzebra-2.0/modules:/usr/lib/aarch64-linux-gnu/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabi/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabihf/idzebra-2.0/modules:/usr/lib/mips-linux-gnu/idzebra-2.0/modules:/usr/lib/mipsel-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc64le-linux-gnu/idzebra-2.0/modules:/usr/lib/s390x-linux-gnu/idzebra-2.0/modules}' $zfile
150
    perl -p -i -e 's{^modulePath: /usr/lib/idzebra-2.0/modules$}{modulePath: /usr/lib/idzebra-2.0/modules:/usr/lib/x86_64-linux-gnu/idzebra-2.0/modules:/usr/lib/i386-linux-gnu/idzebra-2.0/modules:/usr/lib/aarch64-linux-gnu/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabi/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabihf/idzebra-2.0/modules:/usr/lib/mips-linux-gnu/idzebra-2.0/modules:/usr/lib/mipsel-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc64le-linux-gnu/idzebra-2.0/modules:/usr/lib/s390x-linux-gnu/idzebra-2.0/modules}' $zfile
272
done
151
done
273
152
153
if [ "$1" = "configure" ]; then
154
    for site in $(koha-list); do
155
        log4perl_file="/etc/koha/sites/$site/log4perl.conf"
156
        temp_file=$(mktemp)
157
        chmod 640 $temp_file
158
        chown $site-koha:$site-koha $temp_file
159
        koha-config --create-log4perl $site > $temp_file
160
        ucf --debconf-ok $temp_file $log4perl_file
161
        ucfr koha-core $log4perl_file
162
        rm $temp_file
163
    done
164
fi
165
274
db_stop
166
db_stop
275
167
276
# Bug 18250: Correct startup order of koha-common and memcached
168
# Bug 18250: Correct startup order of koha-common and memcached
(-)a/debian/scripts/koha-config (-1 / +93 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.a
17
18
use Getopt::Long;
19
use Modern::Perl;
20
use File::Slurp qw(read_file);
21
22
my $show_help;
23
my $create_log4perl;
24
25
my $res = GetOptions(
26
    "help|h"          => \$show_help,
27
    "create-log4perl" => \$create_log4perl,
28
);
29
30
if ( !$res || $show_help ) {
31
    show_help( !$res );
32
    exit( !$res );
33
}
34
35
if ( !@ARGV ) {
36
    show_help( 1, "An instance name must be supplied." );
37
    exit(1);
38
}
39
my $instance = shift @ARGV;
40
if ( !-e "/etc/koha/sites/$instance" ) {
41
    show_help( 1, "The instance doesn't exist: $instance" );
42
    exit(1);
43
}
44
45
if ($create_log4perl) {
46
    my $log4perl = create_log4perl( { instance => $instance, } );
47
    print $log4perl;
48
}
49
50
sub create_log4perl {
51
    my ($args) = @_;
52
    my $instance = $args->{instance};
53
    if ($instance) {
54
        my $template = _get_template( { filename => 'log4perl-site.conf.in' } );
55
        my $replacement = sprintf( '/var/log/koha/%s', $instance );
56
        $template =~ s/__LOG_DIR__/$replacement/g;
57
        return $template;
58
    }
59
}
60
61
sub _get_template {
62
    my ($args) = @_;
63
    my $template;
64
    my $filename = $args->{filename};
65
    if ($filename) {
66
        my $path = sprintf( '/etc/koha/%s', $filename );
67
        if ( -f $path ) {
68
            my $text = read_file($path);
69
            if ($text) {
70
                $template = $text;
71
            }
72
        }
73
    }
74
    return $template;
75
}
76
77
sub show_help {
78
    my ( $err, $msg ) = @_;
79
80
    my $fh = $err ? *STDERR : *STDOUT;
81
    say $fh "Error: " . $msg if $msg;
82
    print $fh $_ while <DATA>;
83
}
84
85
__DATA__
86
koha-config -- tool for working with Koha configuration
87
88
Usage: koha-config [options] [instance name]
89
90
Options:
91
    -h, --help              show this help and quit
92
    --create-log4perl       create log4perl config for this instance
93

Return to bug 32791