From 515736129c4fa0d211c517165108f137a0c6e4e3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 3 May 2018 17:10:33 -0300 Subject: [PATCH] Bug 20692: Return and display and error if koha-plack failed If koha-plack did not comment/uncomment the line it should fails and display an error instead of success. Useful for old apache config files --- debian/scripts/koha-plack | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/debian/scripts/koha-plack b/debian/scripts/koha-plack index 1677ee0ec1..a8c2860311 100755 --- a/debian/scripts/koha-plack +++ b/debian/scripts/koha-plack @@ -178,8 +178,10 @@ 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" + sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$:\1:q' "$instancefile" + || { warn "Cannot enable plack for opac - update your apache config files" && return 1; } + sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$:\1:q' "$instancefile" + || { warn "Cannot enable plack for intranet -- update your apache config files" && return 1; } [ "${quiet}" != "yes" ] && warn "Plack enabled for ${instancename}" return 0 else @@ -195,8 +197,10 @@ 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" + sed -i 's:^\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$:#\1:q' "$instancefile" + || { warn "Cannot disable plack for opac - update your apache config files" && return 1; } + sed -i 's:^\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$:#\1:q' "$instancefile" + || { warn "Cannot disable plack for intranet - update your apache config files" && return 1; } [ "${quiet}" != "yes" ] && warn "Plack disabled for ${instancename}" return 0 else -- 2.11.0