head	1.9;
access;
symbols
	OPENPKG_E1_MP_HEAD:1.9
	OPENPKG_E1_MP:1.9
	OPENPKG_E1_MP_2_STABLE:1.8.8.1
	OPENPKG_E1_FP:1.8.8.1
	OPENPKG_2_STABLE_MP:1.9
	OPENPKG_2_STABLE_20061018:1.8.8.1
	OPENPKG_2_STABLE_20060622:1.8
	OPENPKG_2_STABLE:1.8.0.8
	OPENPKG_2_STABLE_BP:1.8
	OPENPKG_2_5_RELEASE:1.8
	OPENPKG_2_5_SOLID:1.8.0.6
	OPENPKG_2_5_SOLID_BP:1.8
	OPENPKG_2_4_RELEASE:1.8
	OPENPKG_2_4_SOLID:1.8.0.4
	OPENPKG_2_4_SOLID_BP:1.8
	OPENPKG_CW_FP:1.8
	OPENPKG_2_3_RELEASE:1.8
	OPENPKG_2_3_SOLID:1.8.0.2
	OPENPKG_2_3_SOLID_BP:1.8
	OPENPKG_2_2_RELEASE:1.7
	OPENPKG_2_2_SOLID:1.7.0.4
	OPENPKG_2_2_SOLID_BP:1.7
	OPENPKG_2_1_RELEASE:1.7
	OPENPKG_2_1_SOLID:1.7.0.2
	OPENPKG_2_1_SOLID_BP:1.7
	OPENPKG_2_0_RELEASE:1.5
	OPENPKG_2_0_SOLID:1.5.0.4
	OPENPKG_2_0_SOLID_BP:1.5
	OPENPKG_1_3_RELEASE:1.5.2.1
	OPENPKG_1_3_SOLID:1.5.2.1.0.2
	OPENPKG_1_3_SOLID_BP:1.5.2.1
	OPENPKG_1_STABLE:1.5.0.2
	OPENPKG_1_STABLE_MP:1.5;
locks; strict;
comment	@# @;


1.9
date	2006.08.25.19.16.04;	author rse;	state Exp;
branches;
next	1.8;
commitid	Tvsj1UyQ8rQ89gKr;

1.8
date	2005.01.07.08.41.51;	author rse;	state Exp;
branches
	1.8.8.1;
next	1.7;

1.7
date	2004.04.27.17.52.55;	author rse;	state Exp;
branches;
next	1.6;

1.6
date	2004.04.27.08.29.22;	author rse;	state Exp;
branches;
next	1.5;

1.5
date	2003.07.21.08.12.28;	author thl;	state Exp;
branches
	1.5.2.1;
next	1.4;

1.4
date	2003.07.19.17.05.47;	author rse;	state Exp;
branches;
next	1.3;

1.3
date	2003.07.17.21.34.34;	author thl;	state Exp;
branches;
next	1.2;

1.2
date	2003.07.10.07.50.18;	author rse;	state Exp;
branches;
next	1.1;

1.1
date	2003.07.08.12.00.48;	author thl;	state Exp;
branches;
next	;

1.8.8.1
date	2006.10.16.14.48.55;	author rse;	state Exp;
branches;
next	;
commitid	iZxwRSmmWscPXUQr;

1.5.2.1
date	2003.07.24.20.49.15;	author rse;	state Exp;
branches;
next	;


desc
@@


1.9
log
@replace '@@l_prefix@@/lib/openpkg/bash @@l_prefix@@/etc/rc' in shebang with '@@l_prefix@@/bin/openpkg rc' to allow people who run the rc.xxx scripts directly (as executables) to leverage from the Set-UID functionality
@
text
@#!@@l_prefix@@/bin/openpkg rc
##
##  rc.cfengine -- Run-Commands
##

%config
    cfengine_enable="$openpkg_rc_def"
    cfengine_cservd_flags=""
    cfengine_cenvd_flags=""
    cfengine_log_prolog="true"
    cfengine_log_epilog="true"
    cfengine_log_numfiles="10"
    cfengine_log_minsize="1M"
    cfengine_log_complevel="9"

%common
    cfengine_cfservd_pidfile="@@l_prefix@@/var/cfengine/cfservd.pid"
    cfengine_cfenvd_pidfile="@@l_prefix@@/var/cfengine/cfenvd.pid"
    cfengine_signal () {
        [ -f $cfengine_cfservd_pidfile ] \
            && kill -$1 `cat $cfengine_cfservd_pidfile`
        local rc=$?
        [ -f $cfengine_cfenvd_pidfile ] \
            && kill -$1 `cat $cfengine_cfenvd_pidfile` \
            && [ $rc -eq 0 ]
    }

%status -u @@l_susr@@ -o
    cfengine_usable="unknown"
    cfengine_active="no"
    rcService cfengine enable yes && \
        cfengine_signal 0 && cfengine_active="yes"
    echo "cfengine_enable=\"$cfengine_enable\""
    echo "cfengine_usable=\"$cfengine_usable\""
    echo "cfengine_active=\"$cfengine_active\""

%start -u @@l_susr@@
    rcService cfengine enable yes || exit 0
    rcService cfengine active yes && exit 0
    ( nohup @@l_prefix@@/sbin/cfservd \
          --no-fork $cfengine_cfservd_flags \
          </dev/null >/dev/null 2>&1 &
      echo $! >$cfengine_cfservd_pidfile
    ) >/dev/null 2>&1
    ( nohup @@l_prefix@@/sbin/cfenvd \
          --no-fork $cfengine_cfenvd_flags \
          </dev/null >/dev/null 2>&1 &
      echo $! >$cfengine_cfenvd_pidfile
    ) >/dev/null 2>&1

%stop -u @@l_susr@@
    rcService cfengine enable yes || exit 0
    rcService cfengine active no  && exit 0
    cfengine_signal TERM
    sleep 2
    rm -f $cfengine_cfservd_pidfile 2>/dev/null || true
    rm -f $cfengine_cfenvd_pidfile  2>/dev/null || true

%restart -u @@l_susr@@
    rcService cfengine enable yes || exit 0
    rcService cfengine active no  && exit 0
    rc cfengine stop start

%daily -u @@l_susr@@
    rcService cfengine enable yes || exit 0
    shtool rotate -f \
        -n ${cfengine_log_numfiles} -s ${cfengine_log_minsize} -d \
        -z ${cfengine_log_complevel} -o @@l_rusr@@ -g @@l_rgrp@@ -m 644 \
        -P "${cfengine_log_prolog}" \
        -E "${cfengine_log_epilog}" \
        @@l_prefix@@/var/cfengine/cfengine.log

@


1.8
log
@upgrading package: cfengine 2.1.11 -> 2.1.12
@
text
@d1 1
a1 1
#!@@l_prefix@@/lib/openpkg/bash @@l_prefix@@/etc/rc
@


1.8.8.1
log
@Mass merge from CURRENT to 2-STABLE (all packages except those of JUNK class)
@
text
@d1 1
a1 1
#!@@l_prefix@@/bin/openpkg rc
@


1.7
log
@this variable cannot be expanded within quotes in Bash
@
text
@d22 1
a22 1
            local rc=$?
@


1.6
log
@more run-command support and a %post section for generating the public/private key pair
@
text
@d43 1
a43 1
      echo "$!" >$cfengine_cfservd_pidfile
d48 1
a48 1
      echo "$!" >$cfengine_cfenvd_pidfile
@


1.5
log
@PR#210: shtool options space before argument
@
text
@d8 2
d16 48
a65 2

    #   rotate logfile
@


1.5.2.1
log
@mass Merge-From-CURRENT (MFC) in preparation for OpenPKG 1.3 [class PLUS only]
@
text
@@


1.4
log
@replace opXXXX with rcXXXX (PR#207)
@
text
@d19 2
a20 2
        -n${cfengine_log_numfiles} -s${cfengine_log_minsize} -d \
        -z${cfengine_log_complevel} -o@@l_rusr@@ -g@@l_rgrp@@ -m644 \
@


1.3
log
@migrate opServiceEnabled to opService ... enable yes; use new bootstrap feature and apply opService short circuit to %env
@
text
@d15 1
a15 1
    opService cfengine enable yes || exit 0
@


1.2
log
@use new openpkg_rc_def variable in run-command scripts for allowing the admin to change the global default for xxx_enable
@
text
@d15 1
a15 1
    opServiceEnabled cfengine || exit 0
@


1.1
log
@add fsl support
@
text
@d7 1
a7 1
    cfengine_enable="yes"
@

