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

(-)a/debian/koha-core.bash-completion (+342 lines)
Line 0 Link Here
1
#!/bin/bash
2
#
3
# koha-core.bash-completion script for koha-* commands
4
#
5
# This file is part of Koha.
6
#
7
# Copyright 2013 Universidad Nacional de Cordoba
8
#                Tomas Cohen Arazi
9
#
10
# Koha is free software; you can redistribute it and/or modify it under the
11
# terms of the GNU General Public License as published by the Free Software
12
# Foundation; either version 3 of the License, or (at your option) any later
13
# version.
14
#
15
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License along
20
# with Koha; if not, see <http://www.gnu.org/licenses>.
21
22
_build_substract_switches()
23
{
24
    local substract
25
26
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
27
        if [[ ${COMP_WORDS[i]} == -* ]]; then
28
            substract="$substract -e ${COMP_WORDS[i]}"
29
        fi
30
    done
31
32
    echo "$substract"
33
}
34
35
_build_substract_instances()
36
{
37
    local substract
38
39
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
40
        substract="$substract -e ${COMP_WORDS[i]}"
41
    done
42
43
    echo "$substract"
44
}
45
46
_koha_single_instance()
47
{
48
    local filter=$1
49
50
    cur=${COMP_WORDS[COMP_CWORD]}
51
    prev=${COMP_WORDS[COMP_CWORD-1]}
52
    if [ $COMP_CWORD -eq 1 ]; then
53
        COMPREPLY=( $( compgen -W "$(koha-list $filter)" $cur ) )
54
    else
55
        COMPREPLY=()
56
    fi
57
58
    return 0
59
}
60
61
_koha_list_cmd()
62
{
63
    local filter=$1
64
65
    local cur substract instancelist
66
    _get_comp_words_by_ref cur
67
68
    # Build a list of the already used words
69
    substract=`_build_substract_instances`
70
71
    if [[ "$substract" != "" ]]; then
72
        instancelist=$( koha-list $filter | grep -v -x $substract )
73
    else
74
        instancelist=$( koha-list $filter )
75
    fi
76
77
    COMPREPLY=( $(compgen -W "$instancelist" -- $cur ) )
78
    return 0
79
}
80
81
_koha_email_disable()
82
{
83
    _koha_list_cmd "--email"
84
    return 0
85
}
86
complete -F _koha_email_disable koha-email-disable
87
88
_koha_email_enable()
89
{
90
    _koha_list_cmd "--noemail"
91
    return 0
92
}
93
complete -F _koha_email_enable koha-email-enable
94
95
_koha_sip_enabled_instances()
96
{
97
    _koha_list_cmd "--sip"
98
    return 0
99
}
100
101
_koha_sip_disabled()
102
{
103
    _koha_list_cmd "--nosip"
104
    return 0
105
}
106
107
_koha_disabled_instances()
108
{
109
    _koha_list_cmd "--disabled"
110
    return 0
111
}
112
113
_koha_enabled_instances()
114
{
115
    _koha_list_cmd "--enabled"
116
    return 0
117
}
118
119
# koha-enable autocompletes with disabled instances
120
complete -F _koha_disabled_instances koha-enable
121
122
# koha-disable autocompletes with enabled instances
123
complete -F _koha_enabled_instances koha-disable
124
125
# koha-mysql autocompletes with a single instance name
126
complete -F _koha_single_instance koha-mysql
127
128
_koha_list()
129
{
130
    local cur opts substract
131
132
    COMPREPLY=()
133
    _get_comp_words_by_ref cur
134
    opts="--enabled --disabled --email --noemail --plack --noplack --sip --nosip --help -h"
135
136
    # Build a list of the already used option switches
137
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
138
        if [[ ${COMP_WORDS[i]} == -* ]]; then
139
            case ${COMP_WORDS[i]} in
140
                --disabled)
141
                    substract="$substract -e --enabled"; ;;
142
                --enabled)
143
                    substract="$substract -e --disabled"; ;;
144
                --email)
145
                    substract="$substract -e --noemail"; ;;
146
                --noemail)
147
                    substract="$substract -e --email"; ;;
148
                --plack)
149
                    substract="$substract -e --noplack"; ;;
150
                --noplack)
151
                    substract="$substract -e --plack"; ;;
152
                --sip)
153
                    substract="$substract -e --nosip"; ;;
154
                --nosip)
155
                    substract="$substract -e --sip"; ;;
