On Wed, Aug 10, 2011 at 11:45:01AM +0200, Frederic Crozat wrote:
Currently I've not found a way to port
PortOpts="" for cfg in /etc/sendmail.cf /etc/mail/sendmail.cf do test -s $cfg || continue PortOpts=$(sed -rn '/^O[[:blank:]]+DaemonPortOptions=.*Name=MTA.*$/I { s/[[:blank:]]+//g s/^O[^=]+=(.*)/\1/p }' $cfg) break done unset cfg
if test "$SMTPD_LISTEN_REMOTE" != "yes" ; then PortOpts="${PortOpts:+${PortOpts},}Addr=127.0.0.1" SENDMAIL_ARGS="-O DaemonPortOptions=${PortOpts} $SENDMAIL_ARGS" fi
from /etc/init.d/sendmail to the service unit sendmail.service. With this there is a control if the MTA is listen on port 25 of any remote network interface or if not. How can this be done within a systemd service unit (without using a wrapper script)?
You can't do that directly in a unit file.
Maybe it would be an idea to have to possiblity to use short shell commands as it is possible in make or spec files: Environment=SENDMAIL_PORT_OPTS=$(shell code)
One option is to create a systemd generator (which is what is used for crypttab and getty service), to be installed in /lib/systemd/system-generator which would be started by systemd and would create temporary .service files in /run/systemd/generators (which is a tmpfs) which would be used by systemd as "normal" service files.
I've tested quickly and just dropping generator script in /lib/systemd/system-generators, make sure it is executable and takes one parameter which is the path where generated unit files should be written.
Hmmm ... I'm missing documentation on the topic `System Generators'. Werner -- "Having a smoking section in a restaurant is like having a peeing section in a swimming pool." -- Edward Burr -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-factory+help@opensuse.org