-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
105 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,35 @@ | ||
PKG_NAME = Sonarr | ||
PKG_VERS = 3.0.5.1144 | ||
PKG_VERS = 4.0.0.87 | ||
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_DIST_NAME = $(PKG_NAME).widowmaker.$(PKG_VERS).linux-$(PKG_DIST_ARCH).$(PKG_EXT) | ||
PKG_DIST_SITE = https://download.sonarr.tv/v4/widowmaker/$(PKG_VERS) | ||
PKG_DIR = $(PKG_NAME) | ||
|
||
DEPENDS = | ||
|
||
UNSUPPORTED_ARCHS = $(i686_ARCHS) $(ARMv7L_ARCHS) $(ARMv5_ARCHS) $(PPC_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. | ||
LICENSE = GNU GPL v3 | ||
|
||
INSTALL_TARGET = sonarr_install | ||
|
||
# use digests with multiple files | ||
PKG_DIST_ARCH_LIST = x64 arm arm64 | ||
|
||
include ../../mk/spksrc.archs.mk | ||
PKG_DIST_ARCH = x64 | ||
ifeq ($(findstring $(ARCH),$(ARMv7_ARCHS)),$(ARCH)) | ||
PKG_DIST_ARCH = arm | ||
else ifeq ($(findstring $(ARCH),$(ARMv8_ARCHS)),$(ARCH)) | ||
PKG_DIST_ARCH = arm64 | ||
endif | ||
|
||
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) | ||
rm -rf $(WORK_DIR)/$(PKG_DIR)/Sonarr.Update | ||
mkdir -p $(STAGING_INSTALL_PREFIX)/share/$(PKG_DIR)/bin | ||
tar -cf - -C $(WORK_DIR)/$(PKG_DIR) . | tar -xf - -C $(STAGING_INSTALL_PREFIX)/share/$(PKG_DIR)/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
Sonarr.main.3.0.5.1144.linux.tar.gz SHA1 2335133139a46f1ce0d1b2cb1f566d30285d3d1e | ||
Sonarr.main.3.0.5.1144.linux.tar.gz SHA256 77aff6978d4dc80027979c815bd5a79579dd9bb50d39b1b2d14b3bb9e18058aa | ||
Sonarr.main.3.0.5.1144.linux.tar.gz MD5 675ce0ab2f1e643860ab1daab45b2842 | ||
Sonarr.widowmaker.4.0.0.87.linux-arm.tar.gz SHA1 c331ba587484d9407952f749d5f0a79e3ddeb9f0 | ||
Sonarr.widowmaker.4.0.0.87.linux-arm.tar.gz SHA256 9601e29c8721ce74e93eaa3d31cbee5268b31b95df534ea53d588488e660482f | ||
Sonarr.widowmaker.4.0.0.87.linux-arm.tar.gz MD5 1b75c84b80b14e2a18ea72c3f953f24e | ||
Sonarr.widowmaker.4.0.0.87.linux-arm64.tar.gz SHA1 15fbd75b7e62d81e9027e94859996efe7ad48754 | ||
Sonarr.widowmaker.4.0.0.87.linux-arm64.tar.gz SHA256 218e050b20d96655135327dac7282bef691212e99ad9ddd61038e62399671e37 | ||
Sonarr.widowmaker.4.0.0.87.linux-arm64.tar.gz MD5 ab54102a461ad4d999e47d8eb8e2a553 | ||
Sonarr.widowmaker.4.0.0.87.linux-x64.tar.gz SHA1 8e7fbe0a2b92364740a71d7e43f63ab6795b9cd0 | ||
Sonarr.widowmaker.4.0.0.87.linux-x64.tar.gz SHA256 dfdac229953f2b6d4584ea95cc570a31a7d4478a3d7db41ef000bd04921cae18 | ||
Sonarr.widowmaker.4.0.0.87.linux-x64.tar.gz MD5 38546f7562806c5d2d072b9df85950c8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,84 @@ | ||
PATH="${SYNOPKG_PKGDEST}/bin:${PATH}" | ||
MONO_PATH="/var/packages/mono/target/bin" | ||
MONO="${MONO_PATH}/mono" | ||
SONARR="${SYNOPKG_PKGDEST}/share/Sonarr/bin/Sonarr" | ||
|
||
# Sonarr uses the home directory to store it's ".config" | ||
# Sonarr uses custom Config and PID directories | ||
HOME_DIR="${SYNOPKG_PKGVAR}" | ||
CONFIG_DIR="${SYNOPKG_PKGVAR}/.config" | ||
|
||
# Sonarr v2 -> v3 compatibility: | ||
if [ -f "${SYNOPKG_PKGDEST}/share/NzbDrone/NzbDrone.exe" ]; then | ||
# v2 installed | ||
SONARR="${SYNOPKG_PKGDEST}/share/NzbDrone/NzbDrone.exe" | ||
PID_FILE="${CONFIG_DIR}/NzbDrone/nzbdrone.pid" | ||
else | ||
# v3 installed | ||
SONARR="${SYNOPKG_PKGDEST}/share/Sonarr/Sonarr.exe" | ||
PID_FILE="${CONFIG_DIR}/Sonarr/sonarr.pid" | ||
fi | ||
|
||
# Allow correct Sonarr SPK version checking (v2 or v3) | ||
if [ -f "${SYNOPKG_PKGINST_TEMP_DIR}/share/NzbDrone/NzbDrone.exe" ]; then | ||
# v2 SPK | ||
SPK_SONARR="${SYNOPKG_PKGINST_TEMP_DIR}/share/NzbDrone/NzbDrone.exe" | ||
else | ||
# v3 SPK | ||
SPK_SONARR="${SYNOPKG_PKGINST_TEMP_DIR}/share/Sonarr/Sonarr.exe" | ||
fi | ||
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" -o "$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}" | ||
SERVICE_COMMAND="env HOME=${HOME_DIR} LD_LIBRARY_PATH=${SYNOPKG_PKGDEST}/lib ${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 () | ||
{ | ||
mkdir -p ${CONFIG_DIR} | ||
set_unix_permissions "${CONFIG_DIR}" | ||
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 () | ||
{ | ||
# We have to account for legacy folder in the root | ||
# It should go, after the upgrade, into /var/.config/ | ||
# The /var/ folder gets automatically copied by service-installer after this | ||
if [ -d "${LEGACY_CONFIG_DIR}" ]; then | ||
echo "Moving ${LEGACY_CONFIG_DIR} to ${CONFIG_DIR}" | ||
mv ${LEGACY_CONFIG_DIR} ${CONFIG_DIR} >> ${INST_LOG} 2>&1 | ||
fi | ||
if [ ! -d ${CONFIG_DIR} ]; then | ||
# Create, in case it's missing for some reason | ||
mkdir -p ${CONFIG_DIR} >> ${INST_LOG} 2>&1 | ||
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 | ||
|
||
# Is Installed Sonarr Binary Ver. >= SPK Sonarr Binary Ver.? | ||
CUR_VER=$(${MONO_PATH}/monodis --assembly ${SONARR} | grep "Version:" | awk '{print $2}') | ||
echo "Installed Sonarr Binary: ${CUR_VER}" | ||
SPK_VER=$(${MONO_PATH}/monodis --assembly ${SPK_SONARR} | grep "Version:" | awk '{print $2}') | ||
echo "Requested Sonarr Binary: ${SPK_VER}" | ||
function version_compare() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; } | ||
if version_compare $CUR_VER $SPK_VER; then | ||
echo 'KEEP_CUR="yes"' > ${CONFIG_DIR}/KEEP_VAR | ||
echo "[KEEPING] Installed Sonarr Binary - Upgrading Package Only" | ||
mv ${SYNOPKG_PKGDEST}/share ${SYNOPKG_PKGVAR} | ||
else | ||
echo 'KEEP_CUR="no"' > ${CONFIG_DIR}/KEEP_VAR | ||
echo "[REPLACING] Installed Sonarr Binary" | ||
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 Current Sonarr Binary If Current Ver. >= SPK Ver. | ||
. ${CONFIG_DIR}/KEEP_VAR | ||
if [ "$KEEP_CUR" == "yes" ]; then | ||
echo "Restoring Sonarr version from before upgrade" | ||
rm -fr ${SYNOPKG_PKGDEST}/share | ||
mv ${SYNOPKG_PKGVAR}/share ${SYNOPKG_PKGDEST}/ | ||
set_unix_permissions "${SYNOPKG_PKGDEST}/share" | ||
# 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 | ||
|
||
set_unix_permissions "${CONFIG_DIR}" | ||
|
||
# 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" | ||
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 | ||
|
||
# Remove upgrade Flag | ||
rm ${CONFIG_DIR}/KEEP_VAR | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.