3 # koha-list -- List all Koha instances.
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/>.
32 if grep '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
33 "/etc/apache2/sites-available/$instancename" > /dev/null
45 if [ -e /var/lib/koha/$instancename/email.enabled ]; then
56 if [ -e /etc/koha/sites/$instancename/SIPconfig.xml ]; then
65 find /etc/koha/sites -mindepth 1 -maxdepth 1\
66 -type d -printf '%f\n' | sort
75 for instance in $( get_instances ); do
78 if instance_filter_email $instance $show_email && \
79 instance_filter_sip $instance $show_sip; then
83 if is_enabled $instance; then
84 if instance_filter_email $instance $show_email && \
85 instance_filter_sip $instance $show_sip; then
90 if ! is_enabled $instance; then
91 if instance_filter_email $instance $show_email && \
92 instance_filter_sip $instance $show_sip; then
101 instance_filter_sip()
103 local instancename=$1
110 if is_sip_enabled $instancename; then
114 if ! is_sip_enabled $instancename; then
119 # Didn't match any criteria
123 instance_filter_email()
125 local instancename=$1
132 if is_email_enabled $instancename; then
136 if ! is_email_enabled $instancename; then
141 # Didn't match any criteria
149 if [ "$show" = "all" ]; then
152 die "Error: --enabled and --disabled are mutually exclusive."
160 if [ "$show_email" = "all" ]; then
161 show_email=$email_param
163 die "Error: --email and --noemail are mutually exclusive."
171 if [ "$show_sip" = "all" ]; then
174 die "Error: --sip and --nosip are mutually exclusive."
183 Lists Koha instances, optionally only those that are enabled or have
186 Usage: $scriptname [--enabled|--disabled] [--email|--noemail] [--sip|--nosip] [-h]
188 --enabled Only show instances that are enabled
189 --disabled Only show instances that are disabled
190 --email Only show instances that have email enabled
191 --noemail Only show instances that do not have email enabled
192 --sip Only show instances that have sip enabled
193 --nosip Only show instances that do not have sip enabled
194 --help | -h Show this help
196 The filtering options can be combined, and you probably want to do this
197 (except --email and --noemail, or --enabled and --disabled, that's just silly.)
205 args=$(getopt -l help,enabled,disabled,email,noemail,sip,nosip -o h -n $0 -- "$@")
211 -h|--help) usage; exit;;
212 --email) set_show_email "enabled" ;;
213 --noemail) set_show_email "disabled" ;;
214 --sip) set_show_sip "enabled" ;;
215 --nosip) set_show_sip "disabled" ;;
216 --enabled) set_show "enabled" ;;
217 --disabled) set_show "disabled" ;;
223 show_instances $show $show_email $show_sip