Bug 17468: Remove koha-*-zebra scripts and its traces
authorTomas Cohen Arazi <tomascohen@theke.io>
Sat, 17 Feb 2018 15:20:09 +0000 (12:20 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 26 Mar 2018 20:31:27 +0000 (17:31 -0300)
This patch removes traces from the (deprecated) koha-*-zebra scripts.

To test:
- Apply the patch
- Verify no traces of koha-*-zebra remain on the codebase (besides
  Release Notes and the koha-zebra script):
  $ cd kohaclone
  $ git grep koha-start-zebra
  $ git grep koha-stop-zebra
  $ git grep koha-restart-zebra
=> SUCCESS: No traces!
- Create the following symlinks:
  $ sudo ln -s /usr/sbin/koha-zebra  /usr/sbin/koha-start-zebra
  $ sudo ln -s /usr/sbin/koha-zebra  /usr/sbin/koha-stop-zebra
  $ sudo ln -s /usr/sbin/koha-zebra  /usr/sbin/koha-restart-zebra
- Try the koha-*-zebra commands:
  $ sudo koha-stop-zebra kohadev
  $ sudo koha-start-zebra kohadev
  $ sudo koha-restart-zebra kohadev
=> SUCCESS: They all work as expected!

- Sign off :-D!

Sponsored-by: Orex Digital

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

debian/docs/koha-common.xml
debian/docs/koha-rebuild-zebra.xml
debian/docs/koha-restart-zebra.xml [deleted file]
debian/docs/koha-start-zebra.xml [deleted file]
debian/docs/koha-stop-zebra.xml [deleted file]
debian/koha-common.bash-completion
debian/koha-common.install
debian/koha-common.links [new file with mode: 0644]
debian/scripts/koha-restart-zebra [deleted file]
debian/scripts/koha-start-zebra [deleted file]
debian/scripts/koha-stop-zebra [deleted file]

index f14f750..96a9cf4 100644 (file)
     <variablelist>
 
       <varlistentry>
-        <term><option>koha-start-zebra</option></term>
+        <term><option>koha-zebra</option></term>
         <listitem>
-          <para>Start Zebra for named Koha instances.</para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
-        <term><option>koha-restart-zebra</option></term>
-        <listitem>
-          <para>Restart Zebra for named Koha instances.</para>
+          <para>Manage the Zebra daemon for named Koha instances.</para>
         </listitem>
       </varlistentry>
 
       </varlistentry>
 
       <varlistentry>
-        <term><option>koha-stop-zebra</option></term>
-        <listitem>
-          <para>Stop Zebra for named Koha instances.</para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
         <term><option>koha-indexer</option></term>
         <listitem>
           <para>Manage the indexer daemon for named Koha instances.</para>
index 099c045..81e1364 100644 (file)
@@ -86,9 +86,7 @@
   
   <refsect1><title>See also</title>
   <simplelist type="inline">
-    <member><command>koha-restart-zebra(8)</command></member>
-    <member><command>koha-start-zebra(8)</command></member>
-    <member><command>koha-stop-zebra(8)</command></member>
+    <member><command>koha-zebra(8)</command></member>
   </simplelist>
   </refsect1>
   
diff --git a/debian/docs/koha-restart-zebra.xml b/debian/docs/koha-restart-zebra.xml
deleted file mode 100644 (file)
index 4b78902..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<article xmlns='http://docbook.org/ns/docbook'>
-<title>koha-restart-zebra</title>
-<info>
-<productname>Koha</productname> is the first free software library automation package.
-<author>
-  <orgname>The Koha Community</orgname>
-  <uri>http://koha-community.org/</uri>
-</author>
-</info>
-
-<refentry xml:id="koha-restart-zebra">
-
-  <refmeta>
-    <refentrytitle>koha-restart-zebra</refentrytitle>
-    <manvolnum>8</manvolnum>
-  </refmeta>
-
-  <refnamediv>
-    <refname>koha-restart-zebra</refname>
-    <refpurpose>Restart Zebra for named Koha instances.</refpurpose>
-    <refclass>UNIX/Linux</refclass>
-  </refnamediv>
-
-  <refsynopsisdiv>
-    <cmdsynopsis>
-      <command>koha-restart-zebra</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
-    </cmdsynopsis>
-  </refsynopsisdiv>
-
-  <refsect1><title>Description</title>
-  <para>Restart Zebra for named Koha instances.</para>
-  </refsect1>
-  
-  <refsect1><title>See also</title>
-  <simplelist type="inline">
-    <member><command>koha-rebuild-zebra(8)</command></member>
-    <member><command>koha-start-zebra(8)</command></member>
-    <member><command>koha-stop-zebra(8)</command></member>
-  </simplelist>
-  </refsect1>
-  
-</refentry>
-
-</article>
diff --git a/debian/docs/koha-start-zebra.xml b/debian/docs/koha-start-zebra.xml
deleted file mode 100644 (file)
index 2d52000..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<article xmlns='http://docbook.org/ns/docbook'>
-<title>koha-start-zebra</title>
-<info>
-<productname>Koha</productname> is the first free software library automation package.
-<author>
-  <orgname>The Koha Community</orgname>
-  <uri>http://koha-community.org/</uri>
-</author>
-</info>
-
-<refentry xml:id="koha-start-zebra">
-
-  <refmeta>
-    <refentrytitle>koha-start-zebra</refentrytitle>
-    <manvolnum>8</manvolnum>
-  </refmeta>
-
-  <refnamediv>
-    <refname>koha-start-zebra</refname>
-    <refpurpose>Start Zebra for named Koha instances.</refpurpose>
-    <refclass>UNIX/Linux</refclass>
-  </refnamediv>
-
-  <refsynopsisdiv>
-    <cmdsynopsis>
-      <command>koha-start-zebra</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
-    </cmdsynopsis>
-  </refsynopsisdiv>
-
-  <refsect1><title>Description</title>
-  <para>Start Zebra for named Koha instances.</para>
-  </refsect1>
-  
-  <refsect1><title>See also</title>
-  <simplelist type="inline">
-    <member><command>koha-rebuild-zebra(8)</command></member>
-    <member><command>koha-restart-zebra(8)</command></member>
-    <member><command>koha-stop-zebra(8)</command></member>
-  </simplelist>
-  </refsect1>
-  
-</refentry>
-
-</article>
diff --git a/debian/docs/koha-stop-zebra.xml b/debian/docs/koha-stop-zebra.xml
deleted file mode 100644 (file)
index ea35f89..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<article xmlns='http://docbook.org/ns/docbook'>
-<title>koha-stop-zebra</title>
-<info>
-<productname>Koha</productname> is the first free software library automation package.
-<author>
-  <orgname>The Koha Community</orgname>
-  <uri>http://koha-community.org/</uri>
-</author>
-</info>
-
-<refentry xml:id="koha-stop-zebra">
-
-  <refmeta>
-    <refentrytitle>koha-stop-zebra</refentrytitle>
-    <manvolnum>8</manvolnum>
-  </refmeta>
-
-  <refnamediv>
-    <refname>koha-stop-zebra</refname>
-    <refpurpose>Stop Zebra for named Koha instances.</refpurpose>
-    <refclass>UNIX/Linux</refclass>
-  </refnamediv>
-
-  <refsynopsisdiv>
-    <cmdsynopsis>
-      <command>koha-stop-zebra</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
-    </cmdsynopsis>
-  </refsynopsisdiv>
-
-  <refsect1><title>Description</title>
-  <para>Stop Zebra for named Koha instances.</para>
-  </refsect1>
-  
-  <refsect1><title>See also</title>
-  <simplelist type="inline">
-    <member><command>koha-rebuild-zebra(8)</command></member>
-    <member><command>koha-restart-zebra(8)</command></member>
-    <member><command>koha-start-zebra(8)</command></member>
-  </simplelist>
-  </refsect1>
-  
-</refentry>
-
-</article>
index cb2f3a4..276cba0 100644 (file)
@@ -130,11 +130,6 @@ complete -F _koha_disabled_instances koha-enable
 # koha-disable autocompletes with enabled instances
 complete -F _koha_enabled_instances koha-disable
 
-# koha-*-zebra autocomplete with enabled instances
-complete -F _koha_enabled_instances koha-start-zebra
-complete -F _koha_enabled_instances koha-restart-zebra
-complete -F _koha_enabled_instances koha-stop-zebra
-
 # koha-mysql autocompletes with a single instance name
 complete -F _koha_single_instance koha-mysql
 
index 259138d..f31bfde 100644 (file)
@@ -26,13 +26,10 @@ debian/scripts/koha-plack                   usr/sbin
 debian/scripts/koha-rebuild-zebra           usr/sbin
 debian/scripts/koha-remove                  usr/sbin
 debian/scripts/koha-reset-passwd            usr/sbin
-debian/scripts/koha-restart-zebra           usr/sbin
 debian/scripts/koha-restore                 usr/sbin
 debian/scripts/koha-run-backups             usr/sbin
 debian/scripts/koha-shell                   usr/sbin
 debian/scripts/koha-sitemap                 usr/sbin
-debian/scripts/koha-start-zebra             usr/sbin
-debian/scripts/koha-stop-zebra              usr/sbin
 debian/scripts/koha-translate               usr/sbin
 debian/scripts/koha-upgrade-schema          usr/sbin
 debian/scripts/koha-upgrade-to-3.4          usr/sbin
diff --git a/debian/koha-common.links b/debian/koha-common.links
new file mode 100644 (file)
index 0000000..ff81a8d
--- /dev/null
@@ -0,0 +1,3 @@
+usr/sbin/koha-zebra  usr/sbin/koha-start-zebra
+usr/sbin/koha-zebra  usr/sbin/koha-stop-zebra
+usr/sbin/koha-zebra  usr/sbin/koha-restart-zebra
\ No newline at end of file
diff --git a/debian/scripts/koha-restart-zebra b/debian/scripts/koha-restart-zebra
deleted file mode 100755 (executable)
index b978b5e..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/bin/sh
-#
-# koha-restart-zebra - Restart Zebra for named Koha instances
-# Copyright 2010  Catalyst IT, Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-set -e
-
-# 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
-fi
-
-restart_zebra_instance()
-{
-    local instancename=$1
-
-    if is_zebra_running $instancename; then
-        echo "Restarting Zebra server for $instancename"
-        daemon \
-            --name="$instancename-koha-zebra" \
-            --pidfiles="/var/run/koha/$instancename/" \
-            --errlog="/var/log/koha/$instancename/zebra-error.log" \
-            --stdout="/var/log/koha/$instancename/zebra.log" \
-            --output="/var/log/koha/$instancename/zebra-output.log" \
-            --verbose=1 \
-            --respawn \
-            --delay=30 \
-            --user="$instancename-koha.$instancename-koha" \
-            --restart \
-            -- \
-            zebrasrv \
-            -v none,fatal,warn \
-            -f "/etc/koha/sites/$instancename/koha-conf.xml" && \
-        return 0
-    else
-        return 1
-    fi
-}
-
-start_zebra_instance()
-{
-    local instancename=$1
-
-    if is_enabled $instancename; then
-        echo "Starting Zebra server for $instancename"
-        daemon \
-            --name="$instancename-koha-zebra" \
-            --pidfiles="/var/run/koha/$instancename/" \
-            --errlog="/var/log/koha/$instancename/zebra-error.log" \
-            --stdout="/var/log/koha/$instancename/zebra.log" \
-            --output="/var/log/koha/$instancename/zebra-output.log" \
-            --verbose=1 \
-            --respawn \
-            --delay=30 \
-            --user="$instancename-koha.$instancename-koha" \
-            -- \
-            zebrasrv \
-            -v none,fatal,warn \
-            -f "/etc/koha/sites/$instancename/koha-conf.xml" && \
-        return 0
-    else
-        return 1
-    fi
-}
-
-usage()
-{
-    local scriptname=$0
-    cat <<EOF
-Restart Zebra for Koha instances.
-
-Usage: $scriptname instancename1 instancename2...
-
-EOF
-}
-
-# Parse command line.
-#[ $# -ge 1 ] || ( usage ; die "Missing instance name..." )
-
-# Loop through the instance names
-for name in "$@"
-do
-    if is_instance $name ; then
-        if ! is_zebra_running $name; then
-            warn "Zebra does not appear to have been running for instance $name."
-
-            if ! start_zebra_instance $name ; then
-                warn "Something went wrong starting Zebra for $name."
-            fi
-        else
-            if ! restart_zebra_instance $name; then
-              warn "Something went wrong restarting Zebra for $name."
-            fi
-        fi
-    else
-        warn "Unknown instance $name."
-    fi
-done
-
-exit 0
diff --git a/debian/scripts/koha-start-zebra b/debian/scripts/koha-start-zebra
deleted file mode 100755 (executable)
index 513547e..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/sh
-#
-# koha-start-zebra - Start Zebra for named Koha instances
-# Copyright 2010  Catalyst IT, Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-set -e
-
-# 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
-fi
-
-start_zebra_instance()
-{
-    local instancename=$1
-
-    # get zebra log levels from koha-conf.xml
-    local loglevels=$(get_loglevels $instancename)
-
-    echo "Starting Zebra server for $instancename"
-    touch "/var/log/koha/$instancename/zebra-error.log" \
-        "/var/log/koha/$instancename/zebra-output.log"
-    chown "$instancename-koha:$instancename-koha" \
-        "/var/log/koha/$instancename/zebra-error.log" \
-        "/var/log/koha/$instancename/zebra-output.log"
-    daemon \
-        --name="$instancename-koha-zebra" \
-        --pidfiles="/var/run/koha/$instancename/" \
-        --errlog="/var/log/koha/$instancename/zebra-error.log" \
-        --output="/var/log/koha/$instancename/zebra-output.log" \
-        --verbose=1 \
-        --respawn \
-        --delay=30 \
-        --user="$instancename-koha.$instancename-koha" \
-        -- \
-        zebrasrv \
-        -v $loglevels \
-        -f "/etc/koha/sites/$instancename/koha-conf.xml" && \
-        return 0 || \
-        return 1
-}
-
-usage()
-{
-    local scriptname=$0
-    cat <<EOF
-Starts Zebra for Koha instances.
-
-Usage: $scriptname instancename1 instancename2...
-
-EOF
-}
-
-# Parse command line.
-#[ $# -ge 1 ] || ( usage ; die "Missing instance name..." )
-
-# Loop through the instance names
-for name in "$@"
-do
-    if is_instance $name ; then
-        if ! is_zebra_running $name; then
-            if ! start_zebra_instance $name; then
-                warn "Something went wrong starting Zebra for $name."
-            fi
-        else
-            warn "Zebra already running for instance $name."
-        fi
-    else
-        warn "Unknown instance $name."
-    fi
-done
-
-exit 0
diff --git a/debian/scripts/koha-stop-zebra b/debian/scripts/koha-stop-zebra
deleted file mode 100755 (executable)
index 3e8660b..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/sh
-#
-# koha-stop-zebra - Stop Zebra for named Koha instances
-# Copyright 2010  Catalyst IT, Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-set -e
-
-# 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
-fi
-
-stop_zebra_instance()
-{
-    local instancename=$1
-
-    local PIDFILE="/var/run/koha/${instancename}/${instancename}-koha-zebra.pid"
-    echo "Stopping Zebra server for $instancename"
-
-    if start-stop-daemon --pidfile ${PIDFILE} --stop --quiet --retry=TERM/30/KILL/5; then
-        return 0;
-    else
-        return 1;
-    fi
-
-}
-
-usage()
-{
-    local scriptname=$0
-    cat <<EOF
-Stops Zebra for Koha instances.
-
-Usage: $scriptname instancename1 instancename2...
-
-EOF
-}
-
-# Parse command line.
-#[ $# -ge 1 ] || ( usage ; die "Missing instance name..." )
-
-# Loop through the instance names
-for name in "$@"
-do
-    if is_instance $name ; then
-        if is_zebra_running $name; then
-            if ! stop_zebra_instance $name; then
-                warn "Something went wrong stopping Zebra for $name."
-            fi
-        else
-            warn "Zebra already stopped for instance $name."
-        fi
-    else
-        warn "Unknown instance $name."
-    fi
-done
-
-exit 0