#! /usr/bin/cfengine

control:
   OutputPrefix = ("cfengine")
   actionsequence = ( files directories editfiles )
   EditFileSize = ( 30000 )

files:
   any::

# floppy and cdroms are accessible for all
        ${target}/dev include=fd* mode=666   action=fixall r=1
        ${target}/dev include=sr* mode=444   action=fixall r=1

directories:

   BSDAMD::
        ${target}/scratch/. mode=755 owner=0 group=0

   FILES_SCRATCH::
        ${target}/files/scratch/. mode=1777 owner=0 group=0

   SCRATCH::
        ${target}/scratch mode=1777 owner=0 group=0

editfiles:
   any::

	{ ${target}/etc/init.d/sysklogd
	  ReplaceAll "^SYSLOGD=.*" With "SYSLOGD=${dblquote}-m 360${dblquote}"
	}

# add second root account using tcsh
# insert encrypted root password
	{ ${target}/etc/passwd
	  LocateLineMatching 	"^root:.*"
	  InsertLine 		"roott::0:0:root:/root:/usr/bin/tcsh"
	  ReplaceAll 		"^root::" With "root:${rootpw}:"
	  ReplaceAll		"^roott::" With "roott:${rootpw}:"
	}

	{ ${target}/etc/syslog.conf
	  ReplaceAll "daemon.*/var/log/daemon.log"
		With "daemon.warn${tab}${tab}${tab}-/var/log/daemon.log"
	  ReplaceAll "kern.*/var/log/kern.log"
		With "kern.warn${tab}${tab}${tab}-/var/log/kern.log"
	  AppendIfNoSuchLine "local6.debug${tab}${tab}${tab}/var/log/daemon.log"
	}

   DEMO::
	{ ${target}/etc/passwd
	  ReplaceAll 		"^demo:!:" With "demo:${rootpw}:"
	}

   HOME_CLIENT::
	{ ${target}/etc/fstab
	  HashCommentLinesContaining "/home "
	  AppendIfNoSuchLine "${hserver}:/home /home nfs rw,nosuid 0 0"
	}

   DATALESS::
	{ ${target}/etc/fstab
	  HashCommentLinesContaining "/usr "
	  AppendIfNoSuchLine "${bserver}:/usr /usr nfs ro,noatime,actimeo=900 0 0"
	}

   USR_LOCAL_MOUNT::
	{ ${target}/etc/fstab
	  HashCommentLinesContaining "/usr/local "
	  AppendIfNoSuchLine "${bserver}:/usr/local /usr/local nfs ro,noatime,actimeo=900 0 0"
	}

   SCRATCH::
	{ ${target}/etc/exports
	  AutoCreate
	  AppendIfNoSuchLine "/scratch${tab}${tab} @faiclients(async,rw,no_root_squash)"
	}

   FILES_SCRATCH.!NET_9::
	{ ${target}/etc/exports
	  AutoCreate
	  AppendIfNoSuchLine "/files/scratch${tab}${tab} @faiclients(async,rw,no_root_squash)"
	}

   HOME_SERVER::
	{ ${target}/etc/exports
	  AppendIfNoSuchLine "/usr${tab}${tab}@faiclients(async,ro,no_root_squash)"
	  AppendIfNoSuchLine "/home${tab}${tab}@sundomain(async,rw,no_root_squash) @faiclients(async,rw,no_root_squash)"
	}

   atom00::
	{ ${target}/etc/default/nis
	  ReplaceAll "NISSERVER=false" With "NISSERVER=true"
	}

   SERVER::
	{ ${target}/etc/ssh/sshd_config
	  ReplaceAll "X11Forwarding no" With "X11Forwarding yes"
	}

	{ ${target}/etc/shells
	  AppendIfNoSuchLine "/usr/local/bin/tcsh"
	}	  

   NOGETTY::
	{ ${target}/etc/inittab
	  HashCommentLinesContaining "respawn:/sbin/getty "
	}

# add scratch.map 
   BSDAMD::
        { ${target}/etc/am-utils/amd.conf
	  AppendIfNoSuchLine "[ /scratch ]"
	  AppendIfNoSuchLine "map_name = amd.scratch"
	}

	{ ${target}/etc/default/am-utils
	  ReplaceAll "AM_UTILS_MAP_NET='true'"
	        With "AM_UTILS_MAP_NET='false'"
	}

   BEOWULF::
	{ ${target}/etc/ld.so.conf
          AppendIfNoSuchLine "/usr/local/lib"
        }
