Bug 22238: Remove koha-*-sip scripts in favor of koha-sip

This patch removes traces from the (deprecated) koha-*-sip scripts.

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

- Sign off :-D!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Tomás Cohen Arazi 2019-01-30 15:31:43 -03:00 committed by root
parent 5bb0424747
commit 3cfc8ae24c
11 changed files with 8 additions and 348 deletions

View file

@ -4,7 +4,7 @@
<productname>Koha</productname> is the first free software library automation package.
<author>
<orgname>The Koha Community</orgname>
<uri>http://koha-community.org/</uri>
<uri>https://koha-community.org/</uri>
</author>
</info>
@ -180,27 +180,6 @@
<para>Manage the SIP server for named Koha instances.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>koha-enable-sip</option></term>
<listitem>
<para>Copies the SIP configuration file to allow SIP to be controlled by init scripts.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>koha-start-sip</option></term>
<listitem>
<para>Starts the SIP daemon for the specified Koha instances.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>koha-stop-sip</option></term>
<listitem>
<para>Stops the SIP daemon for the specified Koha instances.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>

View file

@ -1,57 +0,0 @@
<article xmlns='http://docbook.org/ns/docbook'>
<title>koha-enable-sip</title>
<info>
<productname>Koha</productname> is the first free software library automation package.
<author>
<personname>
<firstname>Robin</firstname>
<surname>Sheat</surname>
</personname>
<affiliation>
<orgname>Catalyst IT</orgname>
<uri>http://www.catalyst.net.nz</uri>
</affiliation>
<contrib>Author</contrib>
</author>
</info>
<refentry xml:id="koha-enable-sip">
<refmeta>
<refentrytitle>koha-enable-sip</refentrytitle>
<manvolnum>8</manvolnum>
</refmeta>
<refnamediv>
<refname>koha-enable-sip</refname>
<refpurpose>Copies the SIP configuration file to allow SIP to be controlled by init scripts.</refpurpose>
<refclass>UNIX/Linux</refclass>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>koha-enable-sip</command>
<arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>This copies the default SIP configuration file /etc/koha/SIPconfig.xml to the
/etc/koha/sites/instancename directory. This allows it to be started by
<command>koha-start-sip(8)</command>, and <command>koha-stop-sip</command>. In turn,
this means that it will be started on boot and stopped on shutdown.</para>
<para>After running this, you will need to edit the newly created file to configure it
for your site.</para>
<para>To disable SIP again, delete or rename the configuration file.</para>
</refsect1>
<refsect1><title>See also</title>
<simplelist type="inline">
<member><command>koha-start-sip(8)</command></member>
<member><command>koha-stop-sip(8)</command></member>
</simplelist>
</refsect1>
</refentry>
</article>

View file

@ -1,53 +0,0 @@
<article xmlns='http://docbook.org/ns/docbook'>
<title>koha-start-sip</title>
<info>
<productname>Koha</productname> is the first free software library automation package.
<author>
<personname>
<firstname>Robin</firstname>
<surname>Sheat</surname>
</personname>
<affiliation>
<orgname>Catalyst IT</orgname>
<uri>http://www.catalyst.net.nz</uri>
</affiliation>
<contrib>Author</contrib>
</author>
</info>
<refentry xml:id="koha-start-sip">
<refmeta>
<refentrytitle>koha-start-sip</refentrytitle>
<manvolnum>8</manvolnum>
</refmeta>
<refnamediv>
<refname>koha-start-sip</refname>
<refpurpose>Starts the SIP daemon for the specified Koha instances.</refpurpose>
<refclass>UNIX/Linux</refclass>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>koha-start-sip</command>
<arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>This will start the SIP daemon for the Koha instance specified by <arg>instancename</arg>.</para>
<para>If the SIP configuration is not present for the supplied instance, it will be silently skipped.</para>
<para>To enable SIP support for an instance, refer to <command>koha-enable-sip(8)</command>.</para>
</refsect1>
<refsect1><title>See also</title>
<simplelist type="inline">
<member><command>koha-stop-sip(8)</command></member>
<member><command>koha-enable-sip(8)</command></member>
</simplelist>
</refsect1>
</refentry>
</article>

View file

@ -1,52 +0,0 @@
<article xmlns='http://docbook.org/ns/docbook'>
<title>koha-stop-sip</title>
<info>
<productname>Koha</productname> is the first free software library automation package.
<author>
<personname>
<firstname>Robin</firstname>
<surname>Sheat</surname>
</personname>
<affiliation>
<orgname>Catalyst IT</orgname>
<uri>http://www.catalyst.net.nz</uri>
</affiliation>
<contrib>Author</contrib>
</author>
</info>
<refentry xml:id="koha-stop-sip">
<refmeta>
<refentrytitle>koha-stop-sip</refentrytitle>
<manvolnum>8</manvolnum>
</refmeta>
<refnamediv>
<refname>koha-stop-sip</refname>
<refpurpose>Stops the SIP daemon for the specified Koha instances.</refpurpose>
<refclass>UNIX/Linux</refclass>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>koha-stop-sip</command>
<arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>This will stop the SIP daemon for the Koha instance specified by <arg>instancename</arg>.</para>
<para>If it's not running, an note will be displayed.</para>
</refsect1>
<refsect1><title>See also</title>
<simplelist type="inline">
<member><command>koha-start-sip(8)</command></member>
<member><command>koha-enable-sip(8)</command></member>
</simplelist>
</refsect1>
</refentry>
</article>

