X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;ds=sidebyside;f=debian%2Fscripts%2Fkoha-enable;h=67cbc8bf851203df83ad832fb8ff6460676a70ad;hb=0162453a1cf20f5037bdda1cdeb662283f05f5f0;hp=c0bbfa26272c0db09b28006887cbd2bf5c716de0;hpb=7d09198659c92eda7046dee0f93e4caf2ec37096;p=koha_fer diff --git a/debian/scripts/koha-enable b/debian/scripts/koha-enable index c0bbfa2627..67cbc8bf85 100755 --- a/debian/scripts/koha-enable +++ b/debian/scripts/koha-enable @@ -19,54 +19,22 @@ set -e - -die() -{ - echo "$@" 1>&2 +# include helper functions +if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then + . "/usr/share/koha/bin/koha-functions.sh" +else + echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 exit 1 -} - -warn() -{ - echo "$@" 1>&2 -} - -is_enabled() -{ - local instancename=$1 - - if ! is_instance $instancename; then - return 1 - fi - - if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \ - "/etc/apache2/sites-available/$instancename" ; then - return 1 - else - return 0 - fi -} - -is_instance() -{ - local instancename=$1 - - if find /etc/koha/sites -mindepth 1 -maxdepth 1 \ - -type d -printf '%f\n'\ - | grep -q -x $instancename ; then - return 0 - else - return 1 - fi -} +fi enable_instance() { local instancename=$1 + local instancefile="/etc/apache2/sites-available/$instancename.conf" if ! is_enabled $instancename; then sed -i 's:^\(\s*Include /etc/koha/apache-shared-disable.conf\)$:#\1:' \ - "/etc/apache2/sites-available/$instancename" + "$instancefile" return 0 else return 1