mirror of
https://github.com/Sonarr/Sonarr
synced 2025-01-03 05:35:29 +00:00
Added support to handle the BuiltIn Updater for 3.0.1 packages.
This commit is contained in:
parent
fb6e4c0130
commit
b7259e3ebb
5 changed files with 96 additions and 1 deletions
|
@ -1,7 +1,11 @@
|
|||
fromdos ./debian/*
|
||||
cp -r ./debian ./debian_backup
|
||||
|
||||
BuildVersion=${dependent_build_number:-3.10.0.999}
|
||||
BuildBranch=${dependent_build_branch:-master}
|
||||
BootstrapVersion=`echo "$BuildVersion" | cut -d. -f1,2,3`
|
||||
BootstrapUpdater="BuiltIn"
|
||||
PackageUpdater="apt"
|
||||
|
||||
echo Version: "$BuildVersion" Branch: "$BuildBranch"
|
||||
|
||||
|
@ -12,10 +16,27 @@ 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\nReleaseVersion=$BuildVersion\nBranch=$BuildBranch" > release_info
|
||||
echo "# Do Not Edit\nPackageVersion=$BuildVersion\nReleaseVersion=$BuildVersion\nUpdateMethod=$PackageUpdater\nBranch=$BuildBranch" > package_info
|
||||
|
||||
echo Running debuild for $BuildVersion
|
||||
debuild -b
|
||||
|
||||
# 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\nReleaseVersion=$BuildVersion\nUpdateMethod=$BootstrapUpdater\nBranch=$BuildBranch" > package_info
|
||||
|
||||
echo Running debuild for $BootstrapVersion
|
||||
debuild -b
|
||||
|
||||
echo Moving stuff around
|
||||
mv ../sonarr_*.deb ./
|
||||
mv ../sonarr_*.changes ./
|
||||
|
@ -23,6 +44,7 @@ rm ../sonarr_*.build
|
|||
|
||||
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
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
sonarr_bin/* /usr/lib/sonarr/bin
|
||||
release_info /usr/lib/sonarr/bin
|
||||
package_info /usr/lib/sonarr
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
BUILD_VERSION={version}
|
||||
UPDATER={updater}
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
db_get sonarr/owning_user
|
||||
|
@ -38,12 +40,41 @@ if [ ! -d "$CONFDIR" ]; then
|
|||
chown -R $USER:$GROUP "$CONFDIR"
|
||||
fi
|
||||
|
||||
#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=sonarr:User=$USER:g; s:Group=sonarr:Group=$GROUP:g; s:-data=/var/lib/sonarr:-data=$CONFDIR:g" /lib/systemd/system/sonarr.service
|
||||
|
||||
#BEGIN BUILTIN UPDATER
|
||||
if [ $1 = "upgrade" ] && [ "$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,6 +1,9 @@
|
|||
#!/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
|
||||
|
@ -12,6 +15,13 @@ 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
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
BUILD_VERSION={version}
|
||||
UPDATER={updater}
|
||||
|
||||
# Deal with existing nzbdrone installs
|
||||
#
|
||||
# Any existing nzbdrone package would already be in de deconfigured stage, so the binaries are gone.
|
||||
|
@ -19,6 +22,33 @@ if [ $1 = "install" ]; then
|
|||
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
|
Loading…
Reference in a new issue