3 # koha-remove -- Remove a Koha instance.
4 # Copyright 2010 Catalyst IT, Ltd
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 echo "Removing Koha instance $name"
27 mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof
28 DROP USER \`koha_$name\`;
29 DROP DATABASE \`koha_$name\`;
34 [ -f "/etc/apache2/sites-available/$name" ] && \
35 rm "/etc/apache2/sites-available/$name"
36 [ -f "/etc/koha/sites/$name/koha-conf.xml" ] && \
37 rm "/etc/koha/sites/$name/koha-conf.xml"
38 [ -f "/etc/koha/sites/$name/zebra-biblios.cfg" ] && \
39 rm "/etc/koha/sites/$name/zebra-biblios.cfg"
40 [ -f "/etc/koha/sites/$name/zebra-authorities.cfg" ] && \
41 rm "/etc/koha/sites/$name/zebra-authorities.cfg"
42 [ -f "/etc/koha/sites/$name/zebra-authorities-dom.cfg" ] && \
43 rm "/etc/koha/sites/$name/zebra-authorities-dom.cfg"
44 [ -f "/etc/koha/sites/$name/zebra.passwd" ] && \
45 rm "/etc/koha/sites/$name/zebra.passwd"
46 [ -d "/etc/koha/sites/$name" ] && \
47 rmdir "/etc/koha/sites/$name"
48 [ -d "/var/lock/koha/$name" ] && \
49 rm -r "/var/lock/koha/$name"
50 [ -d "/var/log/koha/$name" ] && \
51 rm -r "/var/log/koha/$name"
52 [ -d "/var/run/koha/$name" ] && \
53 rm -r "/var/run/koha/$name"
54 getent passwd "$name-koha" > /dev/null && deluser --quiet "$name-koha"
58 service apache2 restart