@@ -, +, @@ koha-list - It seems that the -h switch did not work before this patch, now both -h and --help works nicely - --sip and --nosip work as expected, also in combination with --email and --noemail --- debian/scripts/koha-list | 99 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 81 insertions(+), 18 deletions(-) --- a/debian/scripts/koha-list +++ a/debian/scripts/koha-list @@ -49,6 +49,17 @@ is_email_enabled() fi } +is_sip_enabled() +{ + local instancename=$1 + + if [ -e /etc/koha/sites/$instancename/SIPconfig.xml ]; then + return 0 + else + return 1 + fi +} + get_instances() { find /etc/koha/sites -mindepth 1 -maxdepth 1\ @@ -59,40 +70,76 @@ show_instances() { local show=$1 local show_email=$2 + local show_sip=$3 for instance in $( get_instances ); do case $show in "all") - show_instance_filter_email $instance $show_email;; + if instance_filter_email $instance $show_email && \ + instance_filter_sip $instance $show_sip; then + echo $instance + fi ;; "enabled") if is_enabled $instance; then - show_instance_filter_email $instance $show_email + if instance_filter_email $instance $show_email && \ + instance_filter_sip $instance $show_sip; then + echo $instance + fi fi ;; "disabled") if ! is_enabled $instance; then - show_instance_filter_email $instance $show_email + if instance_filter_email $instance $show_email && \ + instance_filter_sip $instance $show_sip; then + echo $instance + fi fi ;; esac done } -show_instance_filter_email() + +instance_filter_sip() +{ + local instancename=$1 + local show_sip=$2; + + case $show_sip in + "all") + return 0 ;; + "enabled") + if is_sip_enabled $instancename; then + return 0 + fi ;; + "disabled") + if ! is_sip_enabled $instancename; then + return 0 + fi ;; + esac + + # Didn't match any criteria + return 1 +} + +instance_filter_email() { local instancename=$1 local show_email=$2; case $show_email in "all") - echo $instancename ;; + return 0 ;; "enabled") if is_email_enabled $instancename; then - echo $instancename + return 0 fi ;; "disabled") if ! is_email_enabled $instancename; then - echo $instancename + return 0 fi ;; esac + + # Didn't match any criteria + return 1 } set_show() @@ -117,39 +164,55 @@ set_show_email() fi } +set_show_sip() +{ + local sip_param=$1 + + if [ "$show_sip" = "all" ]; then + show_sip=$sip_param + else + die "Error: --sip and --nosip are mutually exclusive." + fi +} + usage() { local scriptname=$0 - echo <