Samba 2.0.7 and FHS conventions
Daniel Roethlisberger
admin at roe.ch
Tue Jan 23 23:50:54 GMT 2001
Hi there,
[I'm not subscribed to the list, if you want me to know what you
reply please CC me]
Short Version:
Why don't you comply with the Filesystem Hierarchy Standard? [1]
Very Long Version:
In the process of building a linux box from scratch, I've
recently built samba-2.0.7 . It seems to me that the autoconf
defaults do not follow the Filesystem Hierarchy Standard at all.
Even worse, it is not even possible to make it follow the FHS
convention by mere command line arguments. My best try was:
./configure --prefix=/usr \
--sysconfdir=/etc \
--libdir=/etc \
--localstatedir=/var \
--with-privatedir=/etc/samba \
--with-lockdir=/var/samba \
--with-swatdir=/usr/lib/swat
But that was not enough - log files go to /var/log, not
/var - so I edited Makefile.in, and made some changes:
-SBINDIR = @bindir@
+SBINDIR = @sbindir@
+ETCDIR = @etcdir@
-SMBLOGFILE = $(VARDIR)/log.smb
+SMBLOGFILE = $(VARDIR)/log/smb.log
-NMBLOGFILE = $(VARDIR)/log.nmb
+NMBLOGFILE = $(VARDIR)/log/nmb.log
-CONFIGFILE = $(LIBDIR)/smb.conf
+CONFIGFILE = $(ETCDIR)/smb.conf
-LMHOSTSFILE = $(LIBDIR)/lmhosts
+LMHOSTSFILE = $(ETCDIR)/lmhosts
-DRIVERFILE = $(LIBDIR)/printers.def
+DRIVERFILE = $(ETCDIR)/printers.def
This also moved the configuration files to etc instead of lib,
which makes the --libdir=/etc switch to configure obsolete.
Great.
However, the pid files still were not at the correct place. To
fix that, I even had to apply a quick-and-dirty hack to
source/lib/pidfile.c:
- slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name);
+ slprintf(pidFile, sizeof(pidFile)-1, "/var/run/%s.pid", name);
(twice)
Only now my Samba installation complied with the Filesystem
Hierarchy Standard.
Here's what humble me considers harmful:
- You use LIBDIR for files that should go to ETCDIR
Here's what humble me considers bad practice:
- You put logfiles into VARDIR instead of VARDIR/log
- You put pidfiles into LOCKDIR instead of VARDIR/run
Here's what humble me considers not ok:
- You put system binaries into BINDIR instead of SBINDIR
- The defaults for privatedir, lockdir and swatdir are cluttering
the filesystem with stuff that should go elsewhere. Privatedir
is configuration, with similar content as /etc/shadow, so that
should go somewhere under /etc, Swatdir should clearly go to
PREFIX/lib/(package_name), ..)
I am aware that what I label "not ok" is due to historical
reasons, but why cling to historical locations, when at the same
time almost everybody else is trying hard to conform to the FHS?
At least the user can choose, so it's not -too- bad.
What I'd consider good practice is the following:
- Use ETCDIR instead of LIBDIR for config files.
(no need for additional switches - LIBDIR is IMHO just harmful)
- Use VARDIR/log for logfiles
(or at least let the user affect this with an autoconf switch)
- Use VARDIR/run for pidfiles
(or at least let the user affect this with an autoconf switch)
- Add a autoconf option like "--compatibility", which will make
autoconf use all those historical default paths. If not
specified, use more up-to-date defaults.
(or if you're really clinging to the old days, add an option
like "--comply-with-standards" and do this the other way
'round)
If this was fixed in the CVS or beta releases of Samba, please
forgive me (and let me know..;).
All this is just my 5 cents worth. And of course only how I and
everybody I talked to interpret the FHS. Let me know about your
interpretation of it, if it is completely different.
Well, just think about it. This is not a holy crusade... ;-)
Cheers,
Dan
References:
[1] Filesystem Hierarchy Standard - http://www.pathname.com/fhs/
--
Daniel Roethlisberger
PGP Key ID 0x8DE543ED
More information about the samba
mailing list