parent
65aeb19486
commit
7a82e7b365
@ -1,64 +0,0 @@
|
||||
fromdos ./debian/*
|
||||
chmod ugo-x ./debian/*
|
||||
cp -r ./debian ./debian_backup
|
||||
|
||||
BuildVersion=${dependent_build_number:-4.10.0.999}
|
||||
BuildBranch=${dependent_build_branch:-main}
|
||||
BootstrapVersion=`echo "$BuildVersion" | cut -d. -f1,2,3`
|
||||
BootstrapUpdater="BuiltIn"
|
||||
PackageUpdater="apt"
|
||||
|
||||
echo Version: "$BuildVersion" Branch: "$BuildBranch"
|
||||
|
||||
rm -r ./sonarr_bin/Sonarr.Update
|
||||
chmod -R ugo-x,ugo+rwX,go-w ./sonarr_bin/*
|
||||
|
||||
echo Updating changelog for $BuildVersion
|
||||
sed -i "s:{version}:$BuildVersion:g; s:{branch}:$BuildBranch:g;" debian/changelog
|
||||
sed -i "s:{version}:$BuildVersion:g; s:{updater}:$PackageUpdater:g" debian/preinst debian/postinst debian/postrm
|
||||
sed -i '/#BEGIN BUILTIN UPDATER/,/#END BUILTIN UPDATER/d' debian/preinst debian/postinst debian/postrm
|
||||
echo "# Do Not Edit\nPackageVersion=$BuildVersion\nPackageAuthor=[Team Sonarr](https://sonarr.tv)\nReleaseVersion=$BuildVersion\nUpdateMethod=$PackageUpdater\nBranch=$BuildBranch" > package_info
|
||||
|
||||
echo Running debuild for $BuildVersion
|
||||
if [ -z "${TEST_OUTPUT}" ]; then
|
||||
debuild -b
|
||||
else
|
||||
debuild -us -uc -b
|
||||
fi
|
||||
|
||||
# Restore debian directory to the original files
|
||||
rm -rf ./debian
|
||||
mv ./debian_backup ./debian
|
||||
|
||||
echo Updating changelog for $BootstrapVersion
|
||||
sed -i "s:{version}:$BootstrapVersion:g; s:{branch}:$BuildBranch:g;" debian/changelog
|
||||
sed -i "s:{version}:$BuildVersion:g; s:{updater}:$BootstrapUpdater:g" debian/preinst debian/postinst debian/postrm
|
||||
sed -i '/#BEGIN BUILTIN UPDATER/d; /#END BUILTIN UPDATER/d' debian/preinst debian/postinst debian/postrm
|
||||
echo "# Do Not Edit\nPackageVersion=$BootstrapVersion\nPackageAuthor=[Team Sonarr](https://sonarr.tv)\nReleaseVersion=$BuildVersion\nUpdateMethod=$BootstrapUpdater\nBranch=$BuildBranch" > package_info
|
||||
|
||||
echo Running debuild for $BootstrapVersion
|
||||
if [ -z "${TEST_OUTPUT}" ]; then
|
||||
debuild -b
|
||||
else
|
||||
debuild -us -uc -b
|
||||
fi
|
||||
|
||||
echo Moving stuff around
|
||||
mv ../sonarr_*.deb ./
|
||||
mv ../sonarr_*.changes ./
|
||||
rm ../sonarr_*.build
|
||||
|
||||
if [ -z "${TEST_OUTPUT}" ]; then
|
||||
echo Signing Package
|
||||
dpkg-sig -k 884589CE --sign builder "sonarr_${BuildVersion}_all.deb"
|
||||
dpkg-sig -k 884589CE --sign builder "sonarr_${BootstrapVersion}_all.deb"
|
||||
|
||||
echo running alien
|
||||
alien -r -v ./*.deb
|
||||
else
|
||||
echo "Exporting packages to ${TEST_OUTPUT}"
|
||||
dpkg -e "sonarr_${BuildVersion}_all.deb" ${TEST_OUTPUT}/sonarr-build
|
||||
dpkg -e "sonarr_${BootstrapVersion}_all.deb" ${TEST_OUTPUT}/sonarr-release
|
||||
|
||||
cp *.deb ${TEST_OUTPUT}/
|
||||
fi
|
@ -1,6 +0,0 @@
|
||||
[*]
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
@ -1,5 +0,0 @@
|
||||
sonarr ({version}) {branch}; urgency=low
|
||||
|
||||
* Automatic Release.
|
||||
|
||||
-- Sonarr <hello@sonarr.tv> Sun, 28 Jan 2018 00:00:00 -0700
|
@ -1 +0,0 @@
|
||||
10
|
@ -1,17 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
db_beginblock
|
||||
db_input high sonarr/owning_user || true
|
||||
db_input high sonarr/owning_group || true
|
||||
db_endblock
|
||||
db_go
|
||||
|
||||
db_beginblock
|
||||
db_input low sonarr/owning_umask || true
|
||||
db_input low sonarr/config_directory || true
|
||||
db_endblock
|
||||
db_go
|
||||
|
||||
exit 0
|
@ -1,18 +0,0 @@
|
||||
Section: web
|
||||
Priority: optional
|
||||
Maintainer: Sonarr <hello@sonarr.tv>
|
||||
Source: sonarr
|
||||
Homepage: https://sonarr.tv
|
||||
Vcs-Git: git@github.com:Sonarr/Sonarr.git
|
||||
Vcs-Browser: https://github.com/Sonarr/Sonarr
|
||||
Build-Depends: debhelper (>= 9),
|
||||
dh-systemd (>= 1.5)
|
||||
|
||||
Package: sonarr
|
||||
Architecture: all
|
||||
Provides: nzbdrone
|
||||
Conflicts: nzbdrone
|
||||
Replaces: nzbdrone
|
||||
Depends: adduser, libsqlite3-0 (>= 3.7), ${cli:Depends}, ${misc:Depends}
|
||||
Suggests: sqlite3 (>= 3.7)
|
||||
Description: Internet PVR
|
@ -1,24 +0,0 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: sonarr
|
||||
Source: https://github.com/Sonarr/Sonarr
|
||||
|
||||
Files: *
|
||||
Copyright: 2010-2016 Sonarr <hello@sonarr.tv>
|
||||
|
||||
License: GPL-3.0+
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This package is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
.
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
@ -1 +0,0 @@
|
||||
sonarr_3.0.0.0_all.deb web optional
|
@ -1,2 +0,0 @@
|
||||
sonarr_bin/* usr/lib/sonarr/bin
|
||||
package_info usr/lib/sonarr
|
@ -0,0 +1,180 @@
|
||||
#!/bin/bash
|
||||
### Description: Sonarr .NET Debian install
|
||||
### Originally written for Radarr by: DoctorArr - doctorarr@the-rowlands.co.uk on 2021-10-01 v1.0
|
||||
### Updates for servarr suite made by Bakerboy448, DoctorArr, brightghost, aeramor and VP-EN
|
||||
### Version v1.0.0 2023-12-29 - StevieTV - adapted from servarr script for Sonarr installs
|
||||
|
||||
### Boilerplate Warning
|
||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
#EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
#NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
#LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
#OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
#WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
scriptversion="1.0.0"
|
||||
scriptdate="2023-12-29"
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "Running Sonarr Install Script - Version [$scriptversion] as of [$scriptdate]"
|
||||
|
||||
# Am I root?, need root!
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "Please run as root."
|
||||
exit
|
||||
fi
|
||||
|
||||
app="sonarr"
|
||||
app_port="8989"
|
||||
app_prereq="curl sqlite3 wget"
|
||||
app_umask="0002"
|
||||
branch="main"
|
||||
|
||||
# Constants
|
||||
### Update these variables as required for your specific instance
|
||||
installdir="/opt" # {Update me if needed} Install Location
|
||||
bindir="${installdir}/${app^}" # Full Path to Install Location
|
||||
datadir="/var/lib/$app/" # {Update me if needed} AppData directory to use
|
||||
app_bin=${app^} # Binary Name of the app
|
||||
|
||||
# Prompt User
|
||||
read -r -p "What user should ${app^} run as? (Default: $app): " app_uid
|
||||
app_uid=$(echo "$app_uid" | tr -d ' ')
|
||||
app_uid=${app_uid:-$app}
|
||||
# Prompt Group
|
||||
read -r -p "What group should ${app^} run as? (Default: media): " app_guid
|
||||
app_guid=$(echo "$app_guid" | tr -d ' ')
|
||||
app_guid=${app_guid:-media}
|
||||
|
||||
echo "This will install [${app^}] to [$bindir] and use [$datadir] for the AppData Directory"
|
||||
echo "${app^} will run as the user [$app_uid] and group [$app_guid]. By continuing, you've confirmed that that user and group will have READ and WRITE access to your Media Library and Download Client Completed Download directories"
|
||||
echo "Continue with the installation [Yes/No]?"
|
||||
select yn in "Yes" "No"; do
|
||||
case $yn in
|
||||
Yes) break ;;
|
||||
No) exit 0 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Create User / Group as needed
|
||||
if [ "$app_guid" != "$app_uid" ]; then
|
||||
if ! getent group "$app_guid" >/dev/null; then
|
||||
groupadd "$app_guid"
|
||||
fi
|
||||
fi
|
||||
if ! getent passwd "$app_uid" >/dev/null; then
|
||||
adduser --system --no-create-home --ingroup "$app_guid" "$app_uid"
|
||||
echo "Created and added User [$app_uid] to Group [$app_guid]"
|
||||
fi
|
||||
if ! getent group "$app_guid" | grep -qw "$app_uid"; then
|
||||
echo "User [$app_uid] did not exist in Group [$app_guid]"
|
||||
usermod -a -G "$app_guid" "$app_uid"
|
||||
echo "Added User [$app_uid] to Group [$app_guid]"
|
||||
fi
|
||||
|
||||
# Stop the App if running
|
||||
if service --status-all | grep -Fq "$app"; then
|
||||
systemctl stop "$app"
|
||||
systemctl disable "$app".service
|
||||
echo "Stopped existing $app"
|
||||
fi
|
||||
|
||||
# Create Appdata Directory
|
||||
|
||||
# AppData
|
||||
mkdir -p "$datadir"
|
||||
chown -R "$app_uid":"$app_guid" "$datadir"
|
||||
chmod 775 "$datadir"
|
||||
echo "Directories created"
|
||||
# Download and install the App
|
||||
|
||||
# prerequisite packages
|
||||
echo ""
|
||||
echo "Installing pre-requisite Packages"
|
||||
# shellcheck disable=SC2086
|
||||
apt update && apt install $app_prereq
|
||||
echo ""
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
# get arch
|
||||
dlbase="https://services.sonarr.tv/v1/download/$branch/latest?version=4&os=linux"
|
||||
case "$ARCH" in
|
||||
"amd64") DLURL="${dlbase}&arch=x64" ;;
|
||||
"armhf") DLURL="${dlbase}&arch=arm" ;;
|
||||
"arm64") DLURL="${dlbase}&arch=arm64" ;;
|
||||
*)
|
||||
echo "Arch not supported"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
echo ""
|
||||
echo "Removing previous tarballs"
|
||||
# -f to Force so we fail if it doesnt exist
|
||||
rm -f "${app^}".*.tar.gz
|
||||
echo ""
|
||||
echo "Downloading..."
|
||||
wget --content-disposition "$DLURL"
|
||||
tar -xvzf "${app^}".*.tar.gz
|
||||
echo ""
|
||||
echo "Installation files downloaded and extracted"
|
||||
|
||||
# remove existing installs
|
||||
echo "Removing existing installation"
|
||||
# If you happen to run this script in the installdir the line below will delete the extracted files and cause the mv some lines below to fail.
|
||||
rm -rf "$bindir"
|
||||
echo "Installing..."
|
||||
mv "${app^}" $installdir
|
||||
chown "$app_uid":"$app_guid" -R "$bindir"
|
||||
chmod 775 "$bindir"
|
||||
rm -rf "${app^}.*.tar.gz"
|
||||
# Ensure we check for an update in case user installs older version or different branch
|
||||
touch "$datadir"/update_required
|
||||
chown "$app_uid":"$app_guid" "$datadir"/update_required
|
||||
echo "App Installed"
|
||||
# Configure Autostart
|
||||
|
||||
# Remove any previous app .service
|
||||
echo "Removing old service file"
|
||||
rm -rf /etc/systemd/system/"$app".service
|
||||
|
||||
# Create app .service with correct user startup
|
||||
echo "Creating service file"
|
||||
cat <<EOF | tee /etc/systemd/system/"$app".service >/dev/null
|
||||
[Unit]
|
||||
Description=${app^} Daemon
|
||||
After=syslog.target network.target
|
||||
[Service]
|
||||
User=$app_uid
|
||||
Group=$app_guid
|
||||
UMask=$app_umask
|
||||
Type=simple
|
||||
ExecStart=$bindir/$app_bin -nobrowser -data=$datadir
|
||||
TimeoutStopSec=20
|
||||
KillMode=process
|
||||
Restart=on-failure
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Start the App
|
||||
echo "Service file created. Attempting to start the app"
|
||||
systemctl -q daemon-reload
|
||||
systemctl enable --now -q "$app"
|
||||
|
||||
# Finish Update/Installation
|
||||
host=$(hostname -I)
|
||||
ip_local=$(grep -oP '^\S*' <<<"$host")
|
||||
echo ""
|
||||
echo "Install complete"
|
||||
sleep 10
|
||||
STATUS="$(systemctl is-active "$app")"
|
||||
if [ "${STATUS}" = "active" ]; then
|
||||
echo "Browse to http://$ip_local:$app_port for the ${app^} GUI"
|
||||
else
|
||||
echo "${app^} failed to start"
|
||||
fi
|
||||
|
||||
# Exit
|
||||
exit 0
|
@ -1,111 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
BUILD_VERSION={version}
|
||||
UPDATER={updater}
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
db_get sonarr/owning_user
|
||||
USER="$RET"
|
||||
db_get sonarr/owning_group
|
||||
GROUP="$RET"
|
||||
db_get sonarr/owning_umask
|
||||
UMASK="$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
|
||||
|
||||
if [ $1 = "configure" ]; then
|
||||
# Migrate old Sonarr v3 alpha data dir from /var/opt/sonarr or user home
|
||||
if [ -d "/var/opt/sonarr" ] && [ "$CONFDIR" != "/var/opt/sonarr" ] && [ ! -d "$CONFDIR" ]; then
|
||||
varoptRoot="/var/opt/sonarr"
|
||||
varoptAppData="$varoptRoot/.config/Sonarr"
|
||||
sonarrUserHome=`getent passwd $USER | cut -d ':' -f 6`
|
||||
sonarrAppData="$sonarrUserHome/.config/Sonarr"
|
||||
if [ -f "$varoptRoot/sonarr.db" ]; then
|
||||
# Handle /var/opt/sonarr/sonarr.db
|
||||
mv "$varoptRoot" "$CONFDIR"
|
||||
elif [ -f "$varoptAppData/sonarr.db" ]; then
|
||||
# Handle /var/opt/sonarr/.config/Sonarr/sonarr.db
|
||||
mv "$varoptAppData" "$CONFDIR"
|
||||
rm -rf "$varoptRoot"
|
||||
elif [ -f "$sonarrAppData/sonarr.db" ]; then
|
||||
# Handle ~/.config/Sonarr/sonarr.db
|
||||
mv "$sonarrAppData" "$CONFDIR"
|
||||
rm -rf "$sonarrAppData"
|
||||
else
|
||||
mv "$varoptRoot" "$CONFDIR"
|
||||
fi
|
||||
chown -R $USER:$GROUP "$CONFDIR"
|
||||
chmod -R 775 "$CONFDIR"
|
||||
fi
|
||||
|
||||
# Migrate old NzbDrone data dir
|
||||
if [ -d "/usr/lib/sonarr/nzbdrone-appdata" ] && [ ! -d "$CONFDIR" ]; then
|
||||
NZBDRONE_DATA=`readlink /usr/lib/sonarr/nzbdrone-appdata`
|
||||
if [ -f "$NZBDRONE_DATA/config.xml" ] && [ -f "$NZBDRONE_DATA/nzbdrone.db" ]; then
|
||||
echo "Found NzbDrone database in $NZBDRONE_DATA, copying to $CONFDIR."
|
||||
mkdir -p "$CONFDIR"
|
||||
cp $NZBDRONE_DATA/config.xml $NZBDRONE_DATA/nzbdrone.db* "$CONFDIR/"
|
||||
chown -R $USER:$GROUP "$CONFDIR"
|
||||
chmod -R 775 "$CONFDIR"
|
||||
else
|
||||
echo "Missing NzbDrone database in $NZBDRONE_DATA, skipping migration."
|
||||
fi
|
||||
rm /usr/lib/sonarr/nzbdrone-appdata
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create data directory
|
||||
if [ ! -d "$CONFDIR" ]; then
|
||||
mkdir -p "$CONFDIR"
|
||||
fi
|
||||
|
||||
# Set permissions on data directory (always do this instead only on creation in case user was changed via dpkg-reconfigure)
|
||||
chown -R $USER:$GROUP "$CONFDIR"
|
||||
|
||||
#BEGIN BUILTIN UPDATER
|
||||
# Apply patch if present
|
||||
if [ "$UPDATER" = "BuiltIn" ] && [ -f /usr/lib/sonarr/bin_patch/release_info ]; then
|
||||
# It shouldn't be possible to get a wrong bin_patch, but let's check anyway and throw it away if it's wrong
|
||||
currentVersion=`cat /usr/lib/sonarr/bin_patch/release_info | grep 'ReleaseVersion=' | cut -d= -f 2`
|
||||
currentRelease=`echo "$currentVersion" | cut -d. -f1,2,3`
|
||||
currentBuild=`echo "$currentVersion" | cut -d. -f4`
|
||||
targetVersion=$BUILD_VERSION
|
||||
targetRelease=`echo "$targetVersion" | cut -d. -f1,2,3`
|
||||
targetBuild=`echo "$targetVersion" | cut -d. -f4`
|
||||
|
||||
if [ "$currentRelease" = "$targetRelease" ] && [ "$currentBuild" -gt "$targetBuild" ]; then
|
||||
echo "Applying $currentVersion from BuiltIn updater instead of downgrading to $targetVersion"
|
||||
rm -rf /usr/lib/sonarr/bin
|
||||
mv /usr/lib/sonarr/bin_patch /usr/lib/sonarr/bin
|
||||
else
|
||||
rm -rf /usr/lib/sonarr/bin_patch
|
||||
fi
|
||||
fi
|
||||
#END BUILTIN UPDATER
|
||||
|
||||
# Set permissions on /usr/lib/sonarr
|
||||
chown -R $USER:$GROUP /usr/lib/sonarr
|
||||
|
||||
# Update sonarr.service file
|
||||
sed -i "s:User=\w*:User=$USER:g; s:Group=\w*:Group=$GROUP:g; s:UMask=[0-9]*:UMask=$UMASK:g; s:-data=.*$:-data=$CONFDIR:g" /lib/systemd/system/sonarr.service
|
||||
|
||||
#BEGIN BUILTIN UPDATER
|
||||
if [ "$UPDATER" = "BuiltIn" ]; then
|
||||
# If we upgraded, signal Sonarr to do an update check on startup instead of scheduled.
|
||||
touch $CONFDIR/update_required
|
||||
chown $USER:$GROUP $CONFDIR/update_required
|
||||
fi
|
||||
#END BUILTIN UPDATER
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
@ -1,36 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
BUILD_VERSION={version}
|
||||
UPDATER={updater}
|
||||
|
||||
if [ $1 = "abort-install" ]; then
|
||||
# preinst was aborted, possibly due to NzbDrone still running.
|
||||
# Nothing to do here
|
||||
:
|
||||
fi
|
||||
|
||||
# The bin directory is expected to be empty, unless the BuiltIn updater added files.
|
||||
if [ $1 = "remove" ] && [ -d /usr/lib/sonarr/bin ]; then
|
||||
rm -rf /usr/lib/sonarr/bin
|
||||
fi
|
||||
|
||||
#BEGIN BUILTIN UPDATER
|
||||
# Remove any existing patch if still present
|
||||
if [ $1 = "remove" ] && [ -d /usr/lib/sonarr/bin_patch ]; then
|
||||
rm -rf /usr/lib/sonarr/bin_patch
|
||||
fi
|
||||
#END BUILTIN UPDATER
|
||||
|
||||
# Purge the entire sonarr configuration directory.
|
||||
# TODO: Maybe move a minimal backup to tmp?
|
||||
if [ $1 = "purge" ] && [ -e /usr/share/debconf/confmodule ]; then
|
||||
. /usr/share/debconf/confmodule
|
||||
db_get sonarr/config_directory
|
||||
CONFDIR="$RET"
|
||||
if [ -d "$CONFDIR" ]; then
|
||||
rm -rf "$CONFDIR"
|
||||
fi
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
@ -1,91 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
BUILD_VERSION={version}
|
||||
UPDATER={updater}
|
||||
|
||||
# Deal with existing nzbdrone installs
|
||||
#
|
||||
# Existing nzbdrone packages do not have startup scripts and the process might still be running.
|
||||
# If the user manually installed nzbdrone then the process might still be running too.
|
||||
if [ $1 = "install" ]; then
|
||||
psNzbDrone=`ps ax -o'user:20,pid,ppid,unit,args' | grep mono.*NzbDrone\\\\.exe || true`
|
||||
if [ ! -z "$psNzbDrone" ]; then
|
||||
# Get the user and optional systemd unit
|
||||
psNzbDroneUser=`echo "$psNzbDrone" | tr -s ' ' | cut -d ' ' -f 1`
|
||||
psNzbDroneUnit=`echo "$psNzbDrone" | tr -s ' ' | cut -d ' ' -f 4`
|
||||
# Get the appdata from the cmdline or get it from the user dir
|
||||
droneAppData=`echo "$psNzbDrone" | tr ' ' '\n' | grep -- "-data=" | cut -d= -f 2`
|
||||
if [ "$droneAppData" = "" ]; then
|
||||
droneUserHome=`getent passwd $psNzbDroneUser | cut -d ':' -f 6`
|
||||
droneAppData="$droneUserHome/.config/NzbDrone"
|
||||
fi
|
||||
|
||||
if [ "$psNzbDroneUnit" != "-" ] && [ -d /run/systemd/system ]; then
|
||||
if [ "$psNzbDroneUnit" = "sonarr.service" ]; then
|
||||
# Conflicts with our new sonarr.service so we have to remove it
|
||||
echo "NzbDrone systemd startup detected at $psNzbDroneUnit, stopping and removing..."
|
||||
deb-systemd-invoke stop $psNzbDroneUnit >/dev/null
|
||||
if [ -f "/etc/systemd/system/$psNzbDroneUnit" ]; then
|
||||
rm /etc/systemd/system/$psNzbDroneUnit
|
||||
fi
|
||||
if [ -f "/usr/lib/systemd/system/$psNzbDroneUnit" ]; then
|
||||
rm /usr/lib/systemd/system/$psNzbDroneUnit
|
||||
fi
|
||||
deb-systemd-helper purge $psNzbDroneUnit >/dev/null
|
||||
deb-systemd-helper unmask $psNzbDroneUnit >/dev/null
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
else
|
||||
# Just disable it, so the user can revisit the settings later
|
||||
echo "NzbDrone systemd startup detected at $psNzbDroneUnit, stopping and disabling..."
|
||||
deb-systemd-invoke stop $psNzbDroneUnit >/dev/null
|
||||
deb-systemd-invoke mask $psNzbDroneUnit >/dev/null
|
||||
fi
|
||||
else
|
||||
# We don't support auto migration for other startup methods, so bail.
|
||||
# This leaves the sonarr package in an incomplete state.
|
||||
echo "ps: $psNzbDrone"
|
||||
echo "Error: An existing Sonarr v2 (NzbDrone) process is running. Remove the NzbDrone auto-startup prior to installing sonarr."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We don't have the debconf configuration yet so we can't migrate the data.
|
||||
# Instead we symlink so postinst knows where it's at.
|
||||
if [ -f "/usr/lib/sonarr/nzbdrone-appdata" ]; then
|
||||
rm "/usr/lib/sonarr/nzbdrone-appdata"
|
||||
else
|
||||
mkdir -p "/usr/lib/sonarr"
|
||||
fi
|
||||
ln -s $droneAppData /usr/lib/sonarr/nzbdrone-appdata
|
||||
fi
|
||||
fi
|
||||
|
||||
#BEGIN BUILTIN UPDATER
|
||||
# Check for supported upgrade paths
|
||||
if [ $1 = "upgrade" ] && [ "$UPDATER" = "BuiltIn" ] && [ -f /usr/lib/sonarr/bin/release_info ]; then
|
||||
# If we allow the Built-In updater to upgrade from 3.0.1.123 to 3.0.2.500 and now apt is catching up to 3.0.2.425
|
||||
# then we need to deal with that 500->425 'downgrade'.
|
||||
# We do that by preserving the binaries and using those instead for postinst.
|
||||
|
||||
currentVersion=`cat /usr/lib/sonarr/bin/release_info | grep 'ReleaseVersion=' | cut -d= -f 2`
|
||||
currentRelease=`echo "$currentVersion" | cut -d. -f1,2,3`
|
||||
currentBuild=`echo "$currentVersion" | cut -d. -f4`
|
||||
targetVersion=$BUILD_VERSION
|
||||
targetRelease=`echo "$targetVersion" | cut -d. -f1,2,3`
|
||||
targetBuild=`echo "$targetVersion" | cut -d. -f4`
|
||||
|
||||
if [ -d /usr/lib/sonarr/bin_patch ]; then
|
||||
rm -rf /usr/lib/sonarr/bin_patch
|
||||
fi
|
||||
|
||||
# Check if the existing version is already an upgrade for the included build
|
||||
if [ "$currentRelease" = "$targetRelease" ] && [ "$currentBuild" -gt "$targetBuild" ]; then
|
||||
echo "Preserving $currentVersion from BuiltIn updater instead of downgrading to $targetVersion"
|
||||
cp -r /usr/lib/sonarr/bin /usr/lib/sonarr/bin_patch
|
||||
fi
|
||||
fi
|
||||
#END BUILTIN UPDATER
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
@ -1,21 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
EXCLUDE_MODULEREFS = crypt32 httpapi __Internal ole32.dll
|
||||
|
||||
%:
|
||||
dh $@ --with=systemd --with=cli
|
||||
|
||||
# No init script, only systemd
|
||||
override_dh_installinit:
|
||||
true
|
||||
|
||||
# Sonarr likes debug symbols for logging
|
||||
override_dh_clistrip:
|
||||
|
||||
override_dh_makeclilibs:
|
||||
|
||||
override_dh_clideps:
|
||||
dh_clideps -d -r $(patsubst %,--exclude-moduleref=%,$(EXCLUDE_MODULEREFS))
|
@ -1,2 +0,0 @@
|
||||
ignores msbuild
|
||||
ignores libc6
|
@ -1,27 +0,0 @@
|
||||
Template: sonarr/owning_user
|
||||
Type: string
|
||||
Default: sonarr
|
||||
Description: Sonarr user:
|
||||
Specify the user that is used to run Sonarr. The user will be created if it does not already exist.
|
||||
The default 'sonarr' should work fine for most users. You can specify the user group next.
|
||||
|
||||
Template: sonarr/owning_group
|
||||
Type: string
|
||||
Default: sonarr
|
||||
Description: Sonarr group:
|
||||
Specify the group that is used to run Sonarr. The group will be created if it does not already exist.
|
||||
If the user doesn't already exist then this group will be used as the user's primary group.
|
||||
Any media files created by Sonarr will be writeable by this group.
|
||||
It's advisable to keep the group the same between download client, Sonarr and media centers.
|
||||
|
||||
Template: sonarr/owning_umask
|
||||
Type: string
|
||||
Default: 0002
|
||||
Description: Sonarr umask:
|
||||
Specifies the umask of the files created by Sonarr. 0002 means the files will be created with 664 as permissions.
|
||||
|
||||
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