diff --git a/build.sh b/build.sh index 5d59a8f0a..b73fca3e7 100755 --- a/build.sh +++ b/build.sh @@ -248,7 +248,7 @@ PackageTests() fi cp $outputFolder/*.dll $testPackageFolder - cp ./*.sh $testPackageFolder + cp ./test.sh $testPackageFolder echo "Creating MDBs for tests" CreateMdbs $testPackageFolder @@ -284,12 +284,21 @@ CleanupWindowsPackage() PublishArtifacts() { + ProgressStart 'Publishing Artifacts' + + # Tests echo "##teamcity[publishArtifacts '_tests/** => tests.zip']" + + # Releases echo "##teamcity[publishArtifacts '$outputFolder/** => Sonarr.$BRANCH.$BUILD_NUMBER.windows.zip!Sonarr']" echo "##teamcity[publishArtifacts '$outputFolderLinux/** => Sonarr.$BRANCH.$BUILD_NUMBER.linux.tar.gz!Sonarr']" echo "##teamcity[publishArtifacts '$outputFolderMacOS/** => Sonarr.$BRANCH.$BUILD_NUMBER.macos.tar.gz!Sonarr']" echo "##teamcity[publishArtifacts '$outputFolderMacOSApp/** => Sonarr.$BRANCH.$BUILD_NUMBER.macos.zip']" - echo "##teamcity[publishArtifacts 'debian => debian.zip/debian']" + + # Debian Package + echo "##teamcity[publishArtifacts 'distribution/** => distribution.zip']" + + ProgressEnd 'Publishing Artifacts' } # Use mono or .net depending on OS diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index eb8f841a6..000000000 --- a/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -nzbdrone {version} {branch}; urgency=low - - * Automatic Release. - - -- NzbDrone Mon, 26 Aug 2013 00:00:00 -0700 diff --git a/debian/control b/debian/control deleted file mode 100644 index ba30c02ee..000000000 --- a/debian/control +++ /dev/null @@ -1,12 +0,0 @@ -Section: web -Priority: optional -Maintainer: Sonarr -Source: nzbdrone -Homepage: https://sonarr.tv -Vcs-Git: git@github.com:Sonarr/Sonarr.git -Vcs-Browser: https://github.com/Sonarr/Sonarr - -Package: nzbdrone -Architecture: all -Depends: libmono-cil-dev (>= 3.2), sqlite3 (>= 3.7), mediainfo (>= 0.7.52) -Description: Sonarr is an internet PVR diff --git a/debian/install b/debian/install deleted file mode 100755 index 106b06a9b..000000000 --- a/debian/install +++ /dev/null @@ -1 +0,0 @@ -nzbdrone_bin/* opt/NzbDrone diff --git a/distribution/debian.sh b/distribution/debian.sh new file mode 100644 index 000000000..0d14ec424 --- /dev/null +++ b/distribution/debian.sh @@ -0,0 +1,22 @@ +fromdos ./debian/* +echo Version: "$dependent_build_number" Branch: "$dependent_build_branch" + +rm -r ./sonarr_bin/Sonarr.Update + +echo Updating changelog +sed -i "s/{version}/$dependent_build_number/g" debian/changelog +sed -i "s/{branch}/$dependent_build_branch/g" debian/changelog + +echo Running debuild +debuild -b + +echo Moving stuff around +mv ../sonarr_*.deb ./ +mv ../sonarr_*.changes ./ +rm ../sonarr_*.build + +echo Signing Package +dpkg-sig -k 884589CE --sign builder "sonarr_${dependent_build_number}_all.deb" + +echo running alien +alien -r -v ./*.deb diff --git a/distribution/debian/changelog b/distribution/debian/changelog new file mode 100644 index 000000000..e5c3c5745 --- /dev/null +++ b/distribution/debian/changelog @@ -0,0 +1,5 @@ +sonarr ({version}) {branch}; urgency=low + + * Automatic Release. + + -- Sonarr Sun, 28 Jan 2018 00:00:00 -0700 diff --git a/debian/compat b/distribution/debian/compat similarity index 100% rename from debian/compat rename to distribution/debian/compat diff --git a/distribution/debian/control b/distribution/debian/control new file mode 100644 index 000000000..02e041e2e --- /dev/null +++ b/distribution/debian/control @@ -0,0 +1,13 @@ +Section: web +Priority: optional +Maintainer: Sonarr +Source: sonarr +Homepage: https://sonarr.tv +Vcs-Git: git@github.com:Sonarr/Sonarr.git +Vcs-Browser: https://github.com/Sonarr/Sonarr + +Package: sonarr +Architecture: all +Conflicts: nzbdrone +Depends: libmono-cil-dev (>= 4.6), sqlite3 (>= 3.7), mediainfo (>= 0.7.52) +Description: Internet PVR diff --git a/debian/copyright b/distribution/debian/copyright old mode 100755 new mode 100644 similarity index 95% rename from debian/copyright rename to distribution/debian/copyright index 466d37fce..8d2f3f1d3 --- a/debian/copyright +++ b/distribution/debian/copyright @@ -1,24 +1,24 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: nzbdrone -Source: https://github.com/Sonarr/Sonarr - -Files: * -Copyright: 2010-2016 Sonarr - -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 . - . - On Debian systems, the complete text of the GNU General - Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". +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 + +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 . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". diff --git a/distribution/debian/files b/distribution/debian/files new file mode 100644 index 000000000..01702ddbb --- /dev/null +++ b/distribution/debian/files @@ -0,0 +1 @@ +sonarr_3.0.0.0_all.deb web optional diff --git a/distribution/debian/install b/distribution/debian/install new file mode 100644 index 000000000..9900a5aa4 --- /dev/null +++ b/distribution/debian/install @@ -0,0 +1,2 @@ +sonarr_bin/* /opt/sonarr +debian/sonarr.service /lib/systemd/system diff --git a/distribution/debian/postinst b/distribution/debian/postinst new file mode 100644 index 000000000..eb0c8983c --- /dev/null +++ b/distribution/debian/postinst @@ -0,0 +1,33 @@ +USER="sonarr" + +# Add User + +if ! getent passwd "$USER" >/dev/null; then + adduser --quiet --system --shell /bin/bash --home /var/opt/sonarr --group "$USER" + + if ! getent group "$USER" >/dev/null; then + groupadd "$USER" + usermod -a -G "$USER" "$USER" + fi +fi + +# Create home directory + +if [ ! -d /var/opt/sonarr ]; then + mkdir -p /var/opt/sonarr + chown $USER:$USER /var/opt/sonarr +fi + +# Set permissions on /opt/sonarr + +chown -R $USER:$USER /opt/sonarr + +# Start Sonarr automatically + +if [ -f /proc/1/comm ]; then + if [ "`cat /proc/1/comm`" = "systemd" ]; then + # Enable and start systemd service + systemctl enable sonarr.service + systemctl start sonarr.service + fi +fi diff --git a/distribution/debian/postrm b/distribution/debian/postrm new file mode 100644 index 000000000..e36cac680 --- /dev/null +++ b/distribution/debian/postrm @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# In case this system is running systemd, we make systemd reload the unit files +# to pick up changes. +if [ -d /run/systemd/system ] ; then + systemctl --system daemon-reload >/dev/null || true +fi +# End automatically added section diff --git a/distribution/debian/prerm b/distribution/debian/prerm new file mode 100644 index 000000000..6cc5f898f --- /dev/null +++ b/distribution/debian/prerm @@ -0,0 +1,6 @@ +#!/bin/sh +if [ -f /proc/1/comm ] && [ "`cat /proc/1/comm`" = "systemd" ]; then + rm -f /etc/init.d/sonarr + systemctl stop sonarr.service + systemctl disable sonarr.service +fi diff --git a/debian/rules b/distribution/debian/rules old mode 100755 new mode 100644 similarity index 100% rename from debian/rules rename to distribution/debian/rules diff --git a/distribution/debian/sonarr.service b/distribution/debian/sonarr.service new file mode 100644 index 000000000..95c0d5eea --- /dev/null +++ b/distribution/debian/sonarr.service @@ -0,0 +1,16 @@ +[Unit] +Description=Sonarr Daemon +After=network.target + +[Service] +User=sonarr +Group=sonarr + +Type=simple +ExecStart=/usr/bin/mono --debug /opt/sonarr/Sonarr.exe -nobrowser +TimeoutStopSec=20 +KillMode=process +Restart=on-failure + +[Install] +WantedBy=multi-user.target