Added debconf to allow user to set user, group and config dir. Only the group is high prio and thus asked for by default.
This commit is contained in:
parent
9e909cafdd
commit
40a7cf32c5
|
@ -2,6 +2,7 @@ fromdos ./debian/*
|
||||||
echo Version: "$dependent_build_number" Branch: "$dependent_build_branch"
|
echo Version: "$dependent_build_number" Branch: "$dependent_build_branch"
|
||||||
|
|
||||||
rm -r ./sonarr_bin/Sonarr.Update
|
rm -r ./sonarr_bin/Sonarr.Update
|
||||||
|
chmod -R 664 ./sonarr_bin/*
|
||||||
|
|
||||||
echo Updating changelog
|
echo Updating changelog
|
||||||
sed -i "s/{version}/$dependent_build_number/g" debian/changelog
|
sed -i "s/{version}/$dependent_build_number/g" debian/changelog
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
. /usr/share/debconf/confmodule
|
||||||
|
|
||||||
|
db_beginblock
|
||||||
|
db_input medium sonarr/owning_user || true
|
||||||
|
db_input high sonarr/owning_group || true
|
||||||
|
db_input low sonarr/config_directory || true
|
||||||
|
db_endblock
|
||||||
|
db_go
|
||||||
|
|
||||||
|
exit 0
|
|
@ -9,14 +9,14 @@ Build-Depends: debhelper (>= 9),
|
||||||
dh-systemd (>= 1.5),
|
dh-systemd (>= 1.5),
|
||||||
mono-devel (>= 4.6),
|
mono-devel (>= 4.6),
|
||||||
libmono-cil-dev (>= 4.6),
|
libmono-cil-dev (>= 4.6),
|
||||||
cli-common-dev (>= 0.9)
|
cli-common-dev (>= 0.5.7)
|
||||||
|
|
||||||
Package: sonarr
|
Package: sonarr
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Provides: nzbdrone
|
Provides: nzbdrone
|
||||||
Conflicts: nzbdrone
|
Conflicts: nzbdrone
|
||||||
Replaces: nzbdrone
|
Replaces: nzbdrone
|
||||||
Depends: libsqlite3-0 (>= 3.7), libmediainfo0v5 (>= 0.7.52), ${shlibs:Depends}, ${cli:Depends}, ${misc:Depends}
|
Depends: adduser, libsqlite3-0 (>= 3.7), libmediainfo0v5 (>= 0.7.52), mono-runtime (>= 5.4), ${shlibs:Depends}, ${cli:Depends}, ${misc:Depends}
|
||||||
Recommends: sqlite3 (>= 3.7), mediainfo (>= 0.7.52), ${shlibs:Recommends}, ${cli:Recommends}, ${misc:Recommends}
|
Recommends: sqlite3 (>= 3.7), mediainfo (>= 0.7.52), ${shlibs:Recommends}, ${cli:Recommends}, ${misc:Recommends}
|
||||||
Suggests: ${shlibs:Suggests}, ${cli:Suggests}, ${misc:Suggests}
|
Suggests: ${shlibs:Suggests}, ${cli:Suggests}, ${misc:Suggests}
|
||||||
Description: Internet PVR
|
Description: Internet PVR
|
||||||
|
|
|
@ -1,25 +1,37 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
USER="sonarr"
|
# Source debconf library.
|
||||||
|
. /usr/share/debconf/confmodule
|
||||||
|
|
||||||
# Add User
|
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
|
if ! getent passwd "$USER" >/dev/null; then
|
||||||
adduser --quiet --system --shell /bin/bash --home /var/opt/sonarr --group "$USER"
|
adduser --system --no-create-home --ingroup "$GROUP" "$USER"
|
||||||
|
|
||||||
if ! getent group "$USER" >/dev/null; then
|
|
||||||
groupadd "$USER"
|
|
||||||
usermod -a -G "$USER" "$USER"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create home directory
|
# Create data directory
|
||||||
if [ ! -d /var/opt/sonarr ]; then
|
if [ ! -d "$CONFDIR" ]; then
|
||||||
mkdir -p /var/opt/sonarr
|
mkdir -p "$CONFDIR"
|
||||||
chown -R $USER: /var/opt/sonarr
|
chown -R $USER:$GROUP "$CONFDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set permissions on /opt/sonarr
|
# Set permissions on /opt/sonarr
|
||||||
chown -R $USER: /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#
|
#DEBHELPER#
|
||||||
|
|
||||||
|
exit 0
|
|
@ -5,9 +5,10 @@ After=network.target
|
||||||
[Service]
|
[Service]
|
||||||
User=sonarr
|
User=sonarr
|
||||||
Group=sonarr
|
Group=sonarr
|
||||||
|
UMask=002
|
||||||
|
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/usr/bin/mono --debug /opt/sonarr/bin/Sonarr.exe -nobrowser
|
ExecStart=/usr/bin/mono --debug /opt/sonarr/bin/Sonarr.exe -nobrowser -data=/var/opt/sonarr
|
||||||
TimeoutStopSec=20
|
TimeoutStopSec=20
|
||||||
KillMode=process
|
KillMode=process
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
Template: sonarr/owning_user
|
||||||
|
Type: string
|
||||||
|
Default: sonarr
|
||||||
|
Description: Sonarr user:
|
||||||
|
Specify the user that Sonarr must run as. The user will be created if it does not already exist.
|
||||||
|
|
||||||
|
Template: sonarr/owning_group
|
||||||
|
Type: string
|
||||||
|
Default: sonarr
|
||||||
|
Description: Sonarr group:
|
||||||
|
Specify the group that Sonarr must run as. The group will be created if it does not already exist.
|
||||||
|
If the user doesn't already exist then this group will be specified as the user's primary group.
|
||||||
|
Any media files created by Sonarr will be writeable by this group.
|
||||||
|
|
||||||
|
Template: sonarr/config_directory
|
||||||
|
Type: string
|
||||||
|
Default: /var/lib/sonarr
|
||||||
|
Description: Config directory:
|
||||||
|
Specify the directory where Sonarr stores the internal database and metadata. Media content will be stored elsewhere.
|
Loading…
Reference in New Issue