Skip to content

Commit

Permalink
Patch for new package rev, rename old package
Browse files Browse the repository at this point in the history
Co-Authored-By: hgy59 <[email protected]>
  • Loading branch information
mreid-tt and hgy59 committed Dec 13, 2022
1 parent f126709 commit cadb0e0
Show file tree
Hide file tree
Showing 16 changed files with 236 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/actions/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ done

# fix for packages with different names
if [ "$(echo ${SPK_TO_BUILD} | grep -ow nzbdrone)" != "" ]; then
SPK_TO_BUILD+=" sonarr"
SPK_TO_BUILD+=" sonarr3"
fi
if [ "$(echo ${SPK_TO_BUILD} | grep -ow python)" != "" ]; then
SPK_TO_BUILD+=" python2"
Expand Down
2 changes: 1 addition & 1 deletion cross/sonarr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PKG_DIR = $(PKG_NAME)

DEPENDS =

UNSUPPORTED_ARCHS = $(i686_ARCHS) $(ARMv7L_ARCHS) $(ARMv5_ARCHS) $(PPC_ARCHS)
UNSUPPORTED_ARCHS = $(DOTNET_UNSUPPORTED_ARCHS)

HOMEPAGE = https://sonarr.tv
COMMENT = Sonarr is a PVR for newsgroup users. It can monitor multiple RSS feeds for new episodes of your favourite shows and will grab, sorts and rename them. It can also be configured to automatically upgrade the quality of files already downloaded if a better quality format becomes available.
Expand Down
21 changes: 21 additions & 0 deletions cross/sonarr3/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
PKG_NAME = Sonarr
PKG_VERS = 3.0.9.1549
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME).main.$(PKG_VERS).linux.$(PKG_EXT)
PKG_DIST_SITE = https://download.sonarr.tv/v3/main/$(PKG_VERS)
PKG_DIR = $(PKG_NAME)

DEPENDS =

HOMEPAGE = https://sonarr.tv
COMMENT = Sonarr is a PVR for newsgroup users. It can monitor multiple RSS feeds for new episodes of your favourite shows and will grab, sorts and rename them. It can also be configured to automatically upgrade the quality of files already downloaded if a better quality format becomes available.
LICENSE = GNU GPL v3

INSTALL_TARGET = sonarr_install

include ../../mk/spksrc.install-resources.mk

.PHONY: sonarr_install
sonarr_install:
mkdir -p $(STAGING_INSTALL_PREFIX)/share/$(PKG_DIR)
tar -cf - -C $(WORK_DIR)/$(PKG_DIR) . | tar -xf - -C $(STAGING_INSTALL_PREFIX)/share/$(PKG_DIR)
1 change: 1 addition & 0 deletions cross/sonarr3/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rsc:share/Sonarr
3 changes: 3 additions & 0 deletions cross/sonarr3/digests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Sonarr.main.3.0.9.1549.linux.tar.gz SHA1 f475b4b070df9865c5ff777d532683f753151d97
Sonarr.main.3.0.9.1549.linux.tar.gz SHA256 05ad67aef9e599590f23e384a704a13717cd2eba714be37bc2cc776a391c1a84
Sonarr.main.3.0.9.1549.linux.tar.gz MD5 823a85b54d4b797d966340e684a64f40
2 changes: 1 addition & 1 deletion mk/spksrc.service.installer.functions
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fi

log_step ()
{
install_log "===> Step $1. USER=$USER GROUP=$GROUP SHARE_PATH=${SHARE_PATH}"
install_log "===> Step $1. STATUS=${SYNOPKG_PKG_STATUS} USER=${USER} GROUP=${GROUP} SHARE_PATH=${SHARE_PATH}"
}


Expand Down
4 changes: 2 additions & 2 deletions spk/sonarr/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SPK_NAME = sonarr
SPK_VERS = $(shell date +%Y%m%d)
SPK_REV = 22
SPK_REV = 1
SPK_ICON = src/sonarr.png

DEPENDS = cross/sonarr cross/libstdc++ cross/sqlite
Expand All @@ -13,7 +13,7 @@ DESCRIPTION_FRE = Sonarr est un PVR pour les utilisateurs de groupes de discussi
DESCRIPTION_SPN = Sonarr es un PVR para los usuarios de grupos de noticias y torrents. Se puede controlar múltiples canales RSS para nuevos episodios de sus programas favoritos y se agarra, tipo y les cambia el nombre. También puede ser configurado para actualizar automáticamente la calidad de los archivos ya descargados si un formato de mejor calidad disponible.
DISPLAY_NAME = Sonarr
STARTABLE = yes
CHANGELOG = "1. Enlarge the service start/stop timeout to 90 seconds<br>2. Avoid Sonarr downgrade on package update<br>3. Implement fix for alternate TMP directory<br>4. Upgrade to Sonarr 4.0.0.87"
CHANGELOG = "Initial Sonarr v4 package with version 4.0.0.280. This package replaces a former Sonarr v3 installation (internally named nzbdrone)."