156
                --help)
157
                    substract="$substract -e -h"; ;;
158
                -h)
159
                    substract="$substract -e --help"; ;;
160
            esac
161
            substract="$substract -e ${COMP_WORDS[i]}"
162
        fi
163
    done
164
165
    if [[ "$substract" != "" ]]; then
166
        opts=$( echo $opts | sed -e 's/ /\n/g'  | grep -v -x $substract )
167
    fi
168
169
    COMPREPLY=( $(compgen -W "$opts" -- $cur ) )
170
171
    return 0
172
}
173
complete -F _koha_list koha-list
174
175
_koha_plack_instances()
176
{
177
    _koha_list_cmd "--plack"
178
    return 0
179
}
180
181
_koha_noplack_instances()
182
{
183
    _koha_list_cmd "--noplack"
184
    return 0
185
}
186
187
_koha-plack()
188
{
189
    local cur opts substract
190
191
    COMPREPLY=()
192
    _get_comp_words_by_ref cur
193
    opts="--start --stop --restart --enable --disable --quiet -q --help -h"
194
195
    # Build a list of the already used option switches
196
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
197
        if [[ ${COMP_WORDS[i]} == -* ]]; then
198
            case ${COMP_WORDS[i]} in
199
                --start) _koha_plack_instances ; return 0 ;;
200
                 --stop) _koha_plack_instances ; return 0 ;;
201
              --restart) _koha_plack_instances ; return 0 ;;
202
               --enable) _koha_noplack_instances ; return 0 ;;
203
              --disable) _koha_plack_instances ; return 0 ;;
204
                 --help) COMPREPLY=() ; return 0 ;; # no more completions
205
                     -h) COMPREPLY=() ; return 0 ;; # no more completions
206
                --quiet) # filter the other quiet switches and go on
207
                    substract="$substract -e -q"; ;;
208
                -q)      # filter the other quiet switches and go on
209
                    substract="$substract -e --quiet"; ;;
210
            esac
211
            substract="$substract -e ${COMP_WORDS[i]}"
212
        fi
213
    done
214
215
    if [[ "$substract" != "" ]]; then
216
        opts=$( echo $opts | sed -e 's/ /\n/g'  | grep -v -x $substract )
217
    fi
218
219
    COMPREPLY=( $(compgen -W "$opts" -- $cur ) )
220
221
    return 0
222
}
223
complete -F _koha-plack koha-plack
224
225
_koha-indexer()
226
{
227
    local cur opts substract
228
229
    COMPREPLY=()
230
    _get_comp_words_by_ref cur
231
    opts="--start --stop --restart --quiet -q --help -h"
232
233
    # Build a list of the already used option switches
234
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
235
        if [[ ${COMP_WORDS[i]} == -* ]]; then
236
            case ${COMP_WORDS[i]} in
237
                --start) _koha_list_cmd ; return 0 ;;
238
                 --stop) _koha_list_cmd ; return 0 ;;
239
              --restart) _koha_list_cmd ; return 0 ;;
240
                 --help) COMPREPLY=() ; return 0 ;; # no more completions
241
                     -h) COMPREPLY=() ; return 0 ;; # no more completions
242
                --quiet) # filter the other quiet switches and go on
243
                    substract="$substract -e -q"; ;;
244
                -q)      # filter the other quiet switches and go on
245
                    substract="$substract -e --quiet"; ;;
246
            esac
247
            substract="$substract -e ${COMP_WORDS[i]}"
248
        fi
249
    done
250
251
    if [[ "$substract" != "" ]]; then
252
        opts=$( echo $opts | sed -e 's/ /\n/g'  | grep -v -x $substract )
253
    fi
254
255
    COMPREPLY=( $(compgen -W "$opts" -- $cur ) )
256
257
    return 0
258
}
259
complete -F _koha-indexer koha-indexer
260
261
_koha-zebra()
262
{
263
    local cur opts substract
264
265
    COMPREPLY=()
266
    _get_comp_words_by_ref cur
267
    opts="--start --stop --restart --status --quiet -q --help -h"
268
269
    # Build a list of the already used option switches
270
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
271
        if [[ ${COMP_WORDS[i]} == -* ]]; then
272
            case ${COMP_WORDS[i]} in
273
                --start) _koha_list_cmd ; return 0 ;;
274
                 --stop) _koha_list_cmd ; return 0 ;;
