From f1847d55033af2bb5d9fbee6a3845534e0d329fc Mon Sep 17 00:00:00 2001 From: Juri Jensen Date: Thu, 13 Sep 2001 13:06:06 +0000 Subject: * Added printcap.xenuxlocal * Added some checks to cf.services.file to determine which services is running and define classes based on that. # Corrected a few errors. * Only lprng is supported in cf.services.file - cups is about to come. --- cfengine/cf.services.file | 126 ++++++++++++++++++++++++++++++---------------- 1 file changed, 83 insertions(+), 43 deletions(-) (limited to 'cfengine/cf.services.file') diff --git a/cfengine/cf.services.file b/cfengine/cf.services.file index ee3bdac..13b2583 100644 --- a/cfengine/cf.services.file +++ b/cfengine/cf.services.file @@ -1,5 +1,5 @@ control: - AddInstallable = ( samba_reload netatalk_reload lprng_reload cups_reload lprng cups ) + AddInstallable = ( samba samba_reload netatalk netatalk_reload lprng lprng_reload cups cups_reload ) # # Variables for shares @@ -19,11 +19,21 @@ control: printdir = ( /var/spool/samba ) # - # Variables for lprng + # Determine if this is a samba server, netatalk server or both, and define + # classes based on that. # + samba = ( '/usr/bin/test -x /usr/sbin/smbd' ) + netatalk = ( '/usr/bin/test -x /usr/sbin/afpd' ) + + # + # Determine which print system is in use, and define classes based on that. + # We only support lprng and cups + # + lprng = ( '/usr/bin/test -x /usr/sbin/lpd' ) + cups = ( '/usr/bin/test -x /usr/sbin/cupsd' ) editfiles: - any:: + samba:: # # Samba configuration stuff. # @@ -47,10 +57,22 @@ editfiles: # Append the include lines for the files decribed above # AppendIfNoSuchLine "include = smb-shares-COMMON.conf" - AppendIfNoSuchLine "include = smb-shares-local.conf" + AppendIfNoSuchLine "include = smb-shares-$(site).conf" AppendIfNoSuchLine "include = smb-printers.conf" ResetSearch "1" + # + # printing = lprng + # + LocateLineMatching "^[;[:blank:]]*æprinting[[:blank:]]*=.*" + BeginGroupIfNoLineMatching '^[[:blank:]]*printing[[:blank:]]*=[[:blank:]]*lprng[[:blank:]]*' + ReplaceLineWith ' printing = lprng' + EndGroup + CatchAbort + BeginGroupIfNoMatch '^[[:blank:]]*printing[[:blank:]]*=[[:blank:]]*lprng[[:blank:]]*' + InsertLine ' printing = lprng' + EndGroup + # # workgroup = $(site) # @@ -172,6 +194,21 @@ editfiles: EndGroup DefineClasses "samba_reload" } + lprng:: + { /etc/samba/smb.conf + # + # printing = lprng + # + LocateLineMatching "^[;[:blank:]]*æprinting[[:blank:]]*=.*" + BeginGroupIfNoLineMatching '^[[:blank:]]*printing[[:blank:]]*=[[:blank:]]*lprng[[:blank:]]*' + ReplaceLineWith ' printing = lprng' + EndGroup + CatchAbort + BeginGroupIfNoMatch '^[[:blank:]]*printing[[:blank:]]*=[[:blank:]]*lprng[[:blank:]]*' + InsertLine ' printing = lprng' + EndGroup + DefineClasses "samba_reload" + } samba_reload:: { /etc/samba/smb.conf LocateLineMatching "^; EDITED BY CFENGINE .*" @@ -181,7 +218,7 @@ editfiles: Append '; EDITED BY CFENGINE $(date)' EndGroup } - any:: + samba:: { /etc/samba/smb-shares-COMMON.conf # # This file contains all the shares common to all installations. @@ -258,45 +295,13 @@ editfiles: Append '; EDITED BY CFENGINE $(date)' EndGroup } - any:: - # - # Local shares special for the site - # - { /etc/samba/smb-shares-$(site).conf - # - # We don't make this file dynamically, but instead we copy the contents - # of a master file, but only if it's newer than the one installed. - # - BeginGroupIfFileIsNewer "/etc/local-$(host).$(domain)/samba/smb-shares-$(site).conf" - EmptyEntireFilePlease - InsertFile "/etc/local-$(host).$(domain)/samba/smb-shares-$(site).conf" - Append "# Edited by cfengine $(date)" - EndGroup - DefineClasses "lprng_reload" - } - any:: - # - # Printer configuration stuff - # - { /etc/printcap - # - # We don't make the printcap dynamically, but instead we copy the contents - # of a master file, but only if it's newer than the one installed. - # - BeginGroupIfFileIsNewer "/etc/local-$(host).$(domain)/printcap" - EmptyEntireFilePlease - InsertFile "/etc/local-$(host).$(domain)/printcap" - Append "# Edited by cfengine $(date)" - EndGroup - DefineClasses "lprng_reload" - } - any:: + samba:: { /etc/samba/smb-printers.conf # # This file contains all the printers defined in the Linux printing # system. There shouldn't be any need for setting up additional # printer entries. Manage the printers through the Linux print - # system. + # system you have installed - cups or lprng. # We check if the proper sections are there and add them if they # isn't. We don't check the file line for line. # @@ -324,12 +329,42 @@ editfiles: Append '; EDITED BY CFENGINE $(date)' EndGroup } + samba:: + # + # Local shares special for the site. + # In this file you can define special shares that you need + # + { /etc/samba/smb-shares-$(site).conf + # + # We don't make this file dynamically, but instead we copy the contents + # of a master file, but only if it's newer than the one installed. + # + BeginGroupIfFileIsNewer "/etc/local-$(host).$(domain)/samba/smb-shares-$(site).conf" + EmptyEntireFilePlease + InsertFile "/etc/local-$(host).$(domain)/samba/smb-shares-$(site).conf" + Append "# Edited by cfengine $(date)" + EndGroup + DefineClasses "lprng_reload" + } + lprng:: + # + # Printer configuration stuff + # + { /etc/printcap + # + # We don't make the printcap dynamically, but instead we copy the contents + # of a master file, but only if it's newer than the one installed. + # + BeginGroupIfFileIsNewer "/etc/local-COMMON/printcap.$(site)" + EmptyEntireFilePlease + InsertFile "/etc/local-COMMON/printcap.$(site)" + Append "# Edited by cfengine $(date)" + EndGroup + DefineClasses "lprng_reload" + } directories: - $(netlogshare) - mode=755 - owner=root - group=root + any:: $(commonsharedir) mode=755 owner=root @@ -342,6 +377,11 @@ directories: mode=775 owner=root group=users + samba:: + $(netlogshare) + mode=755 + owner=root + group=root $(profshare) mode=775 owner=root -- cgit v1.2.3