HOMEPAGE = https://sonarr.tv
LICENSE = GPLv3
Expand Down
4 changes: 1 addition & 3 deletions spk/sonarr/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ validate_prereplace ()
# check if the installed distribution is a legacy version
if [ -f "${LEGACY_SYNOPKG_PKGDEST}/share/NzbDrone/NzbDrone.exe" ]; then
# v2 installed
echo "Update from NzbDrone (Sonarr v2.x) is not supported"
exit 1
elif [ -f "${LEGACY_SYNOPKG_PKGDEST}/share/Sonarr/Sonarr.exe" ]; then
# v3 installed
Expand All @@ -38,9 +39,6 @@ validate_prereplace ()

service_prereplace ()
{
# use echo to write to the installer log file.
echo "service_prereplace ${SYNOPKG_PKG_STATUS}"

# if legacy config present, migrate to @appdata folder
mkdir -p "${CONFIG_DIR}" 2>&1
if [ -d "${LEGACY_CONFIG_DIR}/Sonarr" ]; then
Expand Down
48 changes: 48 additions & 0 deletions spk/sonarr3/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
SPK_NAME = nzbdrone
SPK_VERS = $(shell date +%Y%m%d)
SPK_REV = 21
SPK_ICON = src/sonarr.png

# Mono not supported on ppc platforms. C.f. cross/mono/Makefile and references therein for details.
UNSUPPORTED_ARCHS = $(PPC_ARCHS)

DEPENDS = cross/curl cross/mediainfo cross/sqlite cross/sonarr

SPK_DEPENDS = "mono>3.6"

MAINTAINER = SynoCommunity
DESCRIPTION = Sonarr is a PVR for newsgroup and torrent users. It can monitor multiple RSS feeds for new episodes of your favourite shows and will grab, sorts and rename them. It can also be configured to automatically upgrade the quality of files already downloaded if a better quality format becomes available.
DESCRIPTION_FRE = Sonarr est un PVR pour les utilisateurs de groupes de discussion et torrents. Il peut surveiller plusieurs flux RSS pour les nouveaux épisodes de vos séries préférées et saisira, sortes et les renomme. Il peut également être configuré pour mettre à jour automatiquement la qualité des fichiers déjà téléchargés si un meilleur format de qualité devient disponible.
DESCRIPTION_SPN = Sonarr es un PVR para los usuarios de grupos de noticias y torrents. Se puede controlar múltiples canales RSS para nuevos episodios de sus programas favoritos y se agarra, tipo y les cambia el nombre. También puede ser configurado para actualizar automáticamente la calidad de los archivos ya descargados si un formato de mejor calidad disponible.
DISPLAY_NAME = Sonarr3
STARTABLE = yes
CHANGELOG = "1. Enlarge the service start/stop timeout to 90 seconds<br>2. Avoid Sonarr downgrade on package update<br>3. Upgrade to Sonarr 3.0.9.1549<br>4. Implement fix for alternate TMP directory"

HOMEPAGE = https://sonarr.tv
LICENSE = GPLv3

SERVICE_USER = auto
SERVICE_SETUP = src/service-setup.sh
SERVICE_PORT = 8989
SERVICE_PORT_TITLE = $(DISPLAY_NAME)

# Admin link for in DSM UI
ADMIN_PORT = $(SERVICE_PORT)

WIZARDS_DIR = src/wizard/

POST_STRIP_TARGET = sonarr_extra_install

include ../../mk/spksrc.spk.mk

# use alternate TMPDIR as /tmp might be too small and not accessible on DSM >= 7.1.
USE_ALTERNATE_TMPDIR = 1

PACKAGE_VERSION = $(SPK_NAME_ARCH)-$(SPK_TCVERS)_$(SPK_VERS)-$(SPK_REV)
PACKAGE_AUTHOR = [SynoCommunity](https://synocommunity.com)

.PHONY: sonarr_extra_install
sonarr_extra_install:
install -m 755 -d $(STAGING_DIR)/var/.config/Sonarr
install -m 644 src/config.xml $(STAGING_DIR)/var/.config/Sonarr/config.xml
@echo "PackageVersion=$(PACKAGE_VERSION)\nPackageAuthor=$(PACKAGE_AUTHOR)" > $(STAGING_DIR)/share/Sonarr/package_info
7 changes: 7 additions & 0 deletions spk/sonarr3/src/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Config>
<Branch>main</Branch>
<LaunchBrowser>False</LaunchBrowser>
<UpdateAutomatically>True</UpdateAutomatically>
<UpdateMechanism>BuiltIn</UpdateMechanism>
</Config>
92 changes: 92 additions & 0 deletions spk/sonarr3/src/service-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
PATH="${SYNOPKG_PKGDEST}/bin:${PATH}"
MONO_PATH="/var/packages/mono/target/bin"
MONO="${MONO_PATH}/mono"
SONARR="${SYNOPKG_PKGDEST}/share/Sonarr/Sonarr.exe"

# Sonarr uses custom Config and PID directories
HOME_DIR="${SYNOPKG_PKGVAR}"
CONFIG_DIR="${SYNOPKG_PKGVAR}/.config"
SONARR_CONFIG_DIR="${CONFIG_DIR}/Sonarr"
PID_FILE="${SONARR_CONFIG_DIR}/sonarr.pid"

# Some have it stored in the root of package
LEGACY_CONFIG_DIR="${SYNOPKG_PKGDEST}/.config"

# workaround for mono bug with armv5 (https://github.com/mono/mono/issues/12537)
if [ "$SYNOPKG_DSM_ARCH" == "88f6281" ] || [ "$SYNOPKG_DSM_ARCH" == "88f6282" ]; then
MONO="MONO_ENV_OPTIONS='-O=-aot,-float32' ${MONO}"
fi

# for DSM < 7 only:
GROUP="sc-download"
LEGACY_GROUP="sc-media"

SERVICE_COMMAND="env PATH=${MONO_PATH}:${PATH} HOME=${HOME_DIR} LD_LIBRARY_PATH=${SYNOPKG_PKGDEST}/lib ${MONO} ${SONARR}"
SVC_BACKGROUND=y
SVC_WAIT_TIMEOUT=90

validate_preinst ()
{
# use install_log to write to installer log file.
install_log "validate_preinst ${SYNOPKG_PKG_STATUS}"

# check if the installed distribution is a legacy version
if [ -f "${SYNOPKG_PKGDEST}/share/NzbDrone/NzbDrone.exe" ]; then
# v2 installed
exit 1
fi
}

service_postinst ()
{
echo "Set update required"
# Make Sonarr do an update check on start to avoid possible Sonarr
# downgrade when synocommunity package is updated
touch "${SONARR_CONFIG_DIR}/update_required"

if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ]; then
set_unix_permissions "${CONFIG_DIR}"
fi
}

service_preupgrade ()
{
if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -ge 7 ]; then
# ensure config is in @appdata folder
if [ -d "${LEGACY_CONFIG_DIR}" ]; then
if [ "$(realpath "${LEGACY_CONFIG_DIR}")" != "$(realpath "${CONFIG_DIR}")" ]; then
echo "Move ${LEGACY_CONFIG_DIR} to ${CONFIG_DIR}"
mv "${LEGACY_CONFIG_DIR}" "${CONFIG_DIR}" 2>&1
fi
fi
fi

# never update Sonarr distribution, use internal updater only
[ -d "${SYNOPKG_TEMP_UPGRADE_FOLDER}/backup" ] && rm -rf "${SYNOPKG_TEMP_UPGRADE_FOLDER}/backup"
echo "Backup existing distribution to ${SYNOPKG_TEMP_UPGRADE_FOLDER}/backup"
mkdir -p "${SYNOPKG_TEMP_UPGRADE_FOLDER}/backup" 2>&1
rsync -aX "${SYNOPKG_PKGDEST}/share" "${SYNOPKG_TEMP_UPGRADE_FOLDER}/backup/" 2>&1
}

