summaryrefslogtreecommitdiff
path: root/packaging
diff options
context:
space:
mode:
authorAurelien Aptel <aaptel@suse.com>2017-12-14 16:47:49 +0100
committerAndrew Bartlett <abartlet@samba.org>2018-01-08 03:34:18 +0100
commit080d590de1ff9f8ebc55aeffaea8d41991466549 (patch)
treef5474d2ec333c8e99e3659b9b466e893fc4b74b8 /packaging
parent3089a5660dd75e1396cd29dfb202a1d4ff1b7cfe (diff)
downloadsamba-080d590de1ff9f8ebc55aeffaea8d41991466549.tar.gz
packaging: add configure option to preprocess and install systemd files
Turn the systemd service files under packaging into template (.in) files with @VAR@ substitutions and add configure options to install and tweak them. Signed-off-by: Aurelien Aptel <aaptel@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'packaging')
-rw-r--r--packaging/systemd/nmb.service.in (renamed from packaging/systemd/nmb.service)7
-rw-r--r--packaging/systemd/samba.service.in (renamed from packaging/systemd/samba.service)7
-rw-r--r--packaging/systemd/smb.service.in (renamed from packaging/systemd/smb.service)7
-rw-r--r--packaging/systemd/winbind.service.in (renamed from packaging/systemd/winbind.service)7
-rw-r--r--packaging/wscript50
-rw-r--r--packaging/wscript_build16
6 files changed, 82 insertions, 12 deletions
diff --git a/packaging/systemd/nmb.service b/packaging/systemd/nmb.service.in
index 6231118abe8..b0ba92f2244 100644
--- a/packaging/systemd/nmb.service
+++ b/packaging/systemd/nmb.service.in
@@ -6,11 +6,12 @@ After=syslog.target network.target network-online.target
[Service]
Type=notify
NotifyAccess=all
-PIDFile=/run/nmbd.pid
-EnvironmentFile=-/etc/sysconfig/samba
-ExecStart=/usr/sbin/nmbd --foreground --no-process-group $NMBDOPTIONS
+PIDFile=@PIDDIR@/nmbd.pid
+EnvironmentFile=-@SYSCONFDIR@/sysconfig/samba
+ExecStart=@SBINDIR@/nmbd --foreground --no-process-group $NMBDOPTIONS
ExecReload=/usr/bin/kill -HUP $MAINPID
LimitCORE=infinity
+@systemd_nmb_extra@
[Install]
WantedBy=multi-user.target
diff --git a/packaging/systemd/samba.service b/packaging/systemd/samba.service.in
index 79b22a0da7a..c4181509461 100644
--- a/packaging/systemd/samba.service
+++ b/packaging/systemd/samba.service.in
@@ -6,11 +6,12 @@ After=syslog.target network.target network-online.target
[Service]
Type=notify
NotifyAccess=all
-PIDFile=/run/samba.pid
+PIDFile=@PIDDIR@/samba.pid
LimitNOFILE=16384
-EnvironmentFile=-/etc/sysconfig/samba
-ExecStart=/usr/sbin/samba --foreground --no-process-group $SAMBAOPTIONS
+EnvironmentFile=-@SYSCONFDIR@/sysconfig/samba
+ExecStart=@SBINDIR@/samba --foreground --no-process-group $SAMBAOPTIONS
ExecReload=/usr/bin/kill -HUP $MAINPID
+@systemd_samba_extra@
[Install]
WantedBy=multi-user.target
diff --git a/packaging/systemd/smb.service b/packaging/systemd/smb.service.in
index adf6684c7d9..f829bcbaee5 100644
--- a/packaging/systemd/smb.service
+++ b/packaging/systemd/smb.service.in
@@ -5,12 +5,13 @@ After=syslog.target network.target nmb.service winbind.service
[Service]
Type=notify
NotifyAccess=all
-PIDFile=/run/smbd.pid
+PIDFile=@PIDDIR@/smbd.pid
LimitNOFILE=16384
-EnvironmentFile=-/etc/sysconfig/samba
-ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS
+EnvironmentFile=-@SYSCONFDIR@/sysconfig/samba
+ExecStart=@SBINDIR@/smbd --foreground --no-process-group $SMBDOPTIONS
ExecReload=/usr/bin/kill -HUP $MAINPID
LimitCORE=infinity
+@systemd_smb_extra@
[Install]
WantedBy=multi-user.target
diff --git a/packaging/systemd/winbind.service b/packaging/systemd/winbind.service.in
index 46b3797251d..5ac5adc846f 100644
--- a/packaging/systemd/winbind.service
+++ b/packaging/systemd/winbind.service.in
@@ -5,11 +5,12 @@ After=syslog.target network.target nmb.service
[Service]
Type=notify
NotifyAccess=all
-PIDFile=/run/winbindd.pid
-EnvironmentFile=-/etc/sysconfig/samba
-ExecStart=/usr/sbin/winbindd --foreground --no-process-group "$WINBINDOPTIONS"
+PIDFile=@PIDDIR@/winbindd.pid
+EnvironmentFile=-@SYSCONFDIR@/sysconfig/samba
+ExecStart=@SBINDIR@/winbindd --foreground --no-process-group "$WINBINDOPTIONS"
ExecReload=/usr/bin/kill -HUP $MAINPID
LimitCORE=infinity
+@systemd_winbind_extra@
[Install]
WantedBy=multi-user.target
diff --git a/packaging/wscript b/packaging/wscript
new file mode 100644
index 00000000000..76158e9da44
--- /dev/null
+++ b/packaging/wscript
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+
+import Options
+
+def set_options(opt):
+ gr = opt.option_group('systemd installation options')
+
+ gr.add_option('--systemd-install-services',
+ help=("install systemd service files to manage daemons (default=no)"),
+ action="store_true", dest="systemd_install_services", default=False)
+
+ gr.add_option('--with-systemddir',
+ help=("systemd service directory [PREFIX/usr/lib/systemd/system]"),
+ action="store", dest="SYSTEMDDIR",
+ default="${PREFIX}/usr/lib/systemd/system")
+ #
+ # extra service directives
+ #
+
+ gr.add_option('--systemd-smb-extra',
+ metavar="Option=Value",
+ help=("Extra directives added to the smb service file."
+ +" Can be given multiple times."),
+ action="append", dest="systemd_smb_extra", default=[])
+
+ gr.add_option('--systemd-nmb-extra',
+ metavar="Option=Value",
+ help=("Extra directives added to the nmb service file."
+ +" Can be used multiple times."),
+ action="append", dest="systemd_nmb_extra", default=[])
+
+ gr.add_option('--systemd-winbind-extra',
+ metavar="Option=Value",
+ help=("Extra directives added to the winbind service file."
+ +" Can be used multiple times."),
+ action="append", dest="systemd_winbind_extra", default=[])
+
+ gr.add_option('--systemd-samba-extra',
+ metavar="Option=Value",
+ help=("Extra directives added to the samba service file."
+ +" Can be used multiple times."),
+ action="append", dest="systemd_samba_extra", default=[])
+
+def configure(conf):
+ conf.env.systemd_install_services = Options.options.systemd_install_services
+ conf.env.systemd_smb_extra = '\n'.join(Options.options.systemd_smb_extra)
+ conf.env.systemd_nmb_extra = '\n'.join(Options.options.systemd_nmb_extra)
+ conf.env.systemd_winbind_extra = '\n'.join(Options.options.systemd_winbind_extra)
+ conf.env.systemd_samba_extra = '\n'.join(Options.options.systemd_samba_extra)
+ conf.env.SYSTEMDDIR = Options.options.SYSTEMDDIR
diff --git a/packaging/wscript_build b/packaging/wscript_build
new file mode 100644
index 00000000000..fbcd4e55f8c
--- /dev/null
+++ b/packaging/wscript_build
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+
+systemd_services = [
+ 'systemd/smb.service',
+ 'systemd/nmb.service',
+ 'systemd/winbind.service',
+ 'systemd/samba.service'
+]
+
+for srv in systemd_services:
+ bld.CONFIGURE_FILE(srv)
+ if bld.env.systemd_install_services:
+ bld.INSTALL_FILES(bld.env.SYSTEMDDIR, srv, flat=True)
+
+if bld.env.systemd_install_services:
+ bld.INSTALL_FILES('${SYSCONFDIR}/sysconfig', 'systemd/samba.sysconfig', destname='samba')