Lines 32-56
show_instances()
Link Here
|
32 |
local show=$1 |
32 |
local show=$1 |
33 |
local show_email=$2 |
33 |
local show_email=$2 |
34 |
local show_sip=$3 |
34 |
local show_sip=$3 |
|
|
35 |
local show_plugins=$4 |
35 |
|
36 |
|
36 |
for instance in $( get_instances ); do |
37 |
for instance in $( get_instances ); do |
37 |
case $show in |
38 |
case $show in |
38 |
"all") |
39 |
"all") |
39 |
if instance_filter_email $instance $show_email && \ |
40 |
if instance_filter_email $instance $show_email && \ |
40 |
instance_filter_sip $instance $show_sip; then |
41 |
instance_filter_sip $instance $show_sip && \ |
|
|
42 |
instance_filter_plugins; then |
41 |
echo $instance |
43 |
echo $instance |
42 |
fi ;; |
44 |
fi ;; |
43 |
"enabled") |
45 |
"enabled") |
44 |
if is_enabled $instance; then |
46 |
if is_enabled $instance; then |
45 |
if instance_filter_email $instance $show_email && \ |
47 |
if instance_filter_email $instance $show_email && \ |
46 |
instance_filter_sip $instance $show_sip; then |
48 |
instance_filter_sip $instance $show_sip && \ |
|
|
49 |
instance_filter_plugins; then |
47 |
echo $instance |
50 |
echo $instance |
48 |
fi |
51 |
fi |
49 |
fi ;; |
52 |
fi ;; |
50 |
"disabled") |
53 |
"disabled") |
51 |
if ! is_enabled $instance; then |
54 |
if ! is_enabled $instance; then |
52 |
if instance_filter_email $instance $show_email && \ |
55 |
if instance_filter_email $instance $show_email && \ |
53 |
instance_filter_sip $instance $show_sip; then |
56 |
instance_filter_sip $instance $show_sip && \ |
|
|
57 |
instance_filter_plugins; then |
54 |
echo $instance |
58 |
echo $instance |
55 |
fi |
59 |
fi |
56 |
fi ;; |
60 |
fi ;; |
Lines 58-64
show_instances()
Link Here
|
58 |
done |
62 |
done |
59 |
} |
63 |
} |
60 |
|
64 |
|
61 |
|
|
|
62 |
instance_filter_sip() |
65 |
instance_filter_sip() |
63 |
{ |
66 |
{ |
64 |
local instancename=$1 |
67 |
local instancename=$1 |
Lines 103-108
instance_filter_email()
Link Here
|
103 |
return 1 |
106 |
return 1 |
104 |
} |
107 |
} |
105 |
|
108 |
|
|
|
109 |
instance_filter_plugins() |
110 |
{ |
111 |
local instancename=$1 |
112 |
local show_plugins=$2; |
113 |
|
114 |
case $show_plugins in |
115 |
"all") |
116 |
return 0 ;; |
117 |
"enabled") |
118 |
if is_pluginsdir_enabled $instancename; then |
119 |
return 0 |
120 |
fi ;; |
121 |
"disabled") |
122 |
if ! is_pluginsdir_enabled $instancename; then |
123 |
return 1 |
124 |
fi ;; |
125 |
esac |
126 |
} |
127 |
|
106 |
set_show() |
128 |
set_show() |
107 |
{ |
129 |
{ |
108 |
local show_param=$1 |
130 |
local show_param=$1 |
Lines 136-141
set_show_sip()
Link Here
|
136 |
fi |
158 |
fi |
137 |
} |
159 |
} |
138 |
|
160 |
|
|
|
161 |
set_show_plugins() |
162 |
{ |
163 |
local plugins_param=$1 |
164 |
|
165 |
if [ "$show_plugins" = "all" ]; then |
166 |
show_plugins=$plugins_param |
167 |
else |
168 |
die "Error: --plugins and --noplugins are mutually exclusive." |
169 |
fi |
170 |
} |
171 |
|
139 |
usage() |
172 |
usage() |
140 |
{ |
173 |
{ |
141 |
local scriptname=$0 |
174 |
local scriptname=$0 |
Lines 152-157
Options:
Link Here
|
152 |
--noemail Only show instances that do not have email enabled |
185 |
--noemail Only show instances that do not have email enabled |
153 |
--sip Only show instances that have SIP enabled |
186 |
--sip Only show instances that have SIP enabled |
154 |
--nosip Only show instances that do not have SIP enabled |
187 |
--nosip Only show instances that do not have SIP enabled |
|
|
188 |
--plugins Only show instances that have Koha plugins enabled |
189 |
--noplugins Only show instances that do not have Koha plugins enabled |
155 |
--help | -h Show this help |
190 |
--help | -h Show this help |
156 |
|
191 |
|
157 |
The filtering options can be combined, and you probably want to do this |
192 |
The filtering options can be combined, and you probably want to do this |
Lines 163-169
show="all"
Link Here
|
163 |
show_email="all" |
198 |
show_email="all" |
164 |
show_sip="all" |
199 |
show_sip="all" |
165 |
|
200 |
|
166 |
args=$(getopt -l help,enabled,disabled,email,noemail,sip,nosip -o h -n $0 -- "$@") |
201 |
args=$(getopt -l help,enabled,disabled,email,noemail,sip,nosip,plugins,noplugins -o h -n $0 -- "$@") |
167 |
set -- $args |
202 |
set -- $args |
168 |
|
203 |
|
169 |
while [ ! -z "$1" ] |
204 |
while [ ! -z "$1" ] |
Lines 174-179
do
Link Here
|
174 |
--noemail) set_show_email "disabled" ;; |
209 |
--noemail) set_show_email "disabled" ;; |
175 |
--sip) set_show_sip "enabled" ;; |
210 |
--sip) set_show_sip "enabled" ;; |
176 |
--nosip) set_show_sip "disabled" ;; |
211 |
--nosip) set_show_sip "disabled" ;; |
|
|
212 |
--plugins) set_show_plugins "enabled" ;; |
213 |
--noplugins) set_show_plugins "disabled" ;; |
177 |
--enabled) set_show "enabled" ;; |
214 |
--enabled) set_show "enabled" ;; |
178 |
--disabled) set_show "disabled" ;; |
215 |
--disabled) set_show "disabled" ;; |
179 |
*) break;; |
216 |
*) break;; |
Lines 181-186
do
Link Here
|
181 |
shift |
218 |
shift |
182 |
done |
219 |
done |
183 |
|
220 |
|
184 |
show_instances $show $show_email $show_sip |
221 |
show_instances $show $show_email $show_sip $show_plugins |
185 |
|
222 |
|
186 |
exit 0 |
223 |
exit 0 |
187 |
- |
|
|