mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +02:00
34 lines
686 B
Plaintext
34 lines
686 B
Plaintext
|
USER="sonarr"
|
||
|
|
||
|
# Add User
|
||
|
|
||
|
if ! getent passwd "$USER" >/dev/null; then
|
||
|
adduser --quiet --system --shell /bin/bash --home /var/opt/sonarr --group "$USER"
|
||
|
|
||
|
if ! getent group "$USER" >/dev/null; then
|
||
|
groupadd "$USER"
|
||
|
usermod -a -G "$USER" "$USER"
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
# Create home directory
|
||
|
|
||
|
if [ ! -d /var/opt/sonarr ]; then
|
||
|
mkdir -p /var/opt/sonarr
|
||
|
chown $USER:$USER /var/opt/sonarr
|
||
|
fi
|
||
|
|
||
|
# Set permissions on /opt/sonarr
|
||
|
|
||
|
chown -R $USER:$USER /opt/sonarr
|
||
|
|
||
|
# Start Sonarr automatically
|
||
|
|
||
|
if [ -f /proc/1/comm ]; then
|
||
|
if [ "`cat /proc/1/comm`" = "systemd" ]; then
|
||
|
# Enable and start systemd service
|
||
|
systemctl enable sonarr.service
|
||
|
systemctl start sonarr.service
|
||
|
fi
|
||
|
fi
|