service_postupgrade ()
{
# restore Sonarr distribution
if [ -d "${SYNOPKG_TEMP_UPGRADE_FOLDER}/backup/share" ]; then
echo "Restore previous distribution from ${SYNOPKG_TEMP_UPGRADE_FOLDER}/backup"
rm -rf "${SYNOPKG_PKGDEST}/share/Sonarr/bin" 2>&1
# prevent overwrite of updated package_info
rsync -aX --exclude=package_info "${SYNOPKG_TEMP_UPGRADE_FOLDER}/backup/share/" "${SYNOPKG_PKGDEST}/share" 2>&1
fi

if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ]; then
set_unix_permissions "${SYNOPKG_PKGDEST}/share"
# If backup was created before new-style packages
# new updates/backups will fail due to permissions (see #3185)
if [ -d "/tmp/nzbdrone_backup" ] || [ -d "/tmp/nzbdrone_update" ] || [ -d "/tmp/sonarr_backup" ] || [ -d "/tmp/sonarr_update" ]; then
set_unix_permissions "/tmp/nzbdrone_backup"
set_unix_permissions "/tmp/nzbdrone_update"
set_unix_permissions "/tmp/sonarr_backup"
set_unix_permissions "/tmp/sonarr_update"
fi
fi
}
Binary file added spk/sonarr3/src/sonarr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions spk/sonarr3/src/wizard/install_uifile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[{
"step_title": "Updating Sonarr",
"items": [{
"desc": "The first time Sonarr is started it might take a few moments for the interface to become available!<br><br>Keep Sonarr up-to-date by using Sonarr's built-in updater.<br>Navigate to System>Updates in the Sonarr UI."
}]
},{
"step_title": "Attention! DSM Permissions",
"items": [{
"desc": "Permissions for all download-related packages are managed with the group <b>'sc-download'</b> in DSM."
}]
}]
11 changes: 11 additions & 0 deletions spk/sonarr3/src/wizard/install_uifile_fre
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[{
"step_title": "Mettre à jour Sonarr",
"items": [{
"desc": "Au premier démarrage de Sonarr cela peut prendre un moment avant que l'interface ne soit disponible !<br><br>Garder Sonarr à jour en utilisant System>Updates dans l'interface Sonarr."
}]
},{
"step_title": "Attention! Permissions DSM",
"items": [{
"desc": "Les permissions de toutes les applications de téléchargement sont gérées par le groupe <b>'sc-download'</b> dans DSM."
}]
}]
18 changes: 18 additions & 0 deletions spk/sonarr3/src/wizard/upgrade_uifile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[{
"step_title": "RECOMMENDATION: Download A Backup Before Upgrading",
"items": [{
"desc": "<strong style='color:red'>IMPORTANT:</strong> This update is an upgrade to Sonarr v3. We suggest that you download a manual backup as a precautionary measure before installing this update.<br><br>You can download a backup via Sonarr's built-in web-interface.<br>To do this, navigate to <b>System>Backup</b> in the Sonarr UI.<br><br>Create a backup and then download a copy of that backup before installing this upgrade."
}]
},{
"step_title": "Updating Sonarr",
"items": [{
"desc": "Keep Sonarr up-to-date by using Sonarr's built-in updater.<br>Navigate to <b>System>Updates</b> in the Sonarr UI."
}]
},{
"step_title": "Attention! DSM Permissions",
"items": [{
"desc": "Permissions for all download-related packages are managed with the group <b>'sc-download'</b> in DSM."
},{
"desc": "<strong style='color:red'>NOTE:</strong> The package upgrade will try to set the correct permissions on your folders. If you get permission errors within Sonarr, manually set Read/Write permissions for the 'sc-download' group on the reported folders using File Station."
}]
}]
18 changes: 18 additions & 0 deletions spk/sonarr3/src/wizard/upgrade_uifile_fre
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[{
"step_title": "RECOMMENDATION: Télécharger une sauvegarde avant la mise à niveau",
"items": [{
"desc": "<strong style='color:red'>IMPORTANT:</strong> Cette mise à jour est une mise à niveau vers Sonarr v3. Nous vous suggérons de télécharger une sauvegarde manuelle par mesure de précaution avant d'installer cette mise à jour.<br><br>Vous pouvez télécharger une sauvegarde via l'interface Web intégrée de Sonarr.<br>Pour ce faire, accédez à <b>System>Backup</b> dans l'interface utilisateur Sonarr.<br><br>Créez une sauvegarde, puis téléchargez une copie de cette sauvegarde avant d'installer cette mise à niveau."
}]
},{
"step_title": "Mettre à jour Sonarr",
"items": [{
"desc": "Garder Sonarr à jour en utilisant <b>System>Updates</b> dans l'interface Sonarr."
}]
},{
"step_title": "Attention! Permissions DSM",
"items": [{
"desc": "Les permissions de toutes les applications de téléchargement sont gérées par le groupe <b>'sc-download'</b> dans DSM."
},{
"desc": "<strong style='color:red'>NOTE:</strong> La mise à jour de l'application va tenter de corriger les permissions des répertoires. En cas d'erreur de permission dans Sonarr, donner les droits de Lecture/Ecriture au groupe 'sc-download' sur les répertoires mentionnés depuis File Station."
}]
}]

0 comments on commit cadb0e0

Please sign in to comment.