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/>.
22 # include helper functions
23 if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
24 . "/usr/share/koha/bin/koha-functions.sh"
26 echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
36 for instance in $( get_instances ); do
39 if instance_filter_email $instance $show_email && \
40 instance_filter_plack $instance $show_plack && \
41 instance_filter_sip $instance $show_sip; then
45 if is_enabled $instance; then
46 if instance_filter_email $instance $show_email && \
47 instance_filter_plack $instance $show_plack && \
48 instance_filter_sip $instance $show_sip; then
53 if ! is_enabled $instance; then
54 if instance_filter_email $instance $show_email && \
55 instance_filter_plack $instance $show_plack && \
56 instance_filter_sip $instance $show_sip; then
74 if is_sip_enabled $instancename; then
78 if ! is_sip_enabled $instancename; then
83 # Didn't match any criteria
87 instance_filter_plack()
96 if is_plack_enabled $instancename; then
100 if ! is_plack_enabled $instancename; then
105 # Didn't match any criteria
109 instance_filter_email()
111 local instancename=$1
118 if is_email_enabled $instancename; then
122 if ! is_email_enabled $instancename; then
127 # Didn't match any criteria
135 if [ "$show" = "all" ]; then
138 die "Error: --enabled and --disabled are mutually exclusive."
146 if [ "$show_email" = "all" ]; then
147 show_email=$email_param
149 die "Error: --email and --noemail are mutually exclusive."
157 if [ "$show_plack" = "all" ]; then
158 show_plack=$plack_param
160 die "Error: --plack and --noplack are mutually exclusive."
168 if [ "$show_sip" = "all" ]; then
171 die "Error: --sip and --nosip are mutually exclusive."
180 Lists Koha instances, optionally only those that are enabled or have
183 Usage: $scriptname [--enabled|--disabled] [--email|--noemail] [--sip|--nosip] [-h]
185 --enabled Show enabled instances
186 --disabled Show disabled instances
187 --email Show instances with email enabled
188 --noemail Show instances with email disabled
189 --sip Show instances with SIP enabled
190 --nosip Show instances with SIP disabled
191 --plack Show instances with Plack enabled
192 --noplack Show instances with Plack disabled
193 --help | -h Show this help
195 The filtering options can be combined, and you probably want to do this
196 (except --email and --noemail, or --enabled and --disabled, that's just silly.)
205 args=$(getopt -l help,enabled,disabled,email,noemail,sip,nosip,plack,noplack -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 --plack) set_show_plack "enabled" ;;
217 --noplack) set_show_plack "disabled" ;;
218 --enabled) set_show "enabled" ;;
219 --disabled) set_show "disabled" ;;
225 show_instances $show $show_email $show_sip