You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
803 B
37 lines
803 B
#!/bin/sh
|
|
set -e
|
|
|
|
# Source debconf library.
|
|
. /usr/share/debconf/confmodule
|
|
|
|
SYSTEMD_UNIT=/lib/systemd/system/sonarr.service
|
|
db_get sonarr/owning_user
|
|
USER="$RET"
|
|
db_get sonarr/owning_group
|
|
GROUP="$RET"
|
|
db_get sonarr/config_directory
|
|
CONFDIR="$RET"
|
|
|
|
# Add User and Group
|
|
if ! getent group "$GROUP" >/dev/null; then
|
|
groupadd "$GROUP"
|
|
fi
|
|
if ! getent passwd "$USER" >/dev/null; then
|
|
adduser --system --no-create-home --ingroup "$GROUP" "$USER"
|
|
fi
|
|
|
|
# Create data directory
|
|
if [ ! -d "$CONFDIR" ]; then
|
|
mkdir -p "$CONFDIR"
|
|
chown -R $USER:$GROUP "$CONFDIR"
|
|
fi
|
|
|
|
# Set permissions on /opt/sonarr
|
|
chown -R $USER:$GROUP /opt/sonarr
|
|
|
|
# Update sonarr.service file
|
|
sed -i "s:User=sonarr:User=$USER:g; s:Group=sonarr:Group=$GROUP:g; s:-data=/var/opt/sonarr:-data=$CONFDIR:g" $SYSTEMD_UNIT
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0 |