@@ -, +, @@ --- debian/scripts/koha-plack | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) --- a/debian/scripts/koha-plack +++ a/debian/scripts/koha-plack @@ -178,8 +178,19 @@ enable_plack() if ! is_plack_enabled $instancename; then # Uncomment the plack related lines for OPAC and intranet - sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$:\1:' "$instancefile" - sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$:\1:' "$instancefile" + + if grep -q '^\s*#\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$' "$instancefile"; then + sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$:\1:' "$instancefile" + else + warn "Cannot enable plack for opac - update your apache config files" + return 1 + fi + if grep -q '^\s*#\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$' "$instancefile"; then + sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$:\1:' "$instancefile" + else + warn "Cannot enable plack for intranet -- update your apache config files" + return 1 + fi [ "${quiet}" != "yes" ] && warn "Plack enabled for ${instancename}" return 0 else @@ -195,8 +206,18 @@ disable_plack() if is_plack_enabled $instancename; then # Comment out the plack related lines for OPAC and intranet - sed -i 's:^\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$:#\1:' "$instancefile" - sed -i 's:^\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$:#\1:' "$instancefile" + if grep -q '^\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$' "$instancefile"; then + sed -i 's:^\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$:#\1:' "$instancefile" + else + warn "Cannot disable plack for opac - update your apache config files" + return 1 + fi + if grep -q '^\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$' "$instancefile"; then + sed -i 's:^\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$:#\1:' "$instancefile" + else + warn "Cannot disable plack for intranet - update your apache config files" + return 1 + fi [ "${quiet}" != "yes" ] && warn "Plack disabled for ${instancename}" return 0 else --