>From 5719d8c052b1768b6c9a007f03ab9d3ef49d2d4a Mon Sep 17 00:00:00 2001
From: Ade Lee <alee@redhat.com>
Date: Fri, 3 Jan 2014 03:35:52 -0500
Subject: [PATCH 1/2] Add init script and removed obsolete init scripts

---
 debian/pki-kra.pki-krad.init                       | 95 ----------------------
 debian/pki-ocsp.pki-ocspd.init                     | 95 ----------------------
 ...ca.pki-cad.init => pki-server.pki-tomcatd.init} | 22 ++---
 debian/pki-tks.pki-tksd.init                       | 95 ----------------------
 4 files changed, 11 insertions(+), 296 deletions(-)
 delete mode 100644 debian/pki-kra.pki-krad.init
 delete mode 100644 debian/pki-ocsp.pki-ocspd.init
 rename debian/{pki-ca.pki-cad.init => pki-server.pki-tomcatd.init} (81%)
 mode change 100644 => 100755
 delete mode 100644 debian/pki-tks.pki-tksd.init

diff --git a/debian/pki-kra.pki-krad.init b/debian/pki-kra.pki-krad.init
deleted file mode 100644
index 90d0b83d93c337581bef67e474dfb5c0cc0706ff..0000000000000000000000000000000000000000
--- a/debian/pki-kra.pki-krad.init
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/bash
-### BEGIN INIT INFO
-# Provides:          pki-krad
-# Required-Start:    $remote_fs $network $syslog
-# Required-Stop:     $remote_fs $network $syslog
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Start pki-krad at boot time
-# Description:
-### END INIT INFO
-#
-# --- BEGIN COPYRIGHT BLOCK ---
-# 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; version 2 of the License.
-#
-# 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, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Copyright (C) 2007-2010 Red Hat, Inc.
-# All rights reserved.
-# --- END COPYRIGHT BLOCK ---
-#
-# pki-krad   Startup script pki-kra with tomcat7
-#
-# chkconfig:    - 82 18
-# description:  Data Recovery Manager (Tomcat 7)
-# processname:  pki-krad
-# piddir:       /var/run/pki/kra
-#
-
-. /lib/lsb/init-functions
-
-PROG_NAME=`basename $0`
-SERVICE_NAME="pki-krad"
-SERVICE_PROG="/usr/sbin/service"
-PKI_PATH="/usr/share/pki/kra"
-PKI_REGISTRY="/etc/dogtag/pki/kra"
-PKI_TYPE="pki-kra"
-PKI_TOTAL_PORTS=6
-
-# Avoid using 'systemctl' for now
-SYSTEMCTL_SKIP_REDIRECT=1
-export SYSTEMCTL_SKIP_REDIRECT
-
-# Disallow 'others' the ability to 'write' to new files
-umask 00002
-
-command="$1"
-pki_instance="$2"
-
-# Source the PKI function library
-. /usr/share/pki/scripts/functions
-
-# See how we were called.
-case $command in
-    status)
-	registry_status
-	exit $?
-	;;
-    start)
-	start
-	exit $?
-	;;
-    restart)
-	restart
-	exit $?
-	;;
-    stop)
-	stop
-	exit $?
-	;;
-    condrestart|force-restart|try-restart|force-reload)
-        [ ! -f ${lockfile} ] || restart
-        exit $?
-        ;;
-    reload)
-        echo "The 'reload' action is an unimplemented feature."
-        exit ${default_error}
-        ;;
-    *)
-	echo "unknown action ($command)"
-        usage
-        echo "where valid instance names include:"
-        list_instances
-        exit ${default_error}
-        ;;
-esac
-
diff --git a/debian/pki-ocsp.pki-ocspd.init b/debian/pki-ocsp.pki-ocspd.init
deleted file mode 100644
index 4a768d28458ec5feb57931218e6174b4cab81096..0000000000000000000000000000000000000000
--- a/debian/pki-ocsp.pki-ocspd.init
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/bash
-### BEGIN INIT INFO
-# Provides:          pki-ocspd
-# Required-Start:    $remote_fs $network $syslog
-# Required-Stop:     $remote_fs $network $syslog
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Start pki-ocspd at boot time
-# Description:
-### END INIT INFO
-#
-# --- BEGIN COPYRIGHT BLOCK ---
-# 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; version 2 of the License.
-#
-# 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, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Copyright (C) 2007-2010 Red Hat, Inc.
-# All rights reserved.
-# --- END COPYRIGHT BLOCK ---
-#
-# pki-ocspd  Startup script for pki-ocsp with tomcat7
-#
-# chkconfig:    - 83 17
-# description:  Online Certificate Status Protocol Manager (Tomcat 7)
-# processname:  pki-ocspd
-# piddir:       /var/run/pki/ocsp
-#
-
-. /lib/lsb/init-functions
-
-PROG_NAME=`basename $0`
-SERVICE_NAME="pki-ocspd"
-SERVICE_PROG="/usr/sbin/service"
-PKI_PATH="/usr/share/pki/ocsp"
-PKI_REGISTRY="/etc/dogtag/pki/ocsp"
-PKI_TYPE="pki-ocsp"
-PKI_TOTAL_PORTS=6
-
-# Avoid using 'systemctl' for now
-SYSTEMCTL_SKIP_REDIRECT=1
-export SYSTEMCTL_SKIP_REDIRECT
-
-# Disallow 'others' the ability to 'write' to new files
-umask 00002
-
-command="$1"
-pki_instance="$2"
-
-# Source the PKI function library
-. /usr/share/pki/scripts/functions
-
-# See how we were called.
-case $command in
-    status)
-	registry_status
-	exit $?
-	;;
-    start)
-	start
-	exit $?
-	;;
-    restart)
-	restart
-	exit $?
-	;;
-    stop)
-	stop
-	exit $?
-	;;
-    condrestart|force-restart|try-restart|force-reload)
-        [ ! -f ${lockfile} ] || restart
-        exit $?
-        ;;
-    reload)
-        echo "The 'reload' action is an unimplemented feature."
-        exit ${default_error}
-        ;;
-    *)
-	echo "unknown action ($command)"
-        usage
-        echo "where valid instance names include:"
-        list_instances
-        exit ${default_error}
-        ;;
-esac
-
diff --git a/debian/pki-ca.pki-cad.init b/debian/pki-server.pki-tomcatd.init
old mode 100644
new mode 100755
similarity index 81%
rename from debian/pki-ca.pki-cad.init
rename to debian/pki-server.pki-tomcatd.init
index ced7e65f5cbe4deb9b75e49837d664e88dad5f12..4a1f5b67ad21cbe2aa38e1dc3a471a8204845083
--- a/debian/pki-ca.pki-cad.init
+++ b/debian/pki-server.pki-tomcatd.init
@@ -1,11 +1,11 @@
 #!/bin/bash
 ### BEGIN INIT INFO
-# Provides:          pki-cad
+# Provides:          pki-tomcatd
 # Required-Start:    $remote_fs $network $syslog
 # Required-Stop:     $remote_fs $network $syslog
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
-# Short-Description: Start pki-cad at boot time
+# Short-Description: Start pki-tomcatd at boot time
 # Description:
 ### END INIT INFO
 #
@@ -27,22 +27,22 @@
 # All rights reserved.
 # --- END COPYRIGHT BLOCK ---
 #
-# pki-cad    Startup script for pki-ca with tomcat7
+# pki-tomcatd    Startup script for pki-tomcat instances with tomcat7
 #
 # chkconfig:    - 81 19
-# description:  Certificate Authority (Tomcat 7)
-# processname:  pki-cad
-# piddir:       /var/run/pki/ca
+# description:  Dogtag Certificates Subsystems (Tomcat 7)
+# processname:  pki-tomcatd
+# piddir:       /var/run/pki/tomcat
 #
 
 . /lib/lsb/init-functions
 
 PROG_NAME=`basename $0`
-SERVICE_NAME="pki-cad"
+SERVICE_NAME="pki-tomcatd"
 SERVICE_PROG="/usr/sbin/service"
-PKI_PATH="/usr/share/pki/ca"
-PKI_REGISTRY="/etc/dogtag/pki/ca"
-PKI_TYPE="pki-ca"
+PKI_PATH="/usr/share/pki/server"
+PKI_REGISTRY="/etc/sysconfig/pki/tomcat"
+PKI_TYPE="tomcat"
 PKI_TOTAL_PORTS=7
 
 # Avoid using 'systemctl' for now
@@ -56,7 +56,7 @@ command="$1"
 pki_instance="$2"
 
 # Source the PKI function library
-. /usr/share/pki/scripts/functions
+. /usr/share/pki/scripts/operations
 
 # See how we were called.
 case $command in
diff --git a/debian/pki-tks.pki-tksd.init b/debian/pki-tks.pki-tksd.init
deleted file mode 100644
index 1192a7e46a4762184670021098fb8c5e3d89a133..0000000000000000000000000000000000000000
--- a/debian/pki-tks.pki-tksd.init
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/bash
-### BEGIN INIT INFO
-# Provides:          pki-tksd
-# Required-Start:    $remote_fs $network $syslog
-# Required-Stop:     $remote_fs $network $syslog
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Start pki-tksd at boot time
-# Description:
-### END INIT INFO
-#
-# --- BEGIN COPYRIGHT BLOCK ---
-# 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; version 2 of the License.
-#
-# 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, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Copyright (C) 2007-2010 Red Hat, Inc.
-# All rights reserved.
-# --- END COPYRIGHT BLOCK ---
-#
-# pki-tksd   Startup script for pki-tks with tomcat7
-#
-# chkconfig:    - 84 16
-# description:  Token Key Service (Tomcat 7)
-# processname:  pki-tksd
-# piddir:       /var/run/pki/tks
-#
-
-. /lib/lsb/init-functions
-
-PROG_NAME=`basename $0`
-SERVICE_NAME="pki-tksd"
-SERVICE_PROG="/usr/sbin/service"
-PKI_PATH="/usr/share/pki/tks"
-PKI_REGISTRY="/etc/dogtag/pki/tks"
-PKI_TYPE="pki-tks"
-PKI_TOTAL_PORTS=6
-
-# Avoid using 'systemctl' for now
-SYSTEMCTL_SKIP_REDIRECT=1
-export SYSTEMCTL_SKIP_REDIRECT
-
-# Disallow 'others' the ability to 'write' to new files
-umask 00002
-
-command="$1"
-pki_instance="$2"
-
-# Source the PKI function library
-. /usr/share/pki/scripts/functions
-
-# See how we were called.
-case $command in
-    status)
-	registry_status
-	exit $?
-	;;
-    start)
-	start
-	exit $?
-	;;
-    restart)
-	restart
-	exit $?
-	;;
-    stop)
-	stop
-	exit $?
-	;;
-    condrestart|force-restart|try-restart|force-reload)
-        [ ! -f ${lockfile} ] || restart
-        exit $?
-        ;;
-    reload)
-        echo "The 'reload' action is an unimplemented feature."
-        exit ${default_error}
-        ;;
-    *)
-	echo "unknown action ($command)"
-        usage
-        echo "where valid instance names include:"
-        list_instances
-        exit ${default_error}
-        ;;
-esac
-
-- 
1.8.4.3

