tachiyomi-extensions-inspector/scripts/windows-bundler.sh

84 lines
2.5 KiB
Bash
Raw Normal View History

2021-05-17 08:50:24 +02:00
#!/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/.
2021-05-24 13:07:25 +02:00
electron_version="v12.0.9"
2021-05-23 22:12:25 +02:00
if [ $1 = "win32" ]; then
jre="OpenJDK8U-jre_x86-32_windows_hotspot_8u292b10.zip"
arch="win32"
2021-05-24 13:07:25 +02:00
electron="electron-$electron_version-win32-ia32.zip"
2021-05-23 22:12:25 +02:00
else
jre="OpenJDK8U-jre_x64_windows_hotspot_8u292b10.zip"
arch="win64"
2021-05-24 13:07:25 +02:00
electron="electron-$electron_version-win32-x64.zip"
2021-05-18 19:05:57 +02:00
fi
2021-05-17 08:50:24 +02:00
2021-05-23 22:12:25 +02:00
jre_dir="jdk8u292-b10-jre"
2021-05-17 08:50:24 +02:00
echo "creating windows bundle"
jar=$(ls ../server/build/Tachidesk-*.jar)
jar_name=$(echo $jar | cut -d'/' -f4)
2021-05-23 22:12:25 +02:00
release_name=$(echo $jar_name | cut -d'.' -f4 --complement)-$arch
2021-05-17 08:50:24 +02:00
# make release dir
mkdir $release_name
2021-05-17 21:03:54 +02:00
2021-05-23 23:09:12 +02:00
echo "Dealing with jre..."
2021-05-23 22:12:25 +02:00
if [ ! -f $jre ]; then
curl -L "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/$jre" -o $jre
fi
unzip $jre
mv $jre_dir $release_name/jre
2021-05-17 08:50:24 +02:00
2021-05-23 23:09:12 +02:00
echo "Dealing with electron"
if [ ! -f $electron ]; then
2021-05-24 13:07:25 +02:00
curl -L "https://github.com/electron/electron/releases/download/$electron_version/$electron" -o $electron
2021-05-23 23:09:12 +02:00
fi
unzip $electron -d $release_name/electron
2021-05-24 13:07:25 +02:00
# change electron's icon
rcedit="rcedit-x86.exe"
if [ ! -f $rcedit ]; then
curl -L "https://github.com/electron/rcedit/releases/download/v1.1.1/$rcedit" -o $rcedit
fi
# check if running under github actions
if [ $CI = true ]; then
# change electron executable's icon
sudo dpkg --add-architecture i386
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo add-apt-repository ppa:cybermax-dexter/sdl2-backport
sudo apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu $(lsb_release -cs) main"
sudo apt install --install-recommends winehq-stable
fi
# this script assumes that wine is installed here on out
WINEARCH=win32 wine $rcedit $release_name/electron/electron.exe --set-icon ../server/src/main/resources/icon/faviconlogo.ico
2021-05-23 22:12:25 +02:00
# copy artifacts
cp $jar $release_name/Tachidesk.jar
2021-05-24 13:07:25 +02:00
#cp "resources/Tachidesk Launcher-$arch.exe" "$release_name/Tachidesk Launcher.exe"
cp "resources/Tachidesk Browser Launcher.bat" $release_name
cp "resources/Tachidesk Debug Launcher.bat" $release_name
2021-05-23 23:09:12 +02:00
cp "resources/Tachidesk Electron Launcher.bat" $release_name
2021-05-17 08:50:24 +02:00
2021-05-17 09:24:33 +02:00
zip_name=$release_name.zip
2021-05-24 13:07:25 +02:00
zip -9 -r $zip_name $release_name
2021-05-17 08:50:24 +02:00
2021-05-18 19:05:57 +02:00
rm -rf $release_name
2021-05-23 23:09:12 +02:00
# clean up from possible previous runs
if [ -f ../server/build/$zip_name ]; then
2021-05-24 13:07:25 +02:00
rm ../server/build/$zip_name
2021-05-23 23:09:12 +02:00
fi
2021-05-24 13:07:25 +02:00
mv $zip_name ../server/build/