-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
8 changed files
with
87 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters