From c3b0e2a3cf995099af1ffedf4c1ef2369ce1df7e Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Fri, 7 Nov 2008 17:22:38 +0000 Subject: RPM packaging updates -- add rh specific init scripts and remove prereq footprint on rh (from Robin Bowes) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4967 ce84e21b-d406-0410-9b95-82705330c041 --- redhat/RELEASE | 2 +- redhat/bcfg2.spec.in | 17 +++++--- redhat/scripts/bcfg2-server.init | 71 ++++++++++++++++++++++++++++++ redhat/scripts/bcfg2.init | 94 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 176 insertions(+), 8 deletions(-) create mode 100755 redhat/scripts/bcfg2-server.init create mode 100755 redhat/scripts/bcfg2.init (limited to 'redhat') diff --git a/redhat/RELEASE b/redhat/RELEASE index 49d59571f..3b04cfb60 100644 --- a/redhat/RELEASE +++ b/redhat/RELEASE @@ -1 +1 @@ -0.1 +0.2 diff --git a/redhat/bcfg2.spec.in b/redhat/bcfg2.spec.in index a416ead19..e194bfb62 100644 --- a/redhat/bcfg2.spec.in +++ b/redhat/bcfg2.spec.in @@ -1,8 +1,8 @@ # This file is licensed under the GPL -Name: %{_package} -Version: %{_version} -Release: %{_release} +Name: @PACKAGE@ +Version: @VERSION@ +Release: @RELEASE@ %define __python python %{!?py_ver: %define py_ver %(python -c 'import sys;print(sys.version[0:3])')} @@ -33,6 +33,7 @@ BuildRequires: python-setuptools %endif Requires: %{lxmldep} >= 0.9 +Requires: initscripts Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig Requires(preun): /sbin/service @@ -69,10 +70,8 @@ deployment strategies. Summary: Configuration management server Group: System Environment/Daemons Requires: bcfg2 = %{version}-%{release} -Requires: /usr/sbin/sendmail Requires: /usr/bin/openssl Requires: gamin-python -Requires: redhat-lsb Requires: python-genshi Requires: python-cheetah Requires(post): /sbin/chkconfig @@ -122,8 +121,8 @@ mkdir -p %{buildroot}%{_var}/cache/bcfg2 mv %{buildroot}%{_bindir}/bcfg2* %{buildroot}%{_sbindir} -install -m 755 debian/buildsys/common/bcfg2.init %{buildroot}%{_initrddir}/bcfg2 -install -m 755 debian/buildsys/common/bcfg2-server.init %{buildroot}%{_initrddir}/bcfg2-server +install -m 755 redhat/scripts/bcfg2.init %{buildroot}%{_initrddir}/bcfg2 +install -m 755 redhat/scripts/bcfg2-server.init %{buildroot}%{_initrddir}/bcfg2-server install -m 755 debian/bcfg2.cron.daily %{buildroot}%{_sysconfdir}/cron.daily/bcfg2 install -m 755 debian/bcfg2.cron.hourly %{buildroot}%{_sysconfdir}/cron.hourly/bcfg2 install -m 755 tools/bcfg2-cron %{buildroot}%{_libexecdir}/bcfg2-cron @@ -226,6 +225,10 @@ fi %dir %{_var}/lib/bcfg2 %changelog +* Tue Oct 28 2008 Robin Bowes 0.9.6-0.2 +- spec file is now created dynamically so Version & Release + can be hard-coded so SRPM can be rebuilt without the Makefile + * Thu May 08 2008 Robin Bowes 0.9.6-0.1 - Revised spec file to build directly from svn checkout using Makefile - copied lots of stuff from the "official" spec file diff --git a/redhat/scripts/bcfg2-server.init b/redhat/scripts/bcfg2-server.init new file mode 100755 index 000000000..2a2f15dca --- /dev/null +++ b/redhat/scripts/bcfg2-server.init @@ -0,0 +1,71 @@ +#!/bin/sh +# +# bcfg2-server - bcfg2 configuration daemon +# +# chkconfig: 2345 19 81 +# description: bcfg2 is a configuration management system that builds \ +# and installs configuration files. \ +# This is the server that provides the configurations \ +# to clients. + +DAEMON=/usr/sbin/bcfg2-server +PIDFILE=/var/run/bcfg2-server.pid +PARAMS="-D $PIDFILE" +prog=$(basename $DAEMON) +conf="/etc/bcfg2.conf" + +PATH=/sbin:/bin:/usr/bin:/usr/sbin + +# Source function library +. /etc/init.d/functions + +# Include default startup configuration if exists +test -f /etc/sysconfig/$prog && . /etc/sysconfig/$prog + +RETVAL=0 + +start () { + test -x $DAEMON || exit 5 + test -f $conf || exit 6 + echo -n $"Starting $prog: " + daemon $DAEMON ${PARAMS} + RETVAL=$? + echo + if test $RETVAL = 0 ; then + test -d /var/lock/subsys && touch /var/lock/subsys/$prog + fi + return $RETVAL +} + +stop () { + echo -n $"Stopping $prog: " + killproc -p $PIDFILE ${BINARY} + RETVAL=$? + echo + rm -f /var/lock/subsys/$prog + return $RETVAL +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status $prog + RETVAL=$? + ;; + restart|reload|force-reload) + stop + sleep 5 + start + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" + RETVAL=3 + ;; +esac + +exit $RETVAL diff --git a/redhat/scripts/bcfg2.init b/redhat/scripts/bcfg2.init new file mode 100755 index 000000000..78d54a0f9 --- /dev/null +++ b/redhat/scripts/bcfg2.init @@ -0,0 +1,94 @@ +#!/bin/sh +# +# bcfg2 - bcfg2 configuration client +# +# chkconfig: 2345 19 81 +# description: bcfg2 is a configuration management system that builds \ +# and installs configuration files served by bcfg2-server. \ +# This is a client that installs the server-provided \ +# configuration. +# + +# Set default options +# You can set script specific options with BCFG2_OPTIONS_INIT +# You can set agent-mode specific options with BCFG2_OPTIONS_AGENT +DAEMON=/usr/sbin/bcfg2 +PIDFILE=/var/run/bcfg2-agent.pid +PARAMS="-q" +prog=$(basename $DAEMON) +AGENT_EXTRA_OPTS="-A -i ${PIDFILE}" + +# Disabled per default +BCFG2_ENABLED=0 +BCFG2_INIT=0 +BCFG2_AGENT=0 + +PATH=/sbin:/bin:/usr/bin:/usr/sbin + +# Source function library +. /etc/init.d/functions + +# Include default startup configuration if exists +test -f /etc/sysconfig/$prog && . /etc/sysconfig/$prog + +# bail out if bcfg2 not enabled +test $BCFG2_ENABLED = 0 && exit 0 + +RETVAL=0 + +start () { + test -x $DAEMON || exit 5 + echo -n $"Starting $prog: " + if test $BCFG2_AGENT = 1 ; then + daemon $DAEMON ${AGENT_EXTRA_OPTS} $PARAMS ${BCFG2_OPTIONS_AGENT} + RETVAL=$? + echo + if test $RETVAL = 0 ; then + test -d /var/lock/subsys && touch /var/lock/subsys/$prog + else + exit $RETVAL + fi + fi + + if test $BCFG2_INIT = 1 ; then + $DAEMON $PARAMS ${BCFG2_OPTIONS_INIT} + RETVAL=$? + echo + fi + + return $RETVAL +} + +stop () { + echo -n $"Stopping $prog: " + killproc -p $PIDFILE ${BINARY} + RETVAL=$? + echo + rm -f /var/lock/subsys/$prog + return $RETVAL +} + +case $"1" in + start) + start + ;; + stop) + stop + ;; + status) + status $prog + RETVAL=$? + ;; + restart|reload|force-reload) + if test $BCFG2_AGENT = 1 ; then + stop + sleep 5 + start + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|reload|force-reload|status}" + RETVAL=3 +esac + +exit $RETVAL -- cgit v1.2.3-1-g7c22