275
              --restart) _koha_list_cmd ; return 0 ;;
276
               --status) _koha_list_cmd ; return 0 ;;
277
                 --help) COMPREPLY=() ; return 0 ;; # no more completions
278
                     -h) COMPREPLY=() ; return 0 ;; # no more completions
279
                --quiet) # filter the other quiet switches and go on
280
                    substract="$substract -e -q"; ;;
281
                -q)      # filter the other quiet switches and go on
282
                    substract="$substract -e --quiet"; ;;
283
            esac
284
            substract="$substract -e ${COMP_WORDS[i]}"
285
        fi
286
    done
287
288
    if [[ "$substract" != "" ]]; then
289
        opts=$( echo $opts | sed -e 's/ /\n/g'  | grep -v -x $substract )
290
    fi
291
292
    COMPREPLY=( $(compgen -W "$opts" -- $cur ) )
293
294
    return 0
295
}
296
complete -F _koha-zebra koha-zebra
297
298
_koha-sip()
299
{
300
    local cur opts substract
301
302
    COMPREPLY=()
303
    _get_comp_words_by_ref cur
304
    opts="--start --stop --restart --status --enable --verbose -v --help -h"
305
306
    # Build a list of the already used option switches
307
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
308
        if [[ ${COMP_WORDS[i]} == -* ]]; then
309
            case ${COMP_WORDS[i]} in
310
                --start) _koha_sip_enabled_instances ; return 0 ;;
311
                 --stop) _koha_sip_enabled_instances ; return 0 ;;
312
              --restart) _koha_sip_enabled_instances ; return 0 ;;
313
               --status) _koha_sip_enabled_instances ; return 0 ;;
314
               --enable) _koha_sip_disabled ; return 0 ;;
315
                 --help) COMPREPLY=() ; return 0 ;; # no more completions
316
                     -h) COMPREPLY=() ; return 0 ;; # no more completions
317
              --verbose) # filter the other quiet switches and go on
318
                    substract="$substract -e -q"; ;;
319
                -v)      # filter the other quiet switches and go on
320
                    substract="$substract -e --verbose"; ;;
321
            esac
322
            substract="$substract -e ${COMP_WORDS[i]}"
323
        fi
324
    done
325
326
    if [[ "$substract" != "" ]]; then
327
        opts=$( echo $opts | sed -e 's/ /\n/g'  | grep -v -x $substract )
328
    fi
329
330
    COMPREPLY=( $(compgen -W "$opts" -- $cur ) )
331
332
    return 0
