[systemd-devel] Environment & EnvironmentFile in unit files
Lennart Poettering
lennart at poettering.net
Thu Feb 3 12:43:18 PST 2011
On Thu, 27.01.11 11:10, Lucian Muresan (lucianm at users.sourceforge.net) wrote:
> cat /etc/systemd/system/lircd.service:
> [Unit]
> Description=LIRC Daemon
> After=network.target
> Name=lirc
>
> [Service]
> Type=forking
> EnvironmentFile=/etc/conf.d/lircd
> PIDFile=/var/run/lirc/lircd.pid
> ExecStartPre=/bin/mkdir -p /var/run/lirc
This is note really nice. lircd should do that on its own, and if it
doesn't use systemd-tmpfiles for this.
> ExecStartPre=/bin/rm -f /dev/lirc
This is not only not nice, but outright evil. Device node handling is
udev's job. Only udev should be creating and removing device nodes in
/dev, to ensure that they all show up properly in the udev database.
> ExecStartPre=/bin/rm -f /var/run/lirc/lircd
> ExecStartPre=/bin/ln -s /var/run/lirc/lircd /dev/lirc
These too is a job for tmpfiles.
> ExecStart=/usr/sbin/lircd -P /var/run/lirc/lircd.pid $LIRCD_OPTS
> ExecStopPost=/bin/rm -f /dev/lirc
Job for udev.
> ExecStopPost=/bin/rm -fR /var/run/lirc
Hmpf, is this really necessary?
> cat /etc/conf.d/lircd:
> # Options to pass to the lircd process
>
> # for devices with lirc-kernel-module
> #LIRCD_OPTS="-d /dev/lirc0"
> #LIRCD_OPTS="-H atilibusb -o /var/run/lirc/lircd"
>
> # for devices using the input-layer
> LIRCD_OPTS="-H devinput -d /dev/input/x10-remote"
> #LIRCD_OPTS="-H name='*X10 WTI RF receiver*'"
In generally I prefer if people just place stuff like this in the .service
file and if users want to change it they should copy it from /lib to
/etc and edit it there.
> For this one, it's really a pity that the user under which the process
> should be executed cannot be read from the external environment
> file...
The uid a daemon runs under should be a decision of the developer or
maybe distributor, but not really something for users.
> 3. example: I have several automount + mount units for remote
> filesystems like this:
>
> cat /etc/systemd/system/mnt-remote-GenLSPro_share.mount:
>
> [Unit]
> Description=GenLSPro share
> DefaultDependencies=no
> Requires=rpcbind.target
> After=rpcbind.target
>
> [Mount]
> What=GenLSPro:/mnt/share
> Where=/mnt/remote/GenLSPro_share
> Type=nfs
> Options=rsize=1024,wsize=1024,timeo=14,intr,hard,nfsvers=3,proto=udp
>
> Here I could really use the possibility to pass the mount options to the
> "Options=" directive from a common external file where I set all options
> for different file types, something like MOUNT_OPTS_NFS3,
> MOUNT_OPTS_CIF, MOUNT_OPTS_NFS4, etc.
If something like this is added, it should probably live in mount
itself, instead of systemd.
Karel, any opinion on this?
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list