diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml index ac29e9795..db0443db9 100644 --- a/.github/workflows/build_push.yml +++ b/.github/workflows/build_push.yml @@ -73,7 +73,7 @@ jobs: ./windows-bundler.sh win32 ./windows-bundler.sh win64 ./unix-bundler.sh linux-x64 - ./unix-bundler.sh debian-x64 + ./debian-packager.sh ./unix-bundler.sh macOS-x64 ./unix-bundler.sh macOS-arm64 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4a6c6ea10..bff15c7e2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -64,7 +64,7 @@ jobs: ./windows-bundler.sh win32 ./windows-bundler.sh win64 ./unix-bundler.sh linux-x64 - ./unix-bundler.sh debian-x64 + ./debian-packager.sh ./unix-bundler.sh macOS-x64 ./unix-bundler.sh macOS-arm64 diff --git a/scripts/debian-packager.sh b/scripts/debian-packager.sh new file mode 100755 index 000000000..76541e941 --- /dev/null +++ b/scripts/debian-packager.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Copyright (C) Contributors to the Suwayomi project +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +echo "creating debian package" +jar=$(ls ../server/build/*.jar | tail -n1) +release_ver=$(tmp="${jar%-*}" && echo "${tmp##*-}" | tr -d v) +orig_dir="tachidesk-$release_ver" # dir uses hyphen "-" +orig_tar_gz="tachidesk_$release_ver.orig.tar.gz" # orig file uses underscore "_" +package_name="tachidesk_$release_ver-1_all.deb" + +# copy artifacts +mkdir "$orig_dir" +cp "$jar" "$orig_dir/Tachidesk.jar" +cp -r "resources/debian" "$orig_dir" +cp "resources/tachidesk-browser-launcher-standalone.sh" "$orig_dir/debian" +cp "resources/tachidesk-debug-launcher-standalone.sh" "$orig_dir/debian" +cp "resources/tachidesk-electron-launcher-standalone.sh" "$orig_dir/debian" +cp "resources/tachidesk.desktop" "$orig_dir/debian" +cp "../server/src/main/resources/icon/faviconlogo.png" "$orig_dir/debian/tachidesk.png" + +# prepare +tar cvzf "$orig_tar_gz" "$orig_dir/Tachidesk.jar" +sed -i "s/\${version}/$release_ver/" "$orig_dir/debian/changelog" + +# build +mkdir "build" +mv $orig_dir $orig_tar_gz "build/" +cd "build/$orig_dir/debian" +sudo apt install devscripts build-essential dh-exec +# --lintian-opts --profile debian: build Debian packages on Ubuntu +debuild -uc -us --lintian-opts --profile debian +cd - + +# clean build directory +mv "build/$package_name" "./" +rm -rf "build" + +# clean up from possible previous runs +if [ -f "../server/build/$package_name" ]; then + rm "../server/build/$package_name" +fi + +mv "$package_name" "../server/build/" diff --git a/scripts/resources/debian/changelog b/scripts/resources/debian/changelog index d5ebb59a1..5cb4771d2 100644 --- a/scripts/resources/debian/changelog +++ b/scripts/resources/debian/changelog @@ -1,2 +1,5 @@ tachidesk (${version}-1) unstable; urgency=medium + + * See CHANGELOG.md on https://github.com/Suwayomi/Tachidesk-Server + -- Mahor Foruzesh Fri, 14 Jan 2022 00:00:00 +0000 diff --git a/scripts/resources/debian/control b/scripts/resources/debian/control index bdf331dc7..b58b4a875 100755 --- a/scripts/resources/debian/control +++ b/scripts/resources/debian/control @@ -7,7 +7,7 @@ Standards-Version: 4.5.1 Homepage: https://github.com/Suwayomi/Tachidesk-Server Package: tachidesk -Architecture: amd64 +Architecture: all Depends: ${misc:Depends}, default-jre-headless (>= 8) Description: Manga Reader A free and open source manga reader server that runs extensions built for Tachiyomi. diff --git a/scripts/resources/debian/install b/scripts/resources/debian/install index 72c8726a1..df98c813a 100755 --- a/scripts/resources/debian/install +++ b/scripts/resources/debian/install @@ -1,9 +1,9 @@ #!/usr/bin/dh-exec -debian/tachidesk.png usr/share/pixmaps/ -debian/tachidesk.desktop usr/share/applications/ -tachidesk-browser-launcher.sh => usr/bin/tachidesk -tachidesk-browser-launcher.sh => usr/bin/tachidesk-browser -tachidesk-debug-launcher.sh => usr/bin/tachidesk-debug -tachidesk-electron-launcher.sh => usr/bin/tachidesk-electron +debian/tachidesk-browser-launcher-standalone.sh => usr/bin/tachidesk +debian/tachidesk-browser-launcher-standalone.sh => usr/bin/tachidesk-browser +debian/tachidesk-debug-launcher-standalone.sh => usr/bin/tachidesk-debug +debian/tachidesk-electron-launcher-standalone.sh => usr/bin/tachidesk-electron Tachidesk.jar => usr/share/java/tachidesk/tachidesk.jar +debian/tachidesk.png usr/share/pixmaps/ +debian/tachidesk.desktop usr/share/applications/ diff --git a/scripts/resources/tachidesk-browser-launcher-standalone.sh b/scripts/resources/tachidesk-browser-launcher-standalone.sh new file mode 100755 index 000000000..aa0b84594 --- /dev/null +++ b/scripts/resources/tachidesk-browser-launcher-standalone.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec /usr/bin/java -jar /usr/share/java/tachidesk/tachidesk.jar diff --git a/scripts/resources/tachidesk-debug-launcher-standalone.sh b/scripts/resources/tachidesk-debug-launcher-standalone.sh new file mode 100755 index 000000000..46f67ab62 --- /dev/null +++ b/scripts/resources/tachidesk-debug-launcher-standalone.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec /usr/bin/java -Dsuwayomi.tachidesk.config.server.debugLogsEnabled=true -jar /usr/share/java/tachidesk/tachidesk.jar diff --git a/scripts/resources/tachidesk-electron-launcher-standalone.sh b/scripts/resources/tachidesk-electron-launcher-standalone.sh new file mode 100755 index 000000000..3d46615fe --- /dev/null +++ b/scripts/resources/tachidesk-electron-launcher-standalone.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ ! -f /usr/bin/electron ]; then + echo "Electron executable was not found! +In order to run this launcher, you need Electron installed. + +You can install it with these commands: +sudo apt install npm +sudo npm install electron -g +" + exit 1 +fi + +exec /usr/bin/java -Dsuwayomi.tachidesk.config.server.webUIInterface=electron -Dsuwayomi.tachidesk.config.server.electronPath=/usr/bin/electron -jar /usr/share/java/tachidesk/tachidesk.jar diff --git a/scripts/unix-bundler.sh b/scripts/unix-bundler.sh index 9f69ca789..1d6a80088 100755 --- a/scripts/unix-bundler.sh +++ b/scripts/unix-bundler.sh @@ -8,7 +8,7 @@ electron_version="v14.0.0" -if [ $1 = "linux-x64" ] || [ $1 = "debian-x64" ]; then +if [ $1 = "linux-x64" ]; then jre="OpenJDK8U-jre_x64_linux_hotspot_8u302b08.tar.gz" jre_release="jdk8u302-b08" jre_url="https://github.com/adoptium/temurin8-binaries/releases/download/$jre_release/$jre" @@ -58,7 +58,7 @@ unzip $electron -d $release_name/electron # copy artifacts cp $jar $release_name/Tachidesk.jar -if [ $os = linux ] || [ $os = debian ]; then +if [ $os = linux ]; then cp "resources/tachidesk-browser-launcher.sh" $release_name cp "resources/tachidesk-debug-launcher.sh" $release_name cp "resources/tachidesk-electron-launcher.sh" $release_name @@ -75,34 +75,6 @@ if [ $os = linux ]; then elif [ $os = macOS ]; then archive_name=$release_name.zip zip -9 -r $archive_name $release_name -elif [ $os = debian ]; then - release_ver=$(tmp="${jar%-*}" && echo "${tmp##*-}" | tr -d v) - archive_name="tachidesk_$release_ver-1_amd64.deb" - orig_dir="tachidesk-$release_ver" # dir uses hyphen "-" - orig_tar_gz="tachidesk_$release_ver.orig.tar.gz" # orig file uses underscore "_" - icon="../server/src/main/resources/icon/faviconlogo.png" - - # prepare required resources - mv "$release_name" "$orig_dir" - tar cvzf $orig_tar_gz $orig_dir - - cp -r "resources/debian" "$orig_dir/" - cp "resources/tachidesk.desktop" "$orig_dir/debian/tachidesk.desktop" - cp "$icon" "$orig_dir/debian/tachidesk.png" - sed -i "s/\${version}/$release_ver/" "$orig_dir/debian/changelog" - - # build deb package - mkdir -p "build" - mv $orig_dir $orig_tar_gz "build/" - cd "build/$orig_dir/debian" - sudo apt install devscripts build-essential dh-exec - debuild -uc -us - cd - - - # clean up debuild outouts - mv "build/$archive_name" "./" - mv "build/$orig_dir" $release_name - rm -rf "build" fi rm -rf $release_name