333
}
334
complete -F _koha-sip koha-sip
335
336
# Local variables:
337
# mode: shell-script
338
# sh-basic-offset: 4
339
# sh-indent-comment: t
340
# indent-tabs-mode: nil
341
# End:
342
# ex: ts=4 sw=4 et filetype=sh
(-)a/debian/koha-core.config (+62 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
# koha-core.config - ensures that debconf stuff is all handled properly
4
#
5
# Copyright 2011  Catalyst IT, Ltd
6
# 
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11
# 
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
# 
17
# You should have received a copy of the GNU General Public License
18
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20
set -e
21
22
. /usr/share/debconf/confmodule
23
24
CONFIGFILE=/etc/koha/koha-common.conf
25
26
if [ -e $CONFIGFILE ]; then
27
    . $CONFIGFILE || true
28
    # Put the current values into debconf
29
    UPDATE="true"
30
    if [ "$AUTOMATIC_TRANSLATIONS_UPDATE" = "no" ] ; then
31
        UPDATE="false"
32
    fi
33
    db_set koha-core/automatically-update-translations "$UPDATE"
34
else
35
    # True is the default
36
    db_set koha-core/automatically-update-translations true
37
fi
38
39
if dpkg --compare-versions "$2" lt-nl 3.4 ; then
40
    db_input high koha-core/3.2-3.4-upgrade-notice || true
41
fi
42
43
db_input medium koha-core/automatically-update-translations || true
44
45
# Determine if we should ask the user about upgrading - there's no point
46
# if this is a fresh install anyway.
47
if [ -e /usr/sbin/koha-list ]; then
48
    RENAME_APACHE_FILES="no"
49
    for vhost in $(koha-list); do
50
        if [ -f "/etc/apache2/sites-available/$vhost" ] && \
51
           [ ! -f "/etc/apache2/sites-available/$vhost.conf" ]; then
52
           RENAME_APACHE_FILES="yes"
53
           break # at least one, trigger renaming
54
        fi
55
    done
56
    if [ "$RENAME_APACHE_FILES" = "yes" ]; then
57
        db_input high koha-core/rename-apache-vhost-files || true
58
    fi
59
fi
60
61
db_go || true
62
(-)a/debian/koha-core.default (+37 lines)
Line 0 Link Here
1
## General koha-common default options file
2
3
PERL5LIB="/usr/share/koha/lib"
4
KOHA_HOME="/usr/share/koha"
5
6
## Background record indexing
7
#
8
# The following options control the use of an indexing daemon for
9
# Koha instances.
10
#
11
# More information can be found here:
12
#
13
#     http://wiki.koha-community.org/wiki/PackagesIndexDaemon
14
#
15
# USE_INDEXER_DAEMON: "no" | "yes"
16
#
17
USE_INDEXER_DAEMON="no"
18
19
# Set an alternate indexer daemon. The default is to use the rebuild_zebra.pl
20
# in daemon mode.
21
#
22
# Example: ALTERNATE_INDEXER_DAEMON="koha-index-daemon"
23
#
24
# ALTERNATE_INDEXER_DAEMON=""
25
26
# Lookup/indexing frecquency (in seconds) for the indexing daemon.
27
#
28
# The default value is 5
29
#
30
INDEXER_TIMEOUT=5
31
32
# Parameters to be passed to the indexer daemon. Useful for alternate indexers.
33
# Defaults to INDEXER_PARAMS="-daemon -sleep $INDEXER_TIMEOUT"
34
#
35
# INDEXER_PARAMS=""
36
37
## End of general koha-common default options
(-)a/debian/koha-core.dirs (+6 lines)
Line 0 Link Here
1
etc/koha/sites
2
var/cache/koha
3
var/lib/koha
4
var/log/koha
5
var/lock/koha
6
var/spool/koha
(-)a/debian/koha-core.docs (+5 lines)
Line 0 Link Here
1
debian/docs/LEEME.Debian
2
misc/release_notes/release_notes_3*.txt
3
docs/history.txt
4
docs/contributors.yaml
5
docs/teams.yaml
(-)a/debian/koha-core.init (+226 lines)
Line 0 Link Here
1
#! /bin/sh
2
### BEGIN INIT INFO
3
# Provides:          koha-core
4
# Required-Start:    $remote_fs memcached
5
# Required-Stop:     $remote_fs
6
# Default-Start:     2 3 4 5
7
# Default-Stop:      0 1 6
8
# Short-Description: Start required services for each Koha instance
9
# Description:       For each enabled Koha instance on this host,
10
#                    if enabled, start:
11
#                      - a Zebra server (using koha-zebra)
12
#                      - a Plack server (using koha-plack)
13
#                      - a SIP server   (using koha-sip)
14
#                      - a Z3950 server (using koha-z3950-responder)
15
### END INIT INFO
16
17
# Author: Lars Wirzenius <lars@catalyst.net.nz>
18
19
# Do NOT "set -e"
20
21
# PATH should only include /usr/* if it runs after the mountnfs.sh script
22
PATH=/sbin:/usr/sbin:/bin:/usr/bin
23
DESC="Koha ILS"
24
NAME="koha-core"
25
SCRIPTNAME=/etc/init.d/$NAME
26
27
# Exit if the package is not installed
28
[ -x /usr/sbin/koha-zebra ] || exit 0
29
30
# Read configuration variable file if it is present
31
if [ -r /etc/default/$NAME ]; then
32
    # Debian / Ubuntu
33
    . /etc/default/$NAME
34
elif [ -r /etc/sysconfig/$NAME ]; then
35
    # RedHat / SuSE
36
    . /etc/sysconfig/$NAME
37
fi
38
39
# Load the VERBOSE setting and other rcS variables
40
. /lib/init/vars.sh
41
42
# Define LSB log_* functions.
43
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
44
. /lib/lsb/init-functions
45
46
# include helper functions
47
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
48
    . "/usr/share/koha/bin/koha-functions.sh"
49
else
50
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
51
    exit 1
52
fi
53
54
#
55
# Function that starts the daemon/service
56
#
57
do_start()
58
{
59
    # We insure all required directories exist, including disabled ones.
60
    koha-create-dirs $(koha-list)
61
##    koha-zebra --start $(koha-list --enabled)
62
##    koha-sip   --start $(koha-list --enabled --sip)
63
##    koha-plack --start $(koha-list --enabled --plack)
64
##    koha-z3950-responder --start --quiet $(koha-list --enabled --z3950)
65
##    koha-worker --start $(koha-list --enabled)
66
67
    if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
68
        koha-indexer --start --quiet $(koha-list --enabled)
69
    fi
70
}
71
72
#
73
# Function that stops the daemon/service
74
#
75
do_stop()
76
{
77
    # We stop everything, including disabled ones.
78
##    koha-zebra --stop $(koha-list) || true
79
##    koha-sip   --stop $(koha-list --sip)
80
##    koha-plack --stop --quiet $(koha-list --enabled --plack)
81
##    koha-z3950-responder --stop --quiet $(koha-list --enabled --z3950)
82
##    koha-worker --stop --quiet $(koha-list --enabled)
83
84
    if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
85
        koha-indexer --stop --quiet $(koha-list --enabled)
86
    fi
87
}
88
89
#
90
# Function that sends a SIGHUP to the daemon/service
91
#
92
do_reload() {
93
##    koha-zebra --restart $(koha-list --enabled)
94
##    koha-sip   --restart $(koha-list --enabled --sip)
95
##    koha-plack --restart --quiet $(koha-list --enabled --plack)
96
##    koha-z3950-responder --restart --quiet $(koha-list --enabled --z3950)
97
##    koha-worker --restart --quiet $(koha-list --enabled)
98
99
    if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
100
        koha-indexer --restart --quiet $(koha-list --enabled)
101
    fi
102
}
103
104
#
105
# Function that shows the status of the zebrasrv daemon for
106
# enabled instances
107
#
108
zebra_status()
109
{
110
    for instance in $(koha-list --enabled); do
111
112
        log_daemon_msg "Zebra server running for instance $instance"
113
114
        if is_zebra_running $instance ; then
115
            log_end_msg 0
116
        else
117
            log_end_msg 1
118
        fi
119
    done
120
}
121
122
#
123
# Function that shows the status of the SIP server daemon for
124
# enabled instances
125
#
126
sip_status()
127
{
128
    for instance in $(koha-list --enabled --sip); do
129
130
        log_daemon_msg "SIP server running for instance $instance"
131
132
        if is_sip_running $instance ; then
133
            log_end_msg 0
134
        else
135
            log_end_msg 1
136
        fi
137
    done
138
}
139
140
#
141
# Function that shows the status of the Plack server daemon for
142
# enabled instances
143
#
144
plack_status()
145
{
146
    for instance in $(koha-list --enabled --plack); do
147
148
        log_daemon_msg "Plack server running for instance ${instance}"
149
150
        if is_plack_running $instance ; then
151
            log_end_msg 0
152
        else
153
            log_end_msg 1
154
        fi
155
    done
156
}
157
158
#
159
# Function that shows the status of the Z39.50/SRU server daemon for
160
# enabled instances
161
#
162
z3950_status()
163
{
164
    for instance in $(koha-list --enabled --z3950); do
165
166
        log_daemon_msg "Z39.50/SRU daemon running for instance ${instance}"
167
168
        if is_z3950_running $instance ; then
169
            log_end_msg 0
170
        else
171
            log_end_msg 1
172
        fi
173
    done
174
}
175
176
case "$1" in
177
  start)
