systemd: add unit files for pipewire-media-session

... and disable starting it from context.exec in the config
This commit is contained in:
George Kiagiadakis 2021-02-23 17:43:35 +02:00 committed by Wim Taymans
parent 3a7ce9660a
commit 012a68f8ef
5 changed files with 61 additions and 4 deletions

View file

@ -197,13 +197,14 @@ context.exec = {
# #
# Execute the given program with arguments. # Execute the given program with arguments.
# #
# Start the session manager. Run the session manager with -h for # You can optionally start the session manager here,
# options. # but it is better to start it as a systemd service.
# Run the session manager with -h for options.
# #
"@media_session_path@" = { args = "" } #"@media_session_path@" = { args = "" }
# #
# You can optionally start the pulseaudio-server here as well # You can optionally start the pulseaudio-server here as well
# but it better to start it as a systemd service. # but it is better to start it as a systemd service.
# It can be interesting to start another daemon here that listens # It can be interesting to start another daemon here that listens
# on another address with the -a option (eg. -a tcp:4713). # on another address with the -a option (eg. -a tcp:4713).
# #

View file

@ -5,8 +5,16 @@ install_data(sources : 'pipewire.socket',
systemd_config = configuration_data() systemd_config = configuration_data()
systemd_config.set('PW_BINARY', join_paths(pipewire_bindir, 'pipewire')) systemd_config.set('PW_BINARY', join_paths(pipewire_bindir, 'pipewire'))
systemd_config.set('PW_MEDIA_SESSION_BINARY', join_paths(pipewire_bindir, 'pipewire-media-session'))
configure_file(input : 'pipewire.service.in', configure_file(input : 'pipewire.service.in',
output : 'pipewire.service', output : 'pipewire.service',
configuration : systemd_config, configuration : systemd_config,
install_dir : systemd_system_services_dir) install_dir : systemd_system_services_dir)
if get_option('media-session')
configure_file(input : 'pipewire-media-session.service.in',
output : 'pipewire-media-session.service',
configuration : systemd_config,
install_dir : systemd_system_services_dir)
endif

View file

@ -0,0 +1,21 @@
[Unit]
Description=Multimedia Service Session Manager
After=pipewire.service
BindsTo=pipewire.service
[Service]
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service
Type=simple
ExecStart=@PW_MEDIA_SESSION_BINARY@
Restart=on-failure
RuntimeDirectory=pipewire
User=pipewire
Environment=PIPEWIRE_RUNTIME_DIR=%t/pipewire
[Install]
WantedBy=pipewire.service

View file

@ -10,6 +10,7 @@ install_data(
systemd_config = configuration_data() systemd_config = configuration_data()
systemd_config.set('PW_BINARY', join_paths(pipewire_bindir, 'pipewire')) systemd_config.set('PW_BINARY', join_paths(pipewire_bindir, 'pipewire'))
systemd_config.set('PW_PULSE_BINARY', join_paths(pipewire_bindir, 'pipewire-pulse')) systemd_config.set('PW_PULSE_BINARY', join_paths(pipewire_bindir, 'pipewire-pulse'))
systemd_config.set('PW_MEDIA_SESSION_BINARY', join_paths(pipewire_bindir, 'pipewire-media-session'))
configure_file(input : 'pipewire.service.in', configure_file(input : 'pipewire.service.in',
output : 'pipewire.service', output : 'pipewire.service',
@ -20,3 +21,10 @@ configure_file(input : 'pipewire-pulse.service.in',
output : 'pipewire-pulse.service', output : 'pipewire-pulse.service',
configuration : systemd_config, configuration : systemd_config,
install_dir : systemd_user_services_dir) install_dir : systemd_user_services_dir)
if get_option('media-session')
configure_file(input : 'pipewire-media-session.service.in',
output : 'pipewire-media-session.service',
configuration : systemd_config,
install_dir : systemd_user_services_dir)
endif

View file

@ -0,0 +1,19 @@
[Unit]
Description=Multimedia Service Session Manager
After=pipewire.service
BindsTo=pipewire.service
[Service]
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service
Type=simple
ExecStart=@PW_MEDIA_SESSION_BINARY@
Restart=on-failure
Slice=session.slice
[Install]
WantedBy=pipewire.service