- ifelse(`
- /etc/samba/smb-shares.m4
- Copyright 2002 Jonas Smedegaard <dr@jones.dk>
- $Id: smb-shares.conf.m4,v 1.20 2002-10-28 15:23:23 klaus Exp $
- m4 share definitions for generating Samba server smb.conf include file
- Usage: m4 -DFQDN=<FQDN> /etc/local-COMMON/samba/smb-shares.conf.m4 > /etc/samba/smb-shares.conf
- Depend on file /etc/local-COMMON/file-<FQDN>.m4 containing lines of
- the following syntax:
- _dir(<path>,<uid>,<gid>,<modes>)dnl
- _homefiles(<os>,<mount>,<desc>,<path>[,ro])dnl
- _files(<os>,<mount>,<desc>,<path>,<uid>,<gid>,<modes>[,ro[,<group>]|,rw,<group>[,<othergroup>]])dnl
- where
- <os>: Client operating systems (mac|win|any)
- <mount>: Mount point name
- Some mount points are handled specially:
- "netlogon" has browsing and share modes disabled
- "userprofiles" sets "force user" and pre-creates user subdirectory mode 700
- "reference" allows guests
- "homes" has read/write access and pre-creates directory mode 750
- Samba: Use single word and max. 8 characters for WfW compatibility
- <desc>: Mount point description. Full(?) support for iso8859-1.
- <path>: Full path to mount point directory
- <uid>: user name of owner of mount point directory
- <gid>: group name of owner of mount point directory
- <modes>: Numeric access modes of mount point directory
- ro|rw|rop|rwp: Read-only or read/write access to mount point, and wether it should be private (not publically announced).
- Read-only access if undefined.
- _homefiles are always private.
- _homefiles are by default read-only, except "homes" (see above).
- <group>: Primary group with access to mountpoint.
- If mount point has access "rw" then primary group has read/write access as well.
- <othergroup>: Secondary group with readonly access
- Example:
- _dir(/home/fsadmin/COMMON,fsadmin,fsadmin,755)dnl
- _files(win,netlogon,Network logon,/etc/samba/netlogon,root,root,755,ro)
- _files(win,userprofiles,User profiles,/home/fsadmin/shares_win/userprofiles,root,root,755)
- _files(win,reference,DEBIAN: Samba Linux server,/home/fsadmin/shares_win/reference)
- _homefiles(win,homes,Personal files,%H/pc))
- _homefiles(mac,,Personal files,~/mac))
- _files(win,soft,softshare,/home/fsadmin/shares_win/software,fsadmin,fsadmin,775)dnl
- _printer(win,LW,Networkprinter queue for Apple LaserWriter 16/600,/tmp,lw)
- TODO:
- Support for netatalk is not yet implemented.
- <othergroup> is not yet implemented.
- Get rid of <os>: <othergroup> is now 10nth parameter which is only available in GNU m4.
- All _homefiles (including "homes") should probably have similar access default (read-only, private).
- BROKEN: Homefiles are *not* private currently :-(
- ')dnl
- changequote(<, >)dnl
- define(<_veto_mac>, </.AppleDouble/.AppleDesktop/Network Trash Folder/DesktopFolderDB/resource.frk/Icon^M/TheVolumeSettingsFolder/>)dnl
- define(<_warn>,
- < // WARNING: $1
- >)dnl
- define(<_masks>,
- < create mask = $1
- directory mask = $2
- >)dnl
- define(<_pre_mkdir>,
- < root preexec = /bin/bash -c ' \
- /bin/mkdir -p $1 && \
- /bin/chown $2 $1 && \
- /bin/chmod $3 $1 '
- >)dnl
- define(<_dir>, <>)dnl
- define(<_files>,
- <ifelse($1,win,
- undefine(<_mkdir>)dnl
- undefine(<_group_read>)dnl
- undefine(<_world_read>)dnl
- undefine(<_user_write>)dnl
- undefine(<_group_write>)dnl
- undefine(<_private>)dnl
- [$2]
- path = $4
- ifelse($3,,,
- < comment = $3
- >)ifelse($2,<netlogon>,
- < share modes = no
- define(<_private>)dnl
- >,
- $2,<userprofiles>,
- < force user = %u
- define(<_user_write>)dnl
- define(<_mkdir>, <$4/%U>)dnl
- define(<_chown>, <%U>)dnl
- define(<_chmod>, <700>)dnl
- >,
- $2,<reference>,
- < guest ok = yes
- >,
- $2,<homes>,
- <dnl
- define(<_mkdir>, <$4>)dnl
- define(<_chown>, <%S>)dnl
- define(<_chmod>, <750>)dnl
- define(<_user_write>)dnl
- define(<_group_read>)dnl
- define(<_private>)dnl
- >,
- <>)dnl
- ifdef(<_mkdir>,
- _pre_mkdir(<_mkdir>, <_chown>, <_chmod>)dnl
- )dnl
- ifdef($8,
- ifelse($8,ro,
- <dnl
- define(<_group_read>)dnl
- >,
- $8,rop,
- <dnl
- define(<_group_read>)dnl
- define(<_private>)dnl
- >,
- $8,rw,
- <dnl
- define(<_user_write>)dnl
- ifdef($9,
- ifelse($9,,,
- define(<_group_write>)dnl
- ))dnl
- >,
- $8,rwp,
- <dnl
- define(<_user_write>)dnl
- define(<_private>)dnl
- >,
- _warn(<share access is wrong. Must be either "ro", "rop", "rw" or "rwp">)dnl
- ))dnl
- ifdef(<_user_write>,
- < writeable = yes
- >ifdef(<_group_write>,
- ifdef(<_world_read>,
- _masks(0664,2775),
- _masks(0660,2770)),
- ifdef(<_group_read>,
- ifdef(<_world_read>,
- _masks(0644,0755),
- _masks(0640,0750)),
- _masks(0600,0700))dnl
- ifdef(<_veto>,
- < delete veto files = Yes
- >)dnl
- ),
- dnl ***user read, group read***(?)
- dnl ***user read***
- )dnl
- ifelse($9,,,
- < valid users = @$9
- >ifdef(<_group_write>,
- < force group = +$9
- >))dnl
- ifdef(<_private>,
- < browseable = no
- >)dnl
- ifdef(<_veto>,
- < veto files = _veto_mac
- >)dnl
- )dnl
- >)dnl
- define(<_homefiles>,
- <ifelse($1,win,
- <_files($1,$2,$3,$4,,,,$5)>dnl
- )>)dnl
- define(<_printer>,
- <ifelse($1,win,
- [$2]
- ifelse($3,,,
- < comment = $3
- >)dnl
- path = $4
- printable = yes
- printer name = $5
- ,<>)dnl
- >)dnl
- dnl
- include(/etc/local-COMMON/file-FQDN.m4)dnl
|