From 95d0617bf0ea77e4954657b67614ee83be39a376 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 9 May 2011 08:27:30 +0000 Subject: [PATCH 1/1] - new, based on fedora package Changed files: cf-execd -> 1.1 cf-monitord -> 1.1 cf-serverd -> 1.1 cfengine.spec -> 1.1 --- cf-execd | 74 +++++++++++++++++++++++++++ cf-monitord | 78 ++++++++++++++++++++++++++++ cf-serverd | 77 ++++++++++++++++++++++++++++ cfengine.spec | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 366 insertions(+) create mode 100644 cf-execd create mode 100644 cf-monitord create mode 100644 cf-serverd create mode 100644 cfengine.spec diff --git a/cf-execd b/cf-execd new file mode 100644 index 0000000..681f1ca --- /dev/null +++ b/cf-execd @@ -0,0 +1,74 @@ +#!/bin/bash +# +# cf-execd Start/Stop the cfengine client daemon. +# +# chkconfig: - 98 20 +# description: cf-execd is scheduler and reporter in cfengine client hosts. +# For more information, visit http://www.cfengine.org +# processname: cf-execd +# config: /var/cfengine/inputs + +# Source function library. +. /etc/init.d/functions + +exec="/usr/sbin/cf-execd" +prog=$(basename $exec) + +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +lockfile=/var/lock/subsys/$prog + +start() { + echo -n $"Starting $prog: " + daemon $exec + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $lockfile + return $RETVAL +} + +stop() { + echo -n $"Stopping $prog: " + killproc $prog + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f $lockfile + return $RETVAL +} + + +restart() { + stop + start +} + +reload() { + restart +} + +force_reload() { + restart +} + +fdrstatus() { + status $prog +} + +case "$1" in + start|stop|restart|reload) + $1 + ;; + force-reload) + force_reload + ;; + status) + fdrstatus + ;; + condrestart) + [ ! -f $lockfile ] || restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}" + exit 3 +esac +exit $? diff --git a/cf-monitord b/cf-monitord new file mode 100644 index 0000000..1d69921 --- /dev/null +++ b/cf-monitord @@ -0,0 +1,78 @@ +#!/bin/sh +# +# cf-monitord: Starts the GNU cfengine environment daemon +# +# chkconfig: - 15 85 +# description: This process maintains state information about the client +# machine's environment (network status, running processes, load, disk +# usage, etc.). This data is made available as classes that can be used +# in the agent configuration file to regulate activity based on the system's +# deviation from what has been measured over a long period of time +# (2 months or more) to be normal or average activity. +# +# processname: cf-monitord +# + +# Source function library. +. /etc/rc.d/init.d/functions + +exec="/usr/sbin/cf-monitord" +prog=$(basename $exec) + +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +lockfile=/var/lock/subsys/$prog + +start() { + echo -n $"Starting GNU cfengine environmental history daemon: " + daemon $prog + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $lockfile +} + +stop() { + echo -n $"Stopping GNU cfengine environmental history daemon: " + killproc $exec + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f $lockfile + return $RETVAL +} + +restart() { + stop + start +} + +reload() { + restart +} + +force_reload() { + restart +} + +fdrstatus() { + status $prog +} + +case "$1" in + start|stop|restart|reload) + $1 + ;; + force-reload) + force_reload + ;; + status) + fdrstatus + ;; + condrestart) + [ ! -f $lockfile ] || restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}" + exit 3 +esac +exit $? + diff --git a/cf-serverd b/cf-serverd new file mode 100644 index 0000000..5fa0ae4 --- /dev/null +++ b/cf-serverd @@ -0,0 +1,77 @@ +#!/bin/bash +# +# cf-serverd Start/Stop the cfengine server daemon. +# +# chkconfig: - 96 20 +# description: cf-serverd is responsible from giving out configuration files to +# those cfengine clients, who wish to update their configs. +# For more information, visit http://www.cfengine.org +# processname: cf-serverd +# config: /var/cfengine/masterfiles + +# Source function library. +. /etc/init.d/functions + +exec="/usr/sbin/cf-serverd" +prog=$(basename $exec) + +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +lockfile=/var/lock/subsys/$prog + +# See how we were called. + +start() { + [ ! -f /var/cfengine/ppkeys/localhost.priv ] && /usr/sbin/cfkey + echo -n $"Starting $prog: " + daemon $exec + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $lockfile + return $RETVAL +} + +stop() { + echo -n $"Stopping $prog: " + killproc $prog + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f $lockfile + return $RETVAL +} + +restart() { + stop + start +} + +reload() { + restart +} + +force_reload() { + restart +} + +fdrstatus() { + status $prog +} + +case "$1" in + start|stop|restart|reload) + $1 + ;; + force-reload) + force_reload + ;; + status) + fdrstatus + ;; + condrestart) + [ ! -f $lockfile ] || restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}" + exit 3 +esac +exit $? diff --git a/cfengine.spec b/cfengine.spec new file mode 100644 index 0000000..2bf91cb --- /dev/null +++ b/cfengine.spec @@ -0,0 +1,137 @@ +# TODO +# - precise texinfo deps +# - pldize initscript +# - FHS +Summary: A systems administration tool for networks +Name: cfengine +Version: 3.0.5p1 +Release: 0.1 +License: GPL v3 +Group: Applications/System +Source0: http://www.cfengine.org/tarballs/%{name}-%{version}.tar.gz +# Source0-md5: b74af23928253e11dcce3d98510f1066 +Source1: cf-execd +Source2: cf-serverd +Source3: cf-monitord +URL: http://www.cfengine.org/ +BuildRequires: acl-devel +BuildRequires: bison +BuildRequires: db-devel +BuildRequires: flex +BuildRequires: libselinux-devel +BuildRequires: m4 +BuildRequires: openssl-devel +BuildRequires: pcre-devel +BuildRequires: tetex-dvips +Requires(post,preun): /sbin/chkconfig +Requires: rc-scripts +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%description +Cfengine, or the configuration engine is an agent/software robot and a +very high level language for building expert systems to administrate +and configure large computer networks. Cfengine uses the idea of +classes and a primitive form of intelligence to define and automate +the configuration and maintenance of system state, for small to huge +configurations. Cfengine is designed to be a part of a computer immune +system. + +%package doc +Summary: Documentation for cfengine +Group: Documentation +Requires: %{name} = %{version}-%{release} + +%description doc +This package contains the documentation for cfengine. + +%prep +%setup -q + +%build +%configure \ + BERKELEY_DB_LIB=-ldb \ + --docdir=%{_docdir}/%{name}-%{version} \ + --enable-selinux +%{__make} + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT{%{_sbindir},%{_datadir}/%{name}} +%{__make} install \ + DESTDIR=$RPM_BUILD_ROOT + +# make directory tree for cfengine configs +install -d $RPM_BUILD_ROOT%{_var}/%{name} +for i in ppkeys inputs outputs; do + mkdir -m 0700 $RPM_BUILD_ROOT%{_var}/%{name}/$i +done + +# It's ugly, but thats the way Mark wants to have it. :( +# If we don't create this link, cfexecd will not be able to start +# (hardcoded) /var/sbin/cf-agent in scheduled intervals. Other option +# would be to patch cfengine to use %{_sbindir}/cf-agent +# but upstream won't support this +install -d $RPM_BUILD_ROOT%{_var}/%{name}/bin +ln -sf %{_sbindir}/cf-agent $RPM_BUILD_ROOT%{_var}/%{name}/bin +ln -sf %{_sbindir}/cf-promises $RPM_BUILD_ROOT%{_var}/%{name}/bin + +# init scripts +install -d $RPM_BUILD_ROOT/etc/rc.d/init.d +for i in %{SOURCE1} %{SOURCE2} %{SOURCE3}; do + install -p -m 0755 $i $RPM_BUILD_ROOT/etc/rc.d/init.d +done + +rm -f $RPM_BUILD_ROOT%{_infodir}/dir + +# All this stuff is pushed into doc/contrib directories +rm -rf $RPM_BUILD_ROOT%{_datadir}/%{name} +rm -f $RPM_BUILD_ROOT%{_sbindir}/cfdoc + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1 + +# cfagent won't run nicely, unless your host has keys. +if [ ! -d /mnt/sysimage -a ! -f %{_var}/%{name}/ppkeys/localhost.priv ]; then + %{_sbindir}/cf-key >/dev/null || : +fi + +# add init files to chkconfig +/sbin/chkconfig --add cf-monitord +/sbin/chkconfig --add cf-execd +/sbin/chkconfig --add cf-serverd +%service cf-monitord restart +%service cf-execd restart +%service cf-serverd restart + +%preun +if [ "$1" = "0" ]; then + %service cf-monitord stop + %service cf-execd stop + %service cf-serverd stop + /sbin/chkconfig --del cf-monitord + /sbin/chkconfig --del cf-execd + /sbin/chkconfig --del cf-serverd +fi + +%postun +[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1 + +%files +%defattr(644,root,root,755) +%doc AUTHORS ChangeLog README TODO +%attr(755,root,root) %{_sbindir}/* +%{_libdir}/libpromises* +%{_mandir}/man8/* +%attr(754,root,root) /etc/rc.d/init.d/cf-monitord +%attr(754,root,root) /etc/rc.d/init.d/cf-execd +%attr(754,root,root) /etc/rc.d/init.d/cf-serverd +%{_var}/%{name} + +%files doc +%defattr(644,root,root,755) +%doc inputs +%doc docs/*html +%doc docs/*pdf -- 2.43.0