178
	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
179
	do_start
180
	case "$?" in
181
		0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
182
		*) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
183
	esac
184
	;;
185
  stop)
186
	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
187
	do_stop
188
	case "$?" in
189
		0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
190
		*) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
191
	esac
192
	;;
193
  restart|force-reload)
194
	#
195
	# If the "reload" option is implemented then remove the
196
	# 'force-reload' alias
197
	#
198
	log_daemon_msg "Restarting $DESC" "$NAME"
199
	do_stop
200
	case "$?" in
201
	  0)
202
		do_start
203
		case "$?" in
204
			0) log_end_msg 0 ;;
205
			*) log_end_msg 1 ;; # Failed to start
206
		esac
207
		;;
208
	  *)
209
	  	# Failed to stop
210
		log_end_msg 1
211
		;;
212
	esac
213
	;;
214
  status)
215
        zebra_status
216
        sip_status
217
        plack_status
218
        z3950_status
219
        ;;
220
  *)
221
    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
222
	exit 3
223
	;;
224
esac
225
226
:
(-)a/debian/koha-core.install (+40 lines)
Line 0 Link Here
1
debian/tmp/usr/*                            usr
2
debian/tmp/etc/koha/pazpar2
3
debian/tmp/etc/koha/zebradb/[!z]*
4
debian/tmp/etc/koha/z3950
5
debian/templates/* etc/koha
6
debian/koha-post-install-setup              usr/sbin
7
debian/unavailable.html                     usr/share/koha/intranet/htdocs
8
debian/unavailable.html                     usr/share/koha/opac/htdocs
9
debian/templates/*                          etc/koha
10
debian/scripts/koha-functions.sh            usr/share/koha/bin
11
debian/scripts/koha-create                  usr/sbin
12
debian/scripts/koha-create-dirs             usr/sbin
13
debian/scripts/koha-disable                 usr/sbin
14
debian/scripts/koha-dump                    usr/sbin
15
debian/scripts/koha-dump-defaults           usr/sbin
16
debian/scripts/koha-elasticsearch           usr/sbin
17
debian/scripts/koha-email-disable           usr/sbin
18
debian/scripts/koha-email-enable            usr/sbin
19
debian/scripts/koha-enable                  usr/sbin
20
debian/scripts/koha-foreach                 usr/sbin
21
debian/scripts/koha-indexer                 usr/sbin
22
debian/scripts/koha-list                    usr/sbin
23
debian/scripts/koha-mysql                   usr/sbin
24
debian/scripts/koha-passwd                  usr/sbin
25
debian/scripts/koha-plack                   usr/sbin
26
debian/scripts/koha-rebuild-zebra           usr/sbin
27
debian/scripts/koha-remove                  usr/sbin
28
debian/scripts/koha-reset-passwd            usr/sbin
29
debian/scripts/koha-restore                 usr/sbin
30
debian/scripts/koha-run-backups             usr/sbin
31
debian/scripts/koha-shell                   usr/sbin
32
debian/scripts/koha-sip                     usr/sbin
33
debian/scripts/koha-sitemap                 usr/sbin
34
debian/scripts/koha-translate               usr/sbin
35
debian/scripts/koha-upgrade-schema          usr/sbin
36
debian/scripts/koha-upgrade-to-3.4          usr/sbin
37
debian/scripts/koha-worker                  usr/sbin
38
debian/scripts/koha-z3950-responder         usr/sbin
39
debian/scripts/koha-zebra                   usr/sbin
40
debian/tmp_docbook/*.8                      usr/share/man/man8
(-)a/debian/koha-core.links (+8 lines)
Line 0 Link Here
1
usr/sbin/koha-zebra  usr/sbin/koha-start-zebra
2
usr/sbin/koha-zebra  usr/sbin/koha-stop-zebra
3
usr/sbin/koha-zebra  usr/sbin/koha-restart-zebra
4
usr/sbin/koha-sip    usr/sbin/koha-enable-sip
5
usr/sbin/koha-sip    usr/sbin/koha-start-sip
6
usr/sbin/koha-sip    usr/sbin/koha-stop-sip
7
usr/sbin/koha-sip    usr/sbin/koha-stop-sip
8
etc/default/koha-core etc/default/koha-common
(-)a/debian/koha-core.logrotate (+15 lines)
Line 0 Link Here
1
# Rotate log files for all Koha instances.
2
3
/var/log/koha/*/*.log {
4
    rotate 5
5
    weekly
6
    missingok
7
    copytruncate
8
    compress
9
    delaycompress
10
    notifempty
11
    sharedscripts
12
    postrotate
13
        /etc/init.d/apache2 reload > /dev/null
14
    endscript
15
}
(-)a/debian/koha-core.postinst (+267 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
set -e
4
5
# Default to "yes"
6
AUTOMATIC_TRANSLATIONS_UPDATE="yes"
7
8
. /usr/share/debconf/confmodule
9
10
# Read configuration variable file if it is present
11
CONFIG=/etc/koha/koha-common.conf
12
if [ -r $CONFIG ]; then
13
    . $CONFIG
14
fi
15
16
conf=/etc/mysql/koha-common.cnf
17
if [ ! -e "$conf" ] && [ ! -L "$conf" ]
18
then
19
    ln -s debian.cnf "$conf"
20
fi
21
22
#DEBHELPER#
23
24
koha-upgrade-schema $(koha-list)
25
26
# Generate a config file if one doesn't exist already
27
if [ ! -e $CONFIG ]; then
28
    cat <<EOF > $CONFIG
29
## Automatic template translation update
30
#
31
# This variable controls whether template translations should
32
# be updated automatically on koha-common package upgrades.
33
# Options: 'yes' (default)
34
#          'no'
35
# Note: if you choose 'no' then you will have to issue
36
#  $ koha-translate --update <lang_code>
37
#
38
AUTOMATIC_TRANSLATIONS_UPDATE="yes"
39
EOF
40
fi
41
42
# Substitute the values from debconf into the file.
43
db_get koha-core/automatically-update-translations
44
UPDATE="$RET"
45
if [ "$UPDATE" = "false" ]; then
46
    UPDATE="no"
47
else
48
    UPDATE="yes"
49
fi
50
# In case they were removed/commented out, we add it in.
51
grep -Eq '^ *AUTOMATIC_TRANSLATIONS_UPDATE=' $CONFIG || \
52
    echo "AUTOMATIC_TRANSLATIONS_UPDATE=" >> $CONFIG
53
54
sed -e "s/^ *AUTOMATIC_TRANSLATIONS_UPDATE=.*/AUTOMATIC_TRANSLATIONS_UPDATE=\"$UPDATE\"/" < $CONFIG > $CONFIG.tmp
55
mv -f $CONFIG.tmp $CONFIG
56
57
if [ "$AUTOMATIC_TRANSLATIONS_UPDATE" = "yes" ]; then
58
    for lang in $(koha-translate --list | grep -v -x "en"); do
59
        if koha-translate --update $lang; then
60
            echo "Updated the $lang translations."
61
        else
62
            cat <<EOF >&2
63
ERROR: an error was found when updating '$lang' translations. Please manually
64
run 'koha-translate --update $lang'. Run man koha-translate for more options.
65
EOF
66
        fi
67
    done
68
else
69
    # no auto-update, check update needed and warn if needed
70
    if koha-translate --list | grep -v -q -x "en"; then
71
        # translations installed, update needed
72
        cat <<EOF >&2
73
Warning: template translations are not set to be automatically updated.
74
Please manually run 'koha-translate --update lang_code' to update them.
75
76
You can run 'koha-translate --list' to get a list of the installed translations codes.
77
EOF
78
    fi
79
fi
80
81
# Check if we need to rename the Apache vhost files
82
RENAME_APACHE_FILES="no"
83
for vhost in $(koha-list); do
84
    if [ -f "/etc/apache2/sites-available/$vhost" ] && \
85
       [ ! -f "/etc/apache2/sites-available/$vhost.conf" ]; then
86
       RENAME_APACHE_FILES="yes"
87
       break # at least one, trigger renaming
88
    fi
89
done
90
91
if [ "$RENAME_APACHE_FILES" = "yes" ]; then
92
    # If the user agreed we now rename their Apache files
93
    db_get koha-core/rename-apache-vhost-files
94
    if [ "$RET" = "false" ]; then
95
        # We're not renaming the files, just print a warning
96
        cat <<EOF >&2
97
Warning: you have chosen not to migrate your Apache virtual hosts files to the
98
Apache 2.4 naming schema. You can do it manually by running this for each
99
Koha instance:
100
101
    $ sudo a2dissite instance
102
    $ sudo mv /etc/apache2/sites-available/instance \
103
              /etc/apache2/sites-available/instance.conf
104
    $ sudo a2ensite instance
105
EOF
106
    else
107
        # We have to rename the Apache files
108
        for site in $(koha-list); do
109
            ENABLE_VHOST="yes"
110
            if [ -f "/etc/apache2/sites-available/$site" ] && \
111
               [ ! -f "/etc/apache2/sites-available/$site.conf" ]; then
112
                if [ ! -f "/etc/apache2/sites-enabled/$site" ]; then
113
                    ENABLE_VHOST="no"
114
                fi
115
                a2dissite $site > /dev/null 2>&1 || true
116
                rm -f "/etc/apache2/sites-enabled/$site"
117
                # Rename the vhost definition files
118
                mv "/etc/apache2/sites-available/$site" \
119
                   "/etc/apache2/sites-available/$site.conf"
120
121
                if [ "$ENABLE_VHOST" = "yes" ]; then
122
                    if ! {
123
                        a2ensite "$site" > /dev/null 2>&1 ||
124
                        a2ensite "${site}.conf" > /dev/null 2>&1
125
                    }; then
126
                        echo "Warning: problem enabling $site in Apache" >&2
127
                    fi
128
                fi
129
            fi
130
        done
131
    fi
132
fi
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] %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
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
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
234
log4perl.appender.PLACKINTRANET.utf8=1
235
236
EOF
237
    fi