View file

@ -98,20 +98,12 @@ _koha_sip_enabled_instances()
return 0
}
# koha-*-sip autocomplete with sip-enabled instances
complete -F _koha_sip_enabled_instances koha-start-sip
complete -F _koha_sip_enabled_instances koha-restart-sip
complete -F _koha_sip_enabled_instances koha-stop-sip
_koha_sip_disabled()
{
_koha_list_cmd "--nosip"
return 0
}
# koha-enable-sip autocompletes with sip-disabled instances
complete -F _koha_sip_disabled koha-enable-sip
_koha_disabled_instances()
{
_koha_list_cmd "--disabled"

View file

@ -29,13 +29,10 @@ debian/scripts/koha-reset-passwd usr/sbin
debian/scripts/koha-restore usr/sbin
debian/scripts/koha-run-backups usr/sbin
debian/scripts/koha-shell usr/sbin
debian/scripts/koha-sip usr/sbin
debian/scripts/koha-sitemap usr/sbin
debian/scripts/koha-translate usr/sbin
debian/scripts/koha-upgrade-schema usr/sbin
debian/scripts/koha-upgrade-to-3.4 usr/sbin
debian/scripts/koha-zebra usr/sbin
debian/scripts/koha-start-sip usr/sbin
debian/scripts/koha-stop-sip usr/sbin
debian/scripts/koha-enable-sip usr/sbin
debian/scripts/koha-sip usr/sbin
debian/tmp_docbook/*.8 usr/share/man/man8

View file

@ -1,3 +1,6 @@
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
usr/sbin/koha-zebra usr/sbin/koha-restart-zebra
usr/sbin/koha-sip usr/sbin/koha-enable-sip
usr/sbin/koha-sip usr/sbin/koha-start-sip
usr/sbin/koha-sip usr/sbin/koha-stop-sip

View file

@ -1,38 +0,0 @@
#!/bin/sh
#
# koha-enable-sip -- Set up the config files to allow SIP to run
# Copyright 2012 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
for name in "$@"
do
if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ;
then
echo "No such instance: ${name}" > /dev/stderr
continue;
fi
sipfile=/etc/koha/sites/${name}/SIPconfig.xml
if [ -e ${sipfile} ]
then
echo "SIP already enabled for $name"
else
echo "Enabling SIP for $name - edit ${sipfile} to configure"
cp -v /etc/koha/SIPconfig.xml ${sipfile}
chown ${name}-koha:${name}-koha ${sipfile}
chmod 600 ${sipfile}
fi
done

View file

@ -229,6 +229,8 @@ if [ "$used_script_name" != "koha-sip" ]; then
set_action "start" ;;
koha-stop-sip)
set_action "stop" ;;
koha-enable-sip)
set_action "enable" ;;
*)
break ;;
esac

View file

@ -1,68 +0,0 @@
#!/bin/sh
#
# koha-start-sip -- Start SIP server for named Koha instance
# Copyright 2012 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
# Read configuration variable file if it is present
[ -r /etc/default/koha-common ] && . /etc/default/koha-common
# 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
for name in "$@"
do
if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ;
then
echo "No such instance: ${name}" > /dev/stderr
continue;
fi
[ -e /etc/koha/sites/${name}/SIPconfig.xml ] || continue
echo "Starting SIP server for $name"
mkdir -p /var/run/koha/${name}
chown "${name}-koha:${name}-koha" /var/run/koha/${name}
adjust_paths_dev_install $name
export KOHA_CONF PERL5LIB
KOHA_CONF=/etc/koha/sites/${name}/koha-conf.xml
# PERL5LIB has been read already
if [ "$DEV_INSTALL" = "" ]; then
LIBDIR=$KOHA_HOME/lib
else
LIBDIR=$KOHA_HOME
fi
daemon \
--name="$name-koha-sip" \
--errlog="/var/log/koha/$name/sip-error.log" \
--stdout="/var/log/koha/$name/sip.log" \
--output="/var/log/koha/$name/sip-output.log" \
--verbose=1 \
--respawn \
--delay=30 \
--pidfiles="/var/run/koha/${name}" \
--user="$name-koha.$name-koha" \
-- \
perl \
"$LIBDIR/C4/SIP/SIPServer.pm" \
"/etc/koha/sites/${name}/SIPconfig.xml"
done

View file

@ -1,45 +0,0 @@
#!/bin/sh
#
# koha-stop-sip -- Stop SIP server for named Koha instance
# Copyright 2012 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
for name in "$@"
do
if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ;
then
echo "No such instance: ${name}" > /dev/stderr
continue;
fi
if [ ! -e /var/run/koha/${name}/${name}-koha-sip.pid ] ;
then
echo "SIP server for ${name} not running."
continue;
fi
echo "Stopping SIP server for $name"
daemon \
--name="$name-koha-sip" \
--errlog="/var/log/koha/$name/sip-error.log" \
--stdout="/var/log/koha/$name/sip.log" \
--output="/var/log/koha/$name/sip-output.log" \
--verbose=1 \
--respawn \
--delay=30 \
--pidfiles="/var/run/koha/${name}" \
--user="$name-koha.$name-koha" \
--stop
done