Fri, 07 Sep 2012 19:08:07 +0200
Correct build configuration in Solaris subdir, correct english grammar,
remove irrelevant strip notice, introduce custom CFLAG logic, facilitate
use of Solaris Studio compiler with needed build configuration
adjustments, conditionally build 64 bit position independent code,
and accommodate tun(7) in newer Solaris releases by renaming driver
and module from conflicting 'tun' to 'vtun'. These changes include
some nonstandard 'I give up' logic causing out of tree builds by
manipulating the PATH, for example.
1 #!@l_prefix@/bin/openpkg rc
2 ##
3 ## rc.cfengine -- Run-Commands
4 ##
6 %config
7 cfengine_enable="$openpkg_rc_def"
8 cfengine_cservd_flags=""
9 cfengine_cenvd_flags=""
10 cfengine_log_prolog="true"
11 cfengine_log_epilog="true"
12 cfengine_log_numfiles="10"
13 cfengine_log_minsize="1M"
14 cfengine_log_complevel="9"
16 %common
17 cfengine_cfservd_pidfile="@l_prefix@/var/cfengine/cfservd.pid"
18 cfengine_cfenvd_pidfile="@l_prefix@/var/cfengine/cfenvd.pid"
19 cfengine_signal () {
20 [ -f $cfengine_cfservd_pidfile ] \
21 && kill -$1 `cat $cfengine_cfservd_pidfile`
22 local rc=$?
23 [ -f $cfengine_cfenvd_pidfile ] \
24 && kill -$1 `cat $cfengine_cfenvd_pidfile` \
25 && [ $rc -eq 0 ]
26 }
28 %status -u @l_susr@ -o
29 cfengine_usable="unknown"
30 cfengine_active="no"
31 rcService cfengine enable yes && \
32 cfengine_signal 0 && cfengine_active="yes"
33 echo "cfengine_enable=\"$cfengine_enable\""
34 echo "cfengine_usable=\"$cfengine_usable\""
35 echo "cfengine_active=\"$cfengine_active\""
37 %start -u @l_susr@
38 rcService cfengine enable yes || exit 0
39 rcService cfengine active yes && exit 0
40 ( nohup @l_prefix@/sbin/cfservd \
41 --no-fork $cfengine_cfservd_flags \
42 </dev/null >/dev/null 2>&1 &
43 echo $! >$cfengine_cfservd_pidfile
44 ) >/dev/null 2>&1
45 ( nohup @l_prefix@/sbin/cfenvd \
46 --no-fork $cfengine_cfenvd_flags \
47 </dev/null >/dev/null 2>&1 &
48 echo $! >$cfengine_cfenvd_pidfile
49 ) >/dev/null 2>&1
51 %stop -u @l_susr@
52 rcService cfengine enable yes || exit 0
53 rcService cfengine active no && exit 0
54 cfengine_signal TERM
55 sleep 2
56 rm -f $cfengine_cfservd_pidfile 2>/dev/null || true
57 rm -f $cfengine_cfenvd_pidfile 2>/dev/null || true
59 %restart -u @l_susr@
60 rcService cfengine enable yes || exit 0
61 rcService cfengine active no && exit 0
62 rc cfengine stop start
64 %daily -u @l_susr@
65 rcService cfengine enable yes || exit 0
66 shtool rotate -f \
67 -n ${cfengine_log_numfiles} -s ${cfengine_log_minsize} -d \
68 -z ${cfengine_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \
69 -P "${cfengine_log_prolog}" \
70 -E "${cfengine_log_epilog}" \
71 @l_prefix@/var/cfengine/cfengine.log