238
done
239
240
for site in $(koha-list); do
241
    kohaconfig="/etc/koha/sites/$site/koha-conf.xml"
242
    logdir="$( xmlstarlet sel -t -v 'yazgfs/config/logdir' $kohaconfig )"
243
    if [ "$logdir" != "" ] && [ "$logdir" != "0" ]; then
244
        chown -R $site-koha:$site-koha $logdir
245
    else
246
        chown -R $site-koha:$site-koha /var/log/koha/$site
247
    fi
248
done
249
250
# Bug 14106 - fix the modulePath of existing koha instances so that it'll
251
# continue to work. This will only patch the files if the exact original string
252
# that we're fixing them from is there, so we just run it every time. Maybe
253
# in many years time we can get rid of this, when no one will be running
254
# Koha < 3.20.
255
for zfile in $( find /etc/koha/sites -name zebra-authorities-dom.cfg -or -name zebra-biblios-dom.cfg ); do
256
    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
257
done
258
259
db_stop
260
261
# Bug 18250: Correct startup order of koha-common and memcached
262
# Since the init script has been updated, we can force the order in rc.d
263
# by disabling and enabling again.
264
update-rc.d koha-core disable
265
update-rc.d koha-core enable
266
267
exit 0
(-)a/debian/koha-core.preinst (+11 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
set -e
4
5
# Bug 14055 - remove the yui symlink if there's one in the way preventing upgrades
6
[ -h /usr/share/koha/opac/htdocs/opac-tmpl/lib/yui ] && rm /usr/share/koha/opac/htdocs/opac-tmpl/lib/yui
7
8
# Bug 25485: remove the tiny_mce symlink if there's one in the way preventing upgrades
9
[ -h /usr/share/koha/intranet/htdocs/intranet-tmpl/lib/tiny_mce ] && rm /usr/share/koha/intranet/htdocs/intranet-tmpl/lib/tiny_mce
10
11
exit 0
(-)a/debian/koha-core.templates (+25 lines)
Line 0 Link Here
1
Template: koha-core/3.2-3.4-upgrade-notice
2
Type: note
3
Description: koha-core upgrade actions required
4
 If you are upgrading from a Koha 3.2 to 3.4 release, you must run:
5
  sudo /usr/sbin/koha-upgrade-to-3.4
6
 .
7
 For large catalogues, running this may take a while. Your Koha installation
8
 should be largely operational during the process, but some things,
9
 particularly to do with items, may appear strange until the upgrade and
10
 re-index is complete.
11
12
Template: koha-core/automatically-update-translations
13
Type: boolean
14
Default: true
15
Description: automatically update translations
16
  When Koha is upgraded, any existing translated templates can be regenerated
17
  to keep everything in sync. Select "yes" if you want this.
18
19
Template: koha-core/rename-apache-vhost-files
20
Type: boolean
21
Default: true
22
Description: Rename the Apache virtual hosts files for Koha instances?
23
 When Koha is upgraded, the Apache's virtual host definition files can be
24
 renamed to match the needs of the newer Apache 2.4. Previously defined
25
 Koha instances will get their Apache files appended '.conf'.
(-)a/debian/koha-full.postinst (+11 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
set -e
4
5
a2enmod mpm_itk rewrite cgi rewrite headers proxy_http
6
service apache2 restart
7
8
rabbitmq-plugins enable rabbitmq_stomp
9
service rabbitmq-server restart
10
11
exit 0
(-)a/debian/templates/koha-core.conf (-1 / +17 lines)
Line 0 Link Here
0
- 
1
### Configuration settings for all Koha sites
2
#
3
# This file contains configuration settings that apply
4
# to all Koha sites on this server or which apply to
5
# the koha-core package itself.
6
#
7
8
## Automatic template translation update
9
#
10
# This variable controls whether template translations should
11
# be updated automatically on koha-core package upgrades.
12
# Options: 'yes' (default)
13
#          'no'
14
# Note: if you choose 'no' then you will have to issue
15
#  $ koha-translate --update <lang_code>
16
#
17
AUTOMATIC_TRANSLATIONS_UPDATE="yes"

Return to bug 26672