Bug 25184: (RM follow-up) Make DB update idempotent
[koha.git] / debian / koha-common.config
blob87defe2a80341564a90a763e9f4e22bca560fc6a
1 #!/bin/sh
3 # koha-common.config - ensures that debconf stuff is all handled properly
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.
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.
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/>.
20 set -e
22 . /usr/share/debconf/confmodule
24 CONFIGFILE=/etc/koha/koha-common.conf
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"
33 db_set koha-common/automatically-update-translations "$UPDATE"
34 else
35 # True is the default
36 db_set koha-common/automatically-update-translations true
39 if dpkg --compare-versions "$2" lt-nl 3.4 ; then
40 db_input high koha-common/3.2-3.4-upgrade-notice || true
43 db_input medium koha-common/automatically-update-translations || true
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
55 done
56 if [ "$RENAME_APACHE_FILES" = "yes" ]; then
57 db_input high koha-common/rename-apache-vhost-files || true
61 db_go || true