You've already forked macports-user-ged
mirror of
https://github.com/macports/macports-user-ged.git
synced 2026-07-12 18:18:35 -07:00
Forking sysutils/cfengine for cfengine3
git-svn-id: https://svn.macports.org/repository/macports/users/ged@60599 d073be05-634f-4543-b044-5fe20cf6d1d6
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
# $Id$
|
||||
PortSystem 1.0
|
||||
|
||||
name cfengine
|
||||
version 2.2.1
|
||||
revision 1
|
||||
categories sysutils
|
||||
maintainers nomaintainer
|
||||
description a tool for setting up and maintaining computer systems
|
||||
long_description Cfengine, or the configuration engine is an \
|
||||
autonomous agent and a middle to high level \
|
||||
policy language for building expert systems \
|
||||
which administrate and configure large computer \
|
||||
networks.
|
||||
homepage http://www.cfengine.org/
|
||||
master_sites ftp://ftp.iu.hio.no/pub/cfengine/ \
|
||||
ftp://sunsite.uio.no/pub/cfengine/ \
|
||||
http://ftp.us.xemacs.org/ftp/pub/cfengine/cfengine-ftp/
|
||||
checksums sha1 ce4954174110c43541d25775747ae65ada30063d
|
||||
platforms darwin
|
||||
|
||||
depends_lib port:db44 \
|
||||
port:openssl \
|
||||
port:pcre
|
||||
|
||||
patchfiles patch-pub__getopt.c
|
||||
post-patch {
|
||||
foreach manfile [glob ${worksrcpath}/doc/*.8] {
|
||||
reinplace "s|/usr/local|${prefix}|g" $manfile
|
||||
reinplace "s|/var/cfengine|${prefix}&|g" $manfile
|
||||
}
|
||||
}
|
||||
|
||||
set cfworkdir ${prefix}/var/cfengine
|
||||
|
||||
configure.cflags -I${prefix}/include/db44 -I${prefix}/include
|
||||
configure.ldflags -L${prefix}/lib/db44 -L${prefix}/lib
|
||||
configure.args --mandir='\${prefix}/share/man' \
|
||||
--infodir='\${prefix}/share/info' \
|
||||
--with-workdir="${cfworkdir}" \
|
||||
--with-berkeleydb=default \
|
||||
--with-openssl=default \
|
||||
--with-pcre=default \
|
||||
--with-docs
|
||||
|
||||
build.args ps_DATA=
|
||||
destroot.args ps_DATA=
|
||||
|
||||
pre-destroot {
|
||||
if {$env(USER) != "root"} {
|
||||
ui_msg "-----------------------------------------------------------"
|
||||
ui_msg "Note that you are not running as root, so files installed"
|
||||
ui_msg "by this port will not end up with proper ownership and"
|
||||
ui_msg "likely not work correctly with ${name}."
|
||||
ui_msg "-----------------------------------------------------------"
|
||||
}
|
||||
}
|
||||
|
||||
destroot.keepdirs ${destroot}${cfworkdir}/bin \
|
||||
${destroot}${cfworkdir}/inputs \
|
||||
${destroot}${cfworkdir}/modules \
|
||||
${destroot}${cfworkdir}/outputs \
|
||||
${destroot}${cfworkdir}/ppkeys \
|
||||
${destroot}${cfworkdir}/rpc_in \
|
||||
${destroot}${cfworkdir}/rpc_out \
|
||||
${destroot}${cfworkdir}/state
|
||||
post-destroot {
|
||||
# Create cfengine directories
|
||||
xinstall -d -m 0755 ${destroot}${cfworkdir}
|
||||
# Create cfengine sub-directories
|
||||
foreach subdir {bin modules state} {
|
||||
xinstall -d -m 0755 ${destroot}${cfworkdir}/${subdir}
|
||||
}
|
||||
foreach subdir {inputs masterfiles/inputs outputs ppkeys rpc_in rpc_out} {
|
||||
xinstall -d -m 0700 ${destroot}${cfworkdir}/${subdir}
|
||||
}
|
||||
# Create distribution sample conf files
|
||||
set hostname [exec hostname]
|
||||
set host [lindex [split ${hostname} {.}] 0]
|
||||
set domain [join [lrange [split ${hostname} {.}] 1 end] {.}]
|
||||
set timezone [exec date +%Z]
|
||||
foreach conf {cfagent.conf cfservd.conf update.conf cfrun.hosts} {
|
||||
xinstall -m 0644 ${filespath}/${conf}.in \
|
||||
${destroot}${cfworkdir}/masterfiles/inputs/${conf}-dist
|
||||
reinplace "s|__PREFIX|${prefix}|g" \
|
||||
${destroot}${cfworkdir}/masterfiles/inputs/${conf}-dist
|
||||
reinplace "s|__CFWORKDIR|${cfworkdir}|g" \
|
||||
${destroot}${cfworkdir}/masterfiles/inputs/${conf}-dist
|
||||
reinplace "s|__HOST|${host}|g" \
|
||||
${destroot}${cfworkdir}/masterfiles/inputs/${conf}-dist
|
||||
reinplace "s|__DOMAIN|${domain}|g" \
|
||||
${destroot}${cfworkdir}/masterfiles/inputs/${conf}-dist
|
||||
reinplace "s|__TIMEZONE|${timezone}|g" \
|
||||
${destroot}${cfworkdir}/masterfiles/inputs/${conf}-dist
|
||||
}
|
||||
# Create startup rc script (if non-Darwin)
|
||||
if {![variant_isset darwin]} {
|
||||
xinstall -d -m 0755 ${destroot}${prefix}/etc/rc.d
|
||||
xinstall -m 0755 ${filespath}/${name}.sh.in \
|
||||
${destroot}${prefix}/etc/rc.d/${name}.sh
|
||||
reinplace "s|__PREFIX|${prefix}|" \
|
||||
${destroot}${prefix}/etc/rc.d/${name}.sh
|
||||
reinplace "s|__CFWORKDIR|${cfworkdir}|" \
|
||||
${destroot}${prefix}/etc/rc.d/${name}.sh
|
||||
}
|
||||
}
|
||||
|
||||
post-activate {
|
||||
# Make sure initial conf files are present and setup correctly
|
||||
if {![file exists ${cfworkdir}/inputs/update.conf]} {
|
||||
xinstall -m 0644 ${cfworkdir}/masterfiles/inputs/update.conf-dist \
|
||||
${cfworkdir}/inputs/update.conf
|
||||
}
|
||||
foreach conf {cfagent.conf cfservd.conf update.conf cfrun.hosts} {
|
||||
if {![file exists ${cfworkdir}/masterfiles/inputs/${conf}]} {
|
||||
xinstall -m 0644 ${cfworkdir}/masterfiles/inputs/${conf}-dist \
|
||||
${cfworkdir}/masterfiles/inputs/${conf}
|
||||
}
|
||||
}
|
||||
# Check for root public-private keys, create if missing
|
||||
if {![file exists ${cfworkdir}/ppkeys/localhost.priv] \
|
||||
|| ![file exists ${cfworkdir}/ppkeys/localhost.pub]} {
|
||||
if {[file exists ${cfworkdir}/ppkeys/localhost.priv]} {
|
||||
delete ${cfworkdir}/ppkeys/localhost.priv
|
||||
}
|
||||
if {[file exists ${cfworkdir}/ppkeys/localhost.pub]} {
|
||||
delete ${cfworkdir}/ppkeys/localhost.pub
|
||||
}
|
||||
system "${prefix}/sbin/cfkey"
|
||||
}
|
||||
}
|
||||
|
||||
variant psdocs {
|
||||
depends_build bin:tex:texlive \
|
||||
bin:texinfo:texinfo
|
||||
build.args-delete ps_DATA=
|
||||
destroot.args-delete ps_DATA=
|
||||
}
|
||||
|
||||
platform darwin {
|
||||
startupitem.create yes
|
||||
startupitem.name Cfengine
|
||||
startupitem.start "\[ -x ${cfworkdir}/bin/cfservd \] && ${cfworkdir}/bin/cfservd"
|
||||
startupitem.start-append "\[ -x ${cfworkdir}/bin/cfenvd \] && ${cfworkdir}/bin/cfenvd -H"
|
||||
startupitem.start-append "\[ -x ${cfworkdir}/bin/cfexecd \] && ${cfworkdir}/bin/cfexecd"
|
||||
startupitem.start-append "(\[ -x ${cfworkdir}/bin/cfservd \] && \[ -x ${cfworkdir}/bin/cfenvd \] && \\"
|
||||
startupitem.start-append " \[ -x ${cfworkdir}/bin/cfexecd \] && \[ -x ${cfworkdir}/bin/cfagent \]) \\"
|
||||
startupitem.start-append "\t|| ${prefix}/sbin/cfagent --no-splay -f update.conf"
|
||||
startupitem.stop "/usr/bin/killall -SIGUSR1 cfagent 2>/dev/null"
|
||||
startupitem.stop-append "/usr/bin/killall -SIGUSR1 cfexecd 2>/dev/null"
|
||||
startupitem.stop-append "/usr/bin/killall -SIGUSR1 cfenvd 2>/dev/null"
|
||||
startupitem.stop-append "/usr/bin/killall -SIGUSR1 cfservd 2>/dev/null"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
##################################################
|
||||
#
|
||||
# cfagent.conf
|
||||
#
|
||||
# This is a simple file for getting started with
|
||||
# cfengine. It is harmless. If you get cfengine
|
||||
# running with this file, you can build on it.
|
||||
#
|
||||
##################################################
|
||||
|
||||
###
|
||||
#
|
||||
# BEGIN cfagent.conf (Only hard classes in this file )
|
||||
#
|
||||
###
|
||||
|
||||
control:
|
||||
|
||||
Syslog = ( on ) # enable syslog logging
|
||||
|
||||
actionsequence = ( checktimezone files processes shellcommands )
|
||||
|
||||
domain = ( __DOMAIN )
|
||||
timezone = ( __TIMEZONE )
|
||||
|
||||
smtpserver = ( __HOST.__DOMAIN ) # used by cfexecd
|
||||
sysadm = ( root@__HOST.__DOMAIN ) # where to mail output
|
||||
|
||||
schedule = ( Min00_05 ) # run once an hour
|
||||
|
||||
######################################################################
|
||||
|
||||
files:
|
||||
|
||||
# Check some important files
|
||||
|
||||
/etc/passwd mode=644 owner=root action=warnall
|
||||
|
||||
# Do a tripwire check on binaries!
|
||||
|
||||
/usr/bin # Scan /usr/bin dir
|
||||
|
||||
owner=root,daemon # all files must be owned by root or daemon
|
||||
checksum=md5 # use md5 or sha
|
||||
recurse=inf # all subdirs
|
||||
action=warnall
|
||||
|
||||
#####################################################################
|
||||
|
||||
processes:
|
||||
|
||||
"cfservd" restart __CFWORKDIR/bin/cfservd
|
||||
|
||||
"cfenvd" restart "__CFWORKDIR/bin/cfenvd -H"
|
||||
|
||||
"cfexecd$" restart __CFWORKDIR/bin/cfexecd
|
||||
|
||||
######################################################################
|
||||
|
||||
shellcommands:
|
||||
|
||||
"/bin/echo 'Cfengine successfully executed.' && /bin/echo 'Replace me with something useful.'"
|
||||
|
||||
|
||||
###
|
||||
#
|
||||
# END cfagent.conf
|
||||
#
|
||||
###
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
CFWORKDIR=__CFWORKDIR
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ -x $CFWORKDIR/bin/cfservd ] && $CFWORKDIR/bin/cfservd
|
||||
[ -x $CFWORKDIR/bin/cfenvd ] && $CFWORKDIR/bin/cfenvd -H
|
||||
[ -x $CFWORKDIR/bin/cfexecd ] && $CFWORKDIR/bin/cfexecd
|
||||
([ -x $CFWORKDIR/bin/cfservd ] && [ -x $CFWORKDIR/bin/cfenvd ] && \
|
||||
[ -x $CFWORKDIR/bin/cfexecd ] && [ -x $CFWORKDIR/bin/cfagent ]) \
|
||||
|| __PREFIX/sbin/cfagent --no-splay -f update.conf
|
||||
;;
|
||||
stop)
|
||||
/usr/bin/killall -SIGUSR1 cfagent 2>/dev/null
|
||||
/usr/bin/killall -SIGUSR1 cfexecd 2>/dev/null
|
||||
/usr/bin/killall -SIGUSR1 cfenvd 2>/dev/null
|
||||
/usr/bin/killall -SIGUSR1 cfservd 2>/dev/null
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: `basename $0` {start|stop|restart}" >&2
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#######
|
||||
#
|
||||
# BEGIN cfrun.hosts
|
||||
#
|
||||
# This is the host list for cfrun.
|
||||
# Only these hosts will be contacted by remote connection.
|
||||
#
|
||||
#######
|
||||
|
||||
domain=__DOMAIN
|
||||
#access=userA,userB,userC # etc.
|
||||
access=root
|
||||
|
||||
__HOST
|
||||
# hostA
|
||||
# hostB
|
||||
# hostC
|
||||
# etc.
|
||||
|
||||
###
|
||||
#
|
||||
# END cfrun.hosts
|
||||
#
|
||||
###
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#########################################################
|
||||
#
|
||||
# This is a cfservd config file - it is used for the server
|
||||
# part of cfengine, for remote file transfers and control
|
||||
# over cfengine using the cfrun program.
|
||||
#
|
||||
#########################################################
|
||||
|
||||
control:
|
||||
|
||||
domain = ( __DOMAIN )
|
||||
|
||||
cfrunCommand = ( "__CFWORKDIR/bin/cfagent" )
|
||||
|
||||
any::
|
||||
|
||||
IfElapsed = ( 1 )
|
||||
ExpireAfter = ( 15 )
|
||||
MaxConnections = ( 50 )
|
||||
MultipleConnections = ( true )
|
||||
|
||||
#########################################################
|
||||
|
||||
grant:
|
||||
|
||||
# Grant access to all hosts at __DOMAIN.
|
||||
# Files should be world readable
|
||||
|
||||
__CFWORKDIR/masterfiles/inputs *.__DOMAIN
|
||||
|
||||
# Make sure there is permission to execute by cfrun
|
||||
|
||||
__CFWORKDIR/bin/cfagent *.__DOMAIN
|
||||
|
||||
########
|
||||
#
|
||||
# END cfservd.conf
|
||||
#
|
||||
########
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- pub/getopt.c 2005-02-08 11:48:47.000000000 +0000
|
||||
+++ pub/getopt.c.new 2007-06-13 11:57:57.000000000 +0000
|
||||
@@ -156,7 +156,7 @@
|
||||
/* Value of POSIXLY_CORRECT environment variable. */
|
||||
static char *posixly_correct;
|
||||
|
||||
-#ifdef __GNU_LIBRARY__
|
||||
+#if defined(__GNU_LIBRARY__) || defined(__APPLE__)
|
||||
/* We want to avoid inclusion of string.h with non-GNU libraries
|
||||
because there are many ways it can cause trouble.
|
||||
On some systems, it contains special magic macros that don't work
|
||||
@@ -0,0 +1,120 @@
|
||||
#######
|
||||
#
|
||||
# BEGIN update.conf
|
||||
#
|
||||
# This script distributes the configuration, a simple file so that,
|
||||
# if there are syntax errors in the main config, we can still
|
||||
# distribute a correct configuration to the machines afterwards, even
|
||||
# though the main config won't parse. It is read and run just before the
|
||||
# main configuration is parsed.
|
||||
#
|
||||
#######
|
||||
|
||||
control:
|
||||
|
||||
Syslog = ( on ) # enable syslog logging
|
||||
|
||||
actionsequence = ( copy processes tidy ) # Keep this simple and constant
|
||||
|
||||
domain = ( __DOMAIN ) # Needed for remote copy
|
||||
|
||||
#
|
||||
# Which host/dir is the master for configuration roll-outs?
|
||||
#
|
||||
|
||||
policyhost = ( __HOST.__DOMAIN )
|
||||
master_cfinput = ( __CFWORKDIR/masterfiles/inputs )
|
||||
|
||||
AddInstallable = ( new_cfenvd new_cfservd new_cfexecd )
|
||||
|
||||
#
|
||||
# Some convenient variables
|
||||
#
|
||||
|
||||
workdir = ( __CFWORKDIR )
|
||||
cf_install_dir = ( __PREFIX/sbin )
|
||||
|
||||
# Avoid server contention
|
||||
|
||||
SplayTime = ( 5 )
|
||||
|
||||
############################################################################
|
||||
|
||||
#
|
||||
# Make sure there is a local copy of the configuration and
|
||||
# the most important binaries in case we have no connectivity
|
||||
# e.g. for mobile stations or during DOS attacks
|
||||
#
|
||||
|
||||
copy:
|
||||
|
||||
$(master_cfinput) dest=$(workdir)/inputs
|
||||
r=inf
|
||||
mode=700
|
||||
type=binary
|
||||
exclude=*-dist
|
||||
exclude=*.lst
|
||||
exclude=*~
|
||||
exclude=#*
|
||||
server=$(policyhost)
|
||||
trustkey=true
|
||||
|
||||
$(cf_install_dir)/cfagent dest=$(workdir)/bin/cfagent
|
||||
mode=755
|
||||
backup=false
|
||||
type=checksum
|
||||
|
||||
$(cf_install_dir)/cfservd dest=$(workdir)/bin/cfservd
|
||||
mode=755
|
||||
backup=false
|
||||
type=checksum
|
||||
define=new_cfservd
|
||||
|
||||
$(cf_install_dir)/cfexecd dest=$(workdir)/bin/cfexecd
|
||||
mode=755
|
||||
backup=false
|
||||
type=checksum
|
||||
define=new_cfexecd
|
||||
|
||||
$(cf_install_dir)/cfenvd dest=$(workdir)/bin/cfenvd
|
||||
mode=755
|
||||
backup=false
|
||||
type=checksum
|
||||
define=new_cfenvd
|
||||
|
||||
#####################################################################
|
||||
|
||||
tidy:
|
||||
|
||||
#
|
||||
# Cfexecd stores output in this directory.
|
||||
# Make sure we don't build up files and choke on our own words!
|
||||
#
|
||||
|
||||
$(workdir)/outputs pattern=* age=7
|
||||
|
||||
#####################################################################
|
||||
|
||||
processes:
|
||||
|
||||
#
|
||||
# Make sure to restart cfenvd or cfservd when the binaries
|
||||
# are updated.
|
||||
#
|
||||
|
||||
new_cfservd::
|
||||
"cfservd" signal=term restart __CFWORKDIR/bin/cfservd
|
||||
|
||||
new_cfenvd::
|
||||
"cfenvd" signal=kill restart "__CFWORKDIR/bin/cfenvd -H"
|
||||
|
||||
new_cfexecd::
|
||||
"cfexecd$" signal=term restart __CFWORKDIR/bin/cfexecd
|
||||
|
||||
|
||||
#######
|
||||
#
|
||||
# END update.conf
|
||||
#
|
||||
#######
|
||||
|
||||
Reference in New Issue
Block a user