systemd: base "ListenStream" on build options
Make `mpd.socket` configurable based on build options, so that e.g. `ListenStream=6600` is not added if `tcp` option is not enabled.
This commit is contained in:
parent
9bb67ae7f0
commit
df069bc456
|
@ -1,5 +1,15 @@
|
|||
systemd_unit_conf = configuration_data()
|
||||
systemd_unit_conf.set('prefix', get_option('prefix'))
|
||||
|
||||
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('user')
|
||||
|
|
|
@ -12,8 +12,10 @@ if systemd_system_unit_dir == ''
|
|||
systemd_system_unit_dir = join_paths(get_option('prefix'), 'lib', 'systemd', 'system')
|
||||
endif
|
||||
|
||||
install_data(
|
||||
'mpd.socket',
|
||||
configure_file(
|
||||
input: 'mpd.socket.in',
|
||||
output: 'mpd.socket',
|
||||
configuration: systemd_socket_conf,
|
||||
install_dir: systemd_system_unit_dir,
|
||||
)
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
[Socket]
|
||||
ListenStream=%t/mpd/socket
|
||||
ListenStream=6600
|
||||
@listen_streams@
|
||||
Backlog=5
|
||||
KeepAlive=true
|
||||
PassCredentials=true
|
|
@ -12,9 +12,10 @@ if systemd_user_unit_dir == ''
|
|||
systemd_user_unit_dir = join_paths(get_option('prefix'), 'lib', 'systemd', 'user')
|
||||
endif
|
||||
|
||||
# copy the system socket unit to the "user" directory
|
||||
install_data(
|
||||
join_paths('..', 'system', 'mpd.socket'),
|
||||
configure_file(
|
||||
input: join_paths('..', 'system', 'mpd.socket.in'),
|
||||
output: 'mpd.socket',
|
||||
configuration: systemd_socket_conf,
|
||||
install_dir: systemd_user_unit_dir,
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue