[tac_plus] [PATCH 1/9] Avoid use of embedded here documents in .spec file
Philip Prindeville
philipp at redfish-solutions.com
Sat Dec 3 01:21:59 UTC 2016
From: Philip Prindeville <philipp at redfish-solutions.com>
Here documents bloat the .spec file and are counter to the whole
point of having SCM. Better to separate the files out.
---
tac_plus.sysvinit | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++
tacacs+.spec | 73 ++-----------------------------------------------------
2 files changed, 70 insertions(+), 71 deletions(-)
diff --git a/tac_plus.sysvinit b/tac_plus.sysvinit
new file mode 100644
index 0000000000000000000000000000000000000000..1e2e3f0d3399a878f24747e6aff439b95790fff7
--- /dev/null
+++ b/tac_plus.sysvinit
@@ -0,0 +1,68 @@
+#!/bin/bash
+#
+# /etc/rc.d/init.d/tac_plus
+#
+# chkconfig: 2345 86 14
+# description: TACACS+ Daemon
+
+# Define variables
+TACPLUS_PID=/var/run/tac_plus.pid
+TACPLUS_EXE=/usr/bin/tac_plus
+TACPLUS_ARG=""
+TACPLUS_CNF=/etc/tac_plus.conf
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+case "$1" in
+start)
+# Check to see if tac_plus is running.
+if [[ -f ${TACPLUS_PID} || -f /var/lock/subsys/tac_plus ]]; then
+ echo "tac_plus may already be running. Check for existing tac_plus processes."
+ exit 1
+fi
+echo -n "Starting tac_plus:"
+$TACPLUS_EXE $TACPLUS_ARG -C $TACPLUS_CNF && success || failure
+echo
+touch /var/lock/subsys/tac_plus
+;;
+stop)
+if [[ -f ${TACPLUS_PID} && -f /var/lock/subsys/tac_plus ]]; then
+ echo -n "Stopping tac_plus:"
+ killproc -p ${TACPLUS_PID}
+ echo
+ rm -f /var/lock/subsys/tac_plus
+ rm -f ${TACPLUS_PID}
+else
+ echo "tac_plus does not appear to be running."
+fi
+;;
+status)
+if [[ -f ${TACPLUS_PID} && -f /var/lock/subsys/tac_plus ]]; then
+ echo "tac_plus pid is `cat ${TACPLUS_PID}`"
+else
+ echo "tac_plus does not appear to be running."
+fi
+;;
+restart)
+$0 stop; $0 start
+;;
+reload)
+echo -n "Reloading tac_plus..."
+if [[ -f ${TACPLUS_PID} && -f /var/lock/subsys/tac_plus ]]; then
+ kill -HUP `cat ${TACPLUS_PID}`
+ RETVAL=$?
+fi
+if [ $RETVAL -ne 0 ]; then
+ failure
+else
+ success
+fi
+echo
+
+;;
+*)
+echo "Usage: $0 {start|stop|status|reload|restart}"
+exit 1
+;;
+esac
diff --git a/tacacs+.spec b/tacacs+.spec
index 7c08c23d67736a0617dbccd7a8ba00903504574f..505ed249982b3223da8bb21e0044a37bb2418b68 100644
--- a/tacacs+.spec
+++ b/tacacs+.spec
@@ -9,6 +9,7 @@ Packager: Bruce Carleton <bruce.carleton at jasperwireless.com>
Vendor: Cisco
Source: %{name}-%{version}.tar.gz
+Source2: tac_plus.sysvinit
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: gcc, bison, flex, m4, pam-devel
@@ -19,76 +20,6 @@ Requires: pam
%prep
%setup
-%{__cat} <<'EOF' >tac_plus.sysvinit
-#!/bin/bash
-#
-# /etc/rc.d/init.d/tac_plus
-#
-# chkconfig: 2345 86 14
-# description: TACACS+ Daemon
-
-# Define variables
-TACPLUS_PID=/var/run/tac_plus.pid
-TACPLUS_EXE=/usr/bin/tac_plus
-TACPLUS_ARG=""
-TACPLUS_CNF=/etc/tac_plus.conf
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-case "$1" in
-start)
-# Check to see if tac_plus is running.
-if [[ -f ${TACPLUS_PID} || -f /var/lock/subsys/tac_plus ]]; then
- echo "tac_plus may already be running. Check for existing tac_plus processes."
- exit 1
-fi
-echo -n "Starting tac_plus:"
-$TACPLUS_EXE $TACPLUS_ARG -C $TACPLUS_CNF && success || failure
-echo
-touch /var/lock/subsys/tac_plus
-;;
-stop)
-if [[ -f ${TACPLUS_PID} && -f /var/lock/subsys/tac_plus ]]; then
- echo -n "Stopping tac_plus:"
- killproc -p ${TACPLUS_PID}
- echo
- rm -f /var/lock/subsys/tac_plus
- rm -f ${TACPLUS_PID}
-else
- echo "tac_plus does not appear to be running."
-fi
-;;
-status)
-if [[ -f ${TACPLUS_PID} && -f /var/lock/subsys/tac_plus ]]; then
- echo "tac_plus pid is `cat ${TACPLUS_PID}`"
-else
- echo "tac_plus does not appear to be running."
-fi
-;;
-restart)
-$0 stop; $0 start
-;;
-reload)
-echo -n "Reloading tac_plus..."
-if [[ -f ${TACPLUS_PID} && -f /var/lock/subsys/tac_plus ]]; then
- kill -HUP `cat ${TACPLUS_PID}`
- RETVAL=$?
-fi
-if [ $RETVAL -ne 0 ]; then
- failure
-else
- success
-fi
-echo
-
-;;
-*)
-echo "Usage: $0 {start|stop|status|reload|restart}"
-exit 1
-;;
-esac
-EOF
%build
%configure --enable-acls --enable-uenable
@@ -97,7 +28,7 @@ EOF
%install
%{__rm} -rf %{buildroot}
%makeinstall
-%{__install} -Dp -m0755 tac_plus.sysvinit %{buildroot}%{_initrddir}/tac_plus
+%{__install} -Dp -m0755 %{SOURCE2} %{buildroot}%{_initrddir}/tac_plus
### Clean up buildroot
%{__rm} -f %{buildroot}%{_infodir}/dir
--
2.7.4
More information about the tac_plus
mailing list