summaryrefslogtreecommitdiff
path: root/cfengine/cf.services.file
diff options
context:
space:
mode:
authorJuri Jensen <juri@xenux.dk>2002-04-24 12:36:29 +0000
committerJuri Jensen <juri@xenux.dk>2002-04-24 12:36:29 +0000
commitad75a4c47206765ccf3c202d09c3955252172de2 (patch)
tree95fa970cb03ff8d6661c54adc89949736adc1b00 /cfengine/cf.services.file
parent1f4dbe523c2e50409abff8a447c6dae5e29b63ed (diff)
cfengine: Implemented m4 generation of samba shares. Finally got the
function to clear smb.conf for shares entries.
Diffstat (limited to 'cfengine/cf.services.file')
-rw-r--r--cfengine/cf.services.file65
1 files changed, 27 insertions, 38 deletions
diff --git a/cfengine/cf.services.file b/cfengine/cf.services.file
index 12d6142..20b094b 100644
--- a/cfengine/cf.services.file
+++ b/cfengine/cf.services.file
@@ -1,5 +1,5 @@
control:
- AddInstallable = ( samba samba_reload netatalk netatalk_reload lprng lprng_reload cups cups_reload )
+ AddInstallable = ( samba samba_reload samba_rebuild_shares netatalk netatalk_reload netatalk_rebuild_shares lprng lprng_reload cups cups_reload )
classes:
#
@@ -16,19 +16,6 @@ classes:
lprng = ( `/usr/bin/test -x /usr/sbin/lpd` )
cups = ( `/usr/bin/test -x /usr/sbin/cupsd` )
-import:
- samba::
- #
- # Import the shares definition for this site. This is a cfengine file!
- #
- /etc/local-COMMON/samba/smb-shares-$(site).conf
-
-# lprng|cups::
-# #
-# # Set up a printershare only if there's some printersoftware installed
-# #
-# /etc/local-COMMON/samba/smb-printers.conf
-
editfiles:
samba.lprng::
{ /etc/samba/smb.conf
@@ -44,24 +31,16 @@ editfiles:
#
# Global stuff
#
- # Remove share declarations from main smb.conf. It is split
- # up in the following files:
+ # Remove share and printer declarations from main smb.conf. The
+ # configuration is split up in the following files:
# - smb.conf
- # - smb-shares-$(site).conf
+ # - smb-shares.conf
+ # - smb-printers-[cups|lprng].conf
#
-# DeleteLinesAfterThisMatching "^\[homes\]$(n)*.*"
-# ResetSearch "1"
-# CatchAbort
-# ResetSearch "1"
-
- #
- # Append the include lines for the files decribed above
- #
- BeginGroupIfFileExists "/etc/local-COMMON/samba/smb-shares-$(site).conf"
- AppendIfNoSuchLine "include = /etc/samba/smb-shares-$(site).conf"
- EndGroup
+ LocateLineMatching "^\[homes\]"
+ DeleteNLines "100"
+ CatchAbort
ResetSearch "1"
-
#
# workgroup = $(site)
#
@@ -73,7 +52,6 @@ editfiles:
BeginGroupIfNoMatch '^[[:blank:]]*workgroup[[:blank:]]*=[[:blank:]]*$(site)[[:blank:]]*'
InsertLine ' workgroup = $(site)'
EndGroup
-
#
# wins support = yes
#
@@ -85,7 +63,6 @@ editfiles:
BeginGroupIfNoMatch "^[[:blank:]]*wins support[[:blank:]]*=[[:blank:]]*yes[[:blank:]]*"
InsertLine ' wins support = yes'
EndGroup
-
#
# os level = 65
#
@@ -97,7 +74,6 @@ editfiles:
BeginGroupIfNoMatch "^[[:blank:]]*os level[[:blank:]]*=[[:blank:]]*65[[:blank:]]*"
InsertLine ' os level = 65'
EndGroup
-
#
# domain master = yes
#
@@ -109,7 +85,6 @@ editfiles:
BeginGroupIfNoMatch "^[[:blank:]]*domain master[[:blank:]]*=[[:blank:]]*yes[[:blank:]]*"
InsertLine ' domain master = yes'
EndGroup
-
#
# local master = yes
#
@@ -121,7 +96,6 @@ editfiles:
BeginGroupIfNoMatch "^[[:blank:]]*local master[[:blank:]]*=[[:blank:]]*yes[[:blank:]]*"
InsertLine ' local master = yes'
EndGroup
-
#
# logon drive = Z:
#
@@ -133,7 +107,6 @@ editfiles:
BeginGroupIfNoMatch "^[[:blank:]]*logon drive[[:blank:]]*=[[:blank:]]*Z:[[:blank:]]*"
InsertLine ' logon drive = Z:'
EndGroup
-
#
# logon script = logon-$(site).bat
#
@@ -145,7 +118,6 @@ editfiles:
BeginGroupIfNoMatch "^[[:blank:]]*logon script[[:blank:]]*=[[:blank:]]*logon-$(site).bat[[:blank:]]*"
InsertLine ' logon script = logon-$(site).bat'
EndGroup
-
#
# domain logons = yes
#
@@ -157,7 +129,6 @@ editfiles:
BeginGroupIfNoMatch "^[[:blank:]]*domain logons[[:blank:]]*=[[:blank:]]*yes[[:blank:]]*"
InsertLine ' domain logons = yes'
EndGroup
-
#
# logon home = \\%N\USERPROFILES\%U
#
@@ -169,7 +140,6 @@ editfiles:
BeginGroupIfNoMatch "^[[:blank:]]*logon home[[:blank:]]*=[[:blank:]]*[\\][\\]%N[\\]USERPROFILES[\\]%U[[:blank:]]*"
InsertLine ' logon home = \\%N\USERPROFILES\%U'
EndGroup
-
#
# preferred master = yes
#
@@ -192,6 +162,10 @@ editfiles:
BeginGroupIfNoMatch "^[[:blank:]]*character set[[:blank:]]*=[[:blank:]]*ISO8859-1[[:blank:]]*"
InsertLine ' character set = ISO8859-1'
EndGroup
+ #
+ # Append the include lines for the shares definition file
+ #
+ AppendIfNoSuchLine "include = /etc/samba/smb-shares-$(site).conf"
DefineClasses "samba_reload"
}
@@ -208,10 +182,21 @@ editfiles:
EmptyEntireFilePlease
InsertFile "/etc/local-COMMON/samba/netlogon/logon-$(site).bat"
Append "rem Edited by cfengine $(date)"
+ FixEndOfLine "dos"
EndGroup
DefineClasses "samba_reload"
}
+ #
+ # Check if the shares definitions have changed
+ #
+ { /etc/samba/smb-shares.conf
+ BeginGroupIfFileIsNewer "/etc/local-COMMON/file-$(fqhost).m4"
+ AutoCreate
+ EndGroup
+ DefineClasses "samba_rebuild_shares:samba_reload"
+ }
+
lprng::
#
# Printer configuration stuff
@@ -243,6 +228,10 @@ processes:
"smbd" restart "/etc/init.d/samba restart"
"afpd" restart "/etc/init.d/netatalk restart"
+shellcommands.shares:
+ samba_rebuild_shares::
+ "m4 -DFQDN=$(fqhost) /etc/local-COMMON/samba/smb-shares.conf.m4 > /etc/samba/smb-shares.conf"
+
shellcommands:
samba_reload::
"/etc/init.d/samba force-reload"