From cc55b3e1d174443b062e49b0aaa749816f9fd5a4 Mon Sep 17 00:00:00 2001 From: jude Date: Wed, 29 Mar 2023 17:57:19 +0100 Subject: [PATCH] Add user when installing --- debian/postinst | 7 ++++++- debian/postrm | 11 +++++++++++ systemd/soundfx-rs.service | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 debian/postrm diff --git a/debian/postinst b/debian/postinst index 5ac7430..d4f0aef 100755 --- a/debian/postinst +++ b/debian/postinst @@ -1,8 +1,13 @@ -#!/bin/sh +#!/bin/bash set -e + +id -u soundfx &>/dev/null || useradd -r -M soundfx + if [ ! -f /etc/soundfx-rs/config.env ]; then cp /etc/soundfx-rs/default.env /etc/soundfx-rs/config.env fi +chown soundfx /etc/soundfx-rs/config.env + #DEBHELPER# diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..4a7b2c8 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +id -u soundfx &>/dev/null || userdel soundfx + +if [ -f /etc/soundfx-rs/config.env ]; then + rm /etc/soundfx/config.env +fi + +#DEBHELPER# diff --git a/systemd/soundfx-rs.service b/systemd/soundfx-rs.service index 51fd8b0..6ad4f90 100644 --- a/systemd/soundfx-rs.service +++ b/systemd/soundfx-rs.service @@ -2,6 +2,7 @@ Description=Discord bot for custom sound effects and soundboards [Service] +User=soundfx Type=simple ExecStart=/usr/bin/soundfx-rs WorkingDirectory=/etc/soundfx-rs