Bug 6361 - make the packages work with koha 3.4
[koha.git] / debian / scripts / koha-upgrade-to-3.4
1 #!/bin/sh
2 #
3 # koha-upgrade-to-3.4 - performs the necessary changes to upgrade a Koha
4 # system from 3.2 to 3.4
5 #
6 # Copyright 2011  Catalyst IT, Ltd
7
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
21 TO_UPGRADE=$@
22
23 if [ -z "$TO_UPGRADE" ] ;
24 then
25     TO_UPGRADE=`koha-list`
26 fi
27
28 if [ -z "$TO_UPGRADE" ] ;
29 then
30     echo "No Koha instances were found to upgrade."
31     exit
32 fi
33
34 cat <<EOH
35 Koha will be upgraded for the following instances: $TO_UPGRADE
36
37 This may take some time to run. Go make a coffee.
38 EOH
39
40 for name in "$TO_UPGRADE"
41 do
42     echo "Upgrading $name..."
43     sudo -u "$name-koha" -H \
44         env PERL5LIB=/usr/share/koha/lib \
45         KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \
46         /usr/share/koha/bin/maintenance/remove_items_from_biblioitems.pl --run
47     echo "Rebuilding zebra for $name..."
48     koha-rebuild-zebra --full -v -u $name
49 done