From 31309a316c22f20acc2a6c9e0e5cd062b4ec6e40 Mon Sep 17 00:00:00 2001 From: "F. Duncanh" Date: Tue, 13 May 2025 03:52:14 -0400 Subject: [PATCH] Add a user systemd script (from @deuchnord ) --- CMakeLists.txt | 3 ++- README.html | 38 +++++++++++++++++++++++++++++++++----- README.md | 38 ++++++++++++++++++++++++++++++++------ README.txt | 50 +++++++++++++++++++++++++++++++++++++++++--------- uxplay.service | 1 + 5 files changed, 109 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b03bbd6..61f6d5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,8 @@ target_link_libraries( uxplay install( TARGETS uxplay RUNTIME DESTINATION bin ) install( FILES uxplay.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) install( FILES README.md README.txt README.html LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR} ) -install( FILES lib/llhttp/LICENSE-MIT DESTINATION ${CMAKE_INSTALL_DOCDIR}/llhttp ) +install( FILES lib/llhttp/LICENSE-MIT DESTINATION ${CMAKE_INSTALL_DOCDIR}/llhttp ) +install( FILES uxplay.service DESTINATION ${CMAKE_INSTALL_DOCDIR}/systemd ) # uninstall target if(NOT TARGET uninstall) diff --git a/README.html b/README.html index 4202942..eb7d65a 100644 --- a/README.html +++ b/README.html @@ -86,8 +86,12 @@ href="https://github.com/FDH2/UxPlay/releases">releases (see their the section on using this specfile for building an installable RPM package.

+
  • If your distribution does not supply UxPlay, or you want the +latest version, it is very easy to build it yourself: see the very detailed instructions for building +UxPlay from source. later in this document.

  • -

    After installation:

    +

    After installation:

    -

    To (easily) compile the latest UxPlay from source, see the section Getting UxPlay.

    Detailed description of UxPlay

    This project is a GPLv3 open source unix AirPlay2 Mirror server for @@ -261,7 +289,7 @@ can be regarded as a “System Library”, which it is in *BSD). Many Linux distributions treat OpenSSL as a “System Library”, but some (e.g. Debian) do not: in this case, the issue is solved by linking with OpenSSL-3.0.0 or later.

    -

    Getting UxPlay

    +

    Building UxPlay from source

    Either download and unzip UxPlay-master.zip, or (if git is installed): “git clone https://github.com/FDH2/UxPlay”. @@ -526,7 +554,7 @@ href="#usage">Usage for details, if you wish to use it. Some clients with MDM (Mobile Device Management, often present on employer-owned devices) are required to use pin-authentication: UxPlay will provide this even when running without the pin option. -Password authentication (-pw pwd)is also offered as an +Password authentication (-pw pwd) is also offered as an alternative solution to pin codes: users need to know the password pwd and enter it on their iOS/macOS device to access UxPlay, when prompted (if pwd is not set, a displayed random pin code diff --git a/README.md b/README.md index 543c6f5..af66a00 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,12 @@ status](https://repology.org/badge/vertical-allrepos/uxplay.svg)](https://repolo See the section on using this specfile for [building an installable RPM package](#building-an-installable-rpm-package). -After installation: +- If your distribution does not supply UxPlay, or you want the latest version, + it is very easy to build it yourself: see the very + [detailed instructions for building UxPlay from source](#building-uxplay-from-source). + later in this document. + +## After installation: - (On Linux and \*BSD): if a firewall is active on the server hosting UxPlay, make sure the default network port (UDP 5353) for @@ -90,6 +95,10 @@ After installation: with the option "uxplay -async", but there is then a 2 second latency imposed by iOS. +- If you are using UxPlay just to mirror the client's screen (without + showing videos that need audio synchronized with video), it is best to + use the option "uxplay -vsync no". + - Add any UxPlay options you want to use as defaults to a startup file `~/.uxplayrc` (see "`man uxplay`" or "`uxplay -h`" for format and other possible locations). In particular, if your system uses @@ -98,6 +107,22 @@ After installation: from terminal commands "ps waux \| grep pulse" or "pactl info" will contain "pipewire" if your Linux/BSD system uses it).* +- For Linux systems using systemd, there is a **systemd** service file **uxplay.service** + found in the UxPlay top directory of the distribution, and also installed + in `/uxplay/systemd/` (where DOCDIR is usually ``/usr/local/share/doc``), that allows users to start + their own instance of UxPlay as a rootless daemon: it should either be added to the + directory /etc/systemd/user, or the user can just create their own + systemd directory `~/.config/systemd/user/` and then copy uxplay.service into it. To save + uxplay terminal output to a file ~/uxplay.log, uncomment the StandardOutput entry in + uxplay.service. Then + + `systemctl --user [start/stop/enable/disable/status] uxplay` + + can be used to control the daemon. If it is enabled, the daemon will start + at the user's first login and stop when they no longer have any open sessions. See + https://www.baeldung.com/linux/systemd-create-user-services for more about + systemd user services. **Note: it is NOT recommended to run UxPlay as a root service.** + - On Raspberry Pi: models using hardware h264 video decoding by the Broadcom GPU (models 4B and earlier) may require the uxplay option -bt709. If you use Ubuntu 22.10 or earlier, GStreamer must @@ -108,9 +133,10 @@ After installation: decoding is used seems to have reappeared starting with GStreamer-1.22. -To (easily) compile the latest UxPlay from source, see the section -[Getting UxPlay](#getting-uxplay). - +- If UxPlay is used in a public space, there are security options for requiring an AppleTV-style + one-time pin (displayed on the terminal) to be entered, or a password, and for barring/permitting + client access by their device ID. See options -pin, -reg, -pw, -restrict, -allow, -block. + # Detailed description of UxPlay This project is a GPLv3 open source unix AirPlay2 Mirror server for @@ -252,7 +278,7 @@ clause incompatible with the GPL unless OpenSSL can be regarded as a OpenSSL as a "System Library", but some (e.g. Debian) do not: in this case, the issue is solved by linking with OpenSSL-3.0.0 or later. -# Getting UxPlay +# Building UxPlay from source Either download and unzip [UxPlay-master.zip](https://github.com/FDH2/UxPlay/archive/refs/heads/master.zip), @@ -512,7 +538,7 @@ below for help with this or other problems. with MDM (Mobile Device Management, often present on employer-owned devices) are required to use pin-authentication: UxPlay will provide this even when running without the pin option.* Password authentication - (-pw _pwd_)is also offered as an alternative solution to pin codes: + (-pw _pwd_) is also offered as an alternative solution to pin codes: users need to know the password _pwd_ and enter it on their iOS/macOS device to access UxPlay, when prompted (if _pwd_ is not set, a displayed random pin code must be entered at **each** new connection.) diff --git a/README.txt b/README.txt index cd372fe..7eb51a8 100644 --- a/README.txt +++ b/README.txt @@ -79,7 +79,12 @@ status](https://repology.org/badge/vertical-allrepos/uxplay.svg)](https://repolo See the section on using this specfile for [building an installable RPM package](#building-an-installable-rpm-package). -After installation: +- If your distribution does not supply UxPlay, or you want the latest + version, it is very easy to build it yourself: see the very + [detailed instructions for building UxPlay from + source](#building-uxplay-from-source). later in this document. + +## After installation: - (On Linux and \*BSD): if a firewall is active on the server hosting UxPlay, make sure the default network port (UDP 5353) for @@ -97,6 +102,10 @@ After installation: with the option "uxplay -async", but there is then a 2 second latency imposed by iOS. +- If you are using UxPlay just to mirror the client's screen (without + showing videos that need audio synchronized with video), it is best + to use the option "uxplay -vsync no". + - Add any UxPlay options you want to use as defaults to a startup file `~/.uxplayrc` (see "`man uxplay`" or "`uxplay -h`" for format and other possible locations). In particular, if your system uses @@ -105,6 +114,26 @@ After installation: from terminal commands "ps waux \| grep pulse" or "pactl info" will contain "pipewire" if your Linux/BSD system uses it).* +- For Linux systems using systemd, there is a **systemd** service file + **uxplay.service** found in the UxPlay top directory of the + distribution, and also installed in `/uxplay/systemd/` + (where DOCDIR is usually `/usr/local/share/doc`), that allows users + to start their own instance of UxPlay as a rootless daemon: it + should either be added to the directory /etc/systemd/user, or the + user can just create their own systemd directory + `~/.config/systemd/user/` and then copy uxplay.service into it. To + save uxplay terminal output to a file \~/uxplay.log, uncomment the + StandardOutput entry in uxplay.service. Then + + `systemctl --user [start/stop/enable/disable/status] uxplay` + + can be used to control the daemon. If it is enabled, the daemon will + start at the user's first login and stop when they no longer have + any open sessions. See + https://www.baeldung.com/linux/systemd-create-user-services for more + about systemd user services. **Note: it is NOT recommended to run + UxPlay as a root service.** + - On Raspberry Pi: models using hardware h264 video decoding by the Broadcom GPU (models 4B and earlier) may require the uxplay option -bt709. If you use Ubuntu 22.10 or earlier, GStreamer must be @@ -115,8 +144,11 @@ After installation: video decoding is used seems to have reappeared starting with GStreamer-1.22. -To (easily) compile the latest UxPlay from source, see the section -[Getting UxPlay](#getting-uxplay). +- If UxPlay is used in a public space, there are security options for + requiring an AppleTV-style one-time pin (displayed on the terminal) + to be entered, or a password, and for barring/permitting client + access by their device ID. See options -pin, -reg, -pw, -restrict, + -allow, -block. # Detailed description of UxPlay @@ -259,7 +291,7 @@ clause incompatible with the GPL unless OpenSSL can be regarded as a OpenSSL as a "System Library", but some (e.g. Debian) do not: in this case, the issue is solved by linking with OpenSSL-3.0.0 or later. -# Getting UxPlay +# Building UxPlay from source Either download and unzip [UxPlay-master.zip](https://github.com/FDH2/UxPlay/archive/refs/heads/master.zip), @@ -519,11 +551,11 @@ below for help with this or other problems. with MDM (Mobile Device Management, often present on employer-owned devices) are required to use pin-authentication: UxPlay will provide this even when running without the pin option.* Password - authentication (-pw *pwd*)is also offered as an alternative solution - to pin codes: users need to know the password *pwd* and enter it on - their iOS/macOS device to access UxPlay, when prompted (if *pwd* is - not set, a displayed random pin code must be entered at **each** new - connection.) + authentication (-pw *pwd*) is also offered as an alternative + solution to pin codes: users need to know the password *pwd* and + enter it on their iOS/macOS device to access UxPlay, when prompted + (if *pwd* is not set, a displayed random pin code must be entered at + **each** new connection.) - By default, UxPlay is locked to its current client until that client drops the connection; since UxPlay-1.58, the option `-nohold` diff --git a/uxplay.service b/uxplay.service index 7b7c651..50f0c27 100644 --- a/uxplay.service +++ b/uxplay.service @@ -7,6 +7,7 @@ After=avahi-daemon Type=simple ExecStart=uxplay Restart=on-failure +#StandardOutput=file:%h/uxplay.log [Install] WantedBy=default.target