Merge branch 'configure-systemd-units-based-on-build-options' of https://github.com/naglis/MPD
This commit is contained in:
commit
65a3062f45
@ -1,5 +1,22 @@
|
|||||||
systemd_unit_conf = configuration_data()
|
systemd_unit_conf = configuration_data()
|
||||||
systemd_unit_conf.set('prefix', get_option('prefix'))
|
systemd_unit_conf.set('prefix', get_option('prefix'))
|
||||||
|
|
||||||
|
address_families = ['AF_INET', 'AF_INET6', 'AF_UNIX']
|
||||||
|
if get_option('smbclient').enabled()
|
||||||
|
# AF_NETLINK is required by libsmbclient, or it will exit() .. *sigh*
|
||||||
|
address_families += 'AF_NETLINK'
|
||||||
|
endif
|
||||||
|
systemd_unit_conf.set('address_families', ' '.join(address_families))
|
||||||
|
|
||||||
|
systemd_socket_conf = configuration_data()
|
||||||
|
listen_streams = []
|
||||||
|
if get_option('local_socket')
|
||||||
|
listen_streams += 'ListenStream=%t/mpd/socket'
|
||||||
|
endif
|
||||||
|
if get_option('tcp')
|
||||||
|
listen_streams += 'ListenStream=6600'
|
||||||
|
endif
|
||||||
|
systemd_socket_conf.set('listen_streams', '\n'.join(listen_streams))
|
||||||
|
|
||||||
subdir('system')
|
subdir('system')
|
||||||
subdir('user')
|
subdir('user')
|
||||||
|
@ -12,8 +12,10 @@ if systemd_system_unit_dir == ''
|
|||||||
systemd_system_unit_dir = join_paths(get_option('prefix'), 'lib', 'systemd', 'system')
|
systemd_system_unit_dir = join_paths(get_option('prefix'), 'lib', 'systemd', 'system')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
install_data(
|
configure_file(
|
||||||
'mpd.socket',
|
input: 'mpd.socket.in',
|
||||||
|
output: 'mpd.socket',
|
||||||
|
configuration: systemd_socket_conf,
|
||||||
install_dir: systemd_system_unit_dir,
|
install_dir: systemd_system_unit_dir,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -27,8 +27,7 @@ NoNewPrivileges=yes
|
|||||||
ProtectKernelTunables=yes
|
ProtectKernelTunables=yes
|
||||||
ProtectControlGroups=yes
|
ProtectControlGroups=yes
|
||||||
ProtectKernelModules=yes
|
ProtectKernelModules=yes
|
||||||
# AF_NETLINK is required by libsmbclient, or it will exit() .. *sigh*
|
RestrictAddressFamilies=@address_families@
|
||||||
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
|
|
||||||
RestrictNamespaces=yes
|
RestrictNamespaces=yes
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
[Socket]
|
[Socket]
|
||||||
ListenStream=%t/mpd/socket
|
@listen_streams@
|
||||||
ListenStream=6600
|
|
||||||
Backlog=5
|
Backlog=5
|
||||||
KeepAlive=true
|
KeepAlive=true
|
||||||
PassCredentials=true
|
PassCredentials=true
|
@ -12,9 +12,10 @@ if systemd_user_unit_dir == ''
|
|||||||
systemd_user_unit_dir = join_paths(get_option('prefix'), 'lib', 'systemd', 'user')
|
systemd_user_unit_dir = join_paths(get_option('prefix'), 'lib', 'systemd', 'user')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# copy the system socket unit to the "user" directory
|
configure_file(
|
||||||
install_data(
|
input: join_paths('..', 'system', 'mpd.socket.in'),
|
||||||
join_paths('..', 'system', 'mpd.socket'),
|
output: 'mpd.socket',
|
||||||
|
configuration: systemd_socket_conf,
|
||||||
install_dir: systemd_user_unit_dir,
|
install_dir: systemd_user_unit_dir,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -28,8 +28,7 @@ ProtectSystem=yes
|
|||||||
NoNewPrivileges=yes
|
NoNewPrivileges=yes
|
||||||
ProtectKernelTunables=yes
|
ProtectKernelTunables=yes
|
||||||
ProtectControlGroups=yes
|
ProtectControlGroups=yes
|
||||||
# AF_NETLINK is required by libsmbclient, or it will exit() .. *sigh*
|
RestrictAddressFamilies=@address_families@
|
||||||
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
|
|
||||||
RestrictNamespaces=yes
|
RestrictNamespaces=yes
|
||||||
|
|
||||||
# Note that "ProtectKernelModules=yes" is missing in the user unit
|
# Note that "ProtectKernelModules=yes" is missing in the user unit
|
||||||
|
Loading…
Reference in New Issue
Block a user