diff --git a/distribution/debian.sh b/distribution/debian.sh index b05c2aeff..85fa420ba 100644 --- a/distribution/debian.sh +++ b/distribution/debian.sh @@ -1,15 +1,19 @@ fromdos ./debian/* -echo Version: "$dependent_build_number" Branch: "$dependent_build_branch" + +BuildVersion=${dependent_build_number:-3.10.0.999} +BuildBranch=${dependent_build_branch:-master} + +echo Version: "$BuildVersion" Branch: "$BuildBranch" rm -r ./sonarr_bin/Sonarr.Update rm ./sonarr_bin/System.Runtime.InteropServices.RuntimeInformation.dll +rm ./sonarr_bin/UI/*.map ./sonarr_bin/UI/Content/*.map chmod -R ugo-x,ugo+rwX,go-w ./sonarr_bin/* -echo Updating changelog -sed -i "s/{version}/$dependent_build_number/g" debian/changelog -sed -i "s/{branch}/$dependent_build_branch/g" debian/changelog +echo Updating changelog for $BuildVersion +sed -i "s:{version}:$BuildVersion:g; s:{branch}:$BuildBranch:g;" debian/changelog -echo Running debuild +echo Running debuild for $BuildVersion debuild -b echo Moving stuff around @@ -18,7 +22,7 @@ mv ../sonarr_*.changes ./ rm ../sonarr_*.build echo Signing Package -dpkg-sig -k 884589CE --sign builder "sonarr_${dependent_build_number}_all.deb" +dpkg-sig -k 884589CE --sign builder "sonarr_${BuildVersion}_all.deb" echo running alien alien -r -v ./*.deb diff --git a/distribution/debian/.editorconfig b/distribution/debian/.editorconfig new file mode 100644 index 000000000..3ef3b614e --- /dev/null +++ b/distribution/debian/.editorconfig @@ -0,0 +1,7 @@ +[*] +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +end_of_line = lf +indent_style = space +indent_size = 2 diff --git a/distribution/debian/control b/distribution/debian/control index f62a824eb..10d9baab8 100644 --- a/distribution/debian/control +++ b/distribution/debian/control @@ -16,7 +16,6 @@ Architecture: all Provides: nzbdrone Conflicts: nzbdrone Replaces: nzbdrone -Depends: adduser, libsqlite3-0 (>= 3.7), libmediainfo0v5 (>= 0.7.52), mono-runtime (>= 5.4), ${shlibs:Depends}, ${cli:Depends}, ${misc:Depends} -Recommends: sqlite3 (>= 3.7), mediainfo (>= 0.7.52), ${shlibs:Recommends}, ${cli:Recommends}, ${misc:Recommends} -Suggests: ${shlibs:Suggests}, ${cli:Suggests}, ${misc:Suggests} +Depends: adduser, libsqlite3-0 (>= 3.7), libmediainfo0v5 (>= 0.7.52), mono-runtime (>= 5.4), ${cli:Depends}, ${misc:Depends} +Recommends: sqlite3 (>= 3.7), mediainfo (>= 0.7.52), ${cli:Recommends} Description: Internet PVR diff --git a/distribution/debian/postinst b/distribution/debian/postinst index 245caf3e1..ac22421f8 100644 --- a/distribution/debian/postinst +++ b/distribution/debian/postinst @@ -1,10 +1,8 @@ #!/bin/sh set -e -# Source debconf library. -. /usr/share/debconf/confmodule -SYSTEMD_UNIT=/lib/systemd/system/sonarr.service +. /usr/share/debconf/confmodule db_get sonarr/owning_user USER="$RET" db_get sonarr/owning_group @@ -20,15 +18,18 @@ if ! getent passwd "$USER" >/dev/null; then adduser --system --no-create-home --ingroup "$GROUP" "$USER" fi -# Migrate old data dir (Sonarr v3 alpha) -if [ -d "/var/opt/sonarr" ] && [ "$CONFDIR" != "/var/opt/sonarr" ]; then - if [ ! -f "/var/opt/sonarr/sonarr.db" ] && [ -f "/var/opt/sonarr/.config/Sonarr/sonarr.db" ]; then - mv "/var/opt/sonarr/.config/Sonarr" "$CONFDIR" - rm -rf "/var/opt/sonarr" - else - mv "/var/opt/sonarr" "$CONFDIR" +if [ $1 = "configure" ]; then + # Migrate old Sonarr v3 alpha data dir + if [ -d "/var/opt/sonarr" ] && [ "$CONFDIR" != "/var/opt/sonarr" ] && [ ! -d "$CONFDIR" ]; then + if [ ! -f "/var/opt/sonarr/sonarr.db" ] && [ -f "/var/opt/sonarr/.config/Sonarr/sonarr.db" ]; then + mv "/var/opt/sonarr/.config/Sonarr" "$CONFDIR" + rm -rf "/var/opt/sonarr" + else + mv "/var/opt/sonarr" "$CONFDIR" + fi + chown -R $USER:$GROUP "$CONFDIR" + chmod -R 775 "$CONFDIR" fi - chown -R $USER:$GROUP "$CONFDIR" fi # Create data directory @@ -41,7 +42,7 @@ fi 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" $SYSTEMD_UNIT +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 #DEBHELPER# diff --git a/distribution/debian/postrm b/distribution/debian/postrm index f6de262b4..f1a7facfd 100644 --- a/distribution/debian/postrm +++ b/distribution/debian/postrm @@ -1,21 +1,26 @@ #!/bin/sh set -e -if [ "$1" = "abort-install" ]; then - # preinst was aborted, possibly due to NzbDrone still running. - # Nothing to do here - : +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 # 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 +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# diff --git a/distribution/debian/rules b/distribution/debian/rules index 562b4ddd0..526fa134c 100644 --- a/distribution/debian/rules +++ b/distribution/debian/rules @@ -9,8 +9,7 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -EXCLUDE_MODULEREFS = crypt32 httpapi ntdll api-ms-win-core-sysinfo-l1-1-0 api-ms-win-core-sysinfo-l1-2-0 \ - libcurl3 msbuild +EXCLUDE_MODULEREFS = crypt32 httpapi %: dh $@ --with=systemd --with=cli diff --git a/distribution/debian/templates b/distribution/debian/templates index ef340af33..6401510b9 100644 --- a/distribution/debian/templates +++ b/distribution/debian/templates @@ -2,18 +2,19 @@ Template: sonarr/owning_user Type: string Default: sonarr Description: Sonarr user: - Specify the user that Sonarr must run as. The user will be created if it does not already exist. + Specify the user that Sonarr must run as. The user will be created if it does not already exist. Template: sonarr/owning_group Type: string Default: sonarr Description: Sonarr group: - Specify the group that Sonarr must run as. The group will be created if it does not already exist. - If the user doesn't already exist then this group will be specified as the user's primary group. - Any media files created by Sonarr will be writeable by this group. + Specify the group that Sonarr must run as. The group will be created if it does not already exist. + If the user doesn't already exist then this group will be specified 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/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. + Specify the directory where Sonarr stores the internal database and metadata. Media content will be stored elsewhere.