This patch adds the new koha-zebra script the ability to handle being
called by other script names, for backwards compatibility with the legacy
koha-*-zebra scripts.
It is intended to be used in conjunction with a patch that replaces the old
koha-*-zebra scripts for symbolic links, pointing to the new koha-zebra script.
To test:
- Apply this patch
- Create symbolic links to the new script:
vagrant@kohadevbox:~$ ln -s kohaclone/debian/scripts/koha-zebra koha-start-zebra
vagrant@kohadevbox:~$ ln -s kohaclone/debian/scripts/koha-zebra koha-stop-zebra
vagrant@kohadevbox:~$ ln -s kohaclone/debian/scripts/koha-zebra koha-restart-zebra
- Run:
$ sudo ./koha-start-zebra kohadev
=> SUCCESS: Same behaviour than the koha-start-zebra script
- Run:
sudo ./koha-stop-zebra kohadev
=> SUCCESS: Same behaviour than the koha-stop-zebra script
- Run:
sudo ./koha-restart-zebra kohadev
=> SUCCESS: Same behaviour than the koha-restart-zebra script
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
op=""
verbose="no"
+# Backwards compatible with old koha-*-zebra scripts
+# TODO: Remove once there's consensus to remove the legacy scripts
+used_script_name=$(basename $0)
+
+if [ "$used_script_name" != "koha-zebra" ]; then
+ warn "Deprecated script used (${used_script_name})"
+
+ case "$used_script_name" in
+ koha-start-zebra)
+ set_action "start" ;;
+ koha-stop-zebra)
+ set_action "stop" ;;
+ koha-restart-zebra)
+ set_action "restart" ;;
+ *)
+ break ;;
+ esac
+fi
+# / Backwards compatible handling code
+
# Read command line parameters
while [ $# -gt 0 ]; do