From 0015d61164e324ebc7acdadf699e29388d7adc1b Mon Sep 17 00:00:00 2001 From: ixces Date: Mon, 30 Jun 2025 05:23:20 +0300 Subject: [PATCH] add systemd user services --- contrib/package/arch/copyparty-user.service | 25 +++++++++++++++++ contrib/package/arch/prisonparty-user.service | 28 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 contrib/package/arch/copyparty-user.service create mode 100644 contrib/package/arch/prisonparty-user.service diff --git a/contrib/package/arch/copyparty-user.service b/contrib/package/arch/copyparty-user.service new file mode 100644 index 00000000..26689421 --- /dev/null +++ b/contrib/package/arch/copyparty-user.service @@ -0,0 +1,25 @@ +# this will start `/usr/bin/copyparty` +# and read config from `$HOME/.config/copyparty.conf` +# +# unless you add -q to disable logging, you may want to remove the +# following line to allow buffering (slightly better performance): +# Environment=PYTHONUNBUFFERED=x + +[Unit] +Description=copyparty file server + +[Service] +Type=notify +SyslogIdentifier=copyparty +Environment=PYTHONUNBUFFERED=x +WorkingDirectory=/var/lib/copyparty-jail +ExecReload=/bin/kill -s USR1 $MAINPID + +# stop systemd-tmpfiles-clean.timer from deleting copyparty while it's running +ExecStartPre=+/bin/bash -c 'mkdir -p /run/tmpfiles.d/ && echo "x /tmp/pe-copyparty*" > /run/tmpfiles.d/copyparty.conf' + +# run copyparty +ExecStart=/usr/bin/python3 /usr/bin/copyparty -c %h/.config/copyparty/copyparty.conf + +[Install] +WantedBy=multi-user.target diff --git a/contrib/package/arch/prisonparty-user.service b/contrib/package/arch/prisonparty-user.service new file mode 100644 index 00000000..143cad04 --- /dev/null +++ b/contrib/package/arch/prisonparty-user.service @@ -0,0 +1,28 @@ +# this will start `/usr/bin/copyparty` +# in a chroot, preventing accidental access elsewhere, +# and read copyparty config from `$HOME/.config/copyparty.conf` +# +# expose additional filesystem locations to copyparty +# by listing them between the last `%u` and `--` +# +# unless you add -q to disable logging, you may want to remove the +# following line to allow buffering (slightly better performance): +# Environment=PYTHONUNBUFFERED=x + +[Unit] +Description=copyparty file server + +[Service] +SyslogIdentifier=prisonparty +Environment=PYTHONUNBUFFERED=x +WorkingDirectory=/var/lib/copyparty-jail +ExecReload=/bin/kill -s USR1 $MAINPID + +# run copyparty +ExecStart=/bin/bash /usr/bin/prisonparty /var/lib/copyparty-jail %u %u \ + %h/.config/copyparty \ + -- \ + /usr/bin/python3 /usr/bin/copyparty -c %h/.config/copyparty/copyparty.conf + +[Install] +WantedBy=multi-user.target