gupaxx/utils/package.sh

143 lines
6.6 KiB
Bash
Raw Permalink Normal View History

2022-11-22 18:18:18 +00:00
#!/usr/bin/env bash
START_TIME=$EPOCHSECONDS
title() { printf "\n\e[1;93m%s\e[0m\n" "============================ $1 ============================"; }
check() {
local CODE=$?
if [[ $CODE = 0 ]]; then
printf "${BASH_LINENO} | %s ... \e[1;92mOK\e[0m\n" "$1"
else
printf "${BASH_LINENO} | %s ... \e[1;91mFAIL\e[0m\n" "$1"
exit $CODE
fi
}
int() {
exit 1
}
trap 'int' INT
title "Basic checks"
# Check for needed files
[[ -d skel ]]; check "skel"
[[ -f skel/CHANGELOG.md ]]; check "skel/CHANGELOG.md"
[[ $1 = v* ]]; check "\$1 ... $1"
NEW_VER="$1"
cd skel; check "CD into skel"
# Check that [skel] directory contains everything
# and that the naming schemes are correct
title "Linux folder check"
[[ -f linux/gupaxx ]]; check "linux/gupaxx"
[[ -f linux_b/gupaxx ]]; check "linux_b/gupaxx"
[[ -f linux_b/p2pool/p2pool ]]; check "linux_b/p2pool/p2pool"
[[ -f linux_b/xmrig/xmrig ]]; check "linux_b/xmrig/xmrig"
2024-06-28 10:13:09 +00:00
[[ -f linux_b/xmrig-proxy/xmrig-proxy ]]; check "linux_b/xmrig-proxy/xmrig-proxy"
2024-10-05 16:52:18 +00:00
[[ -f linux_b/node/monerod ]]; check "linux_b/node/monerod"
2023-06-03 15:30:26 +00:00
title "macOS-x64 folder check"
[[ -d macos-x64/Gupaxx.app ]]; check "macos-x64/Gupaxx.app"
[[ -d macos-x64_b/Gupaxx.app ]]; check "macos-x64_b/Gupaxx.app"
[[ -f macos-x64_b/Gupaxx.app/Contents/MacOS/p2pool/p2pool ]]; check "macos-x64_b/p2pool/p2pool"
[[ -f macos-x64_b/Gupaxx.app/Contents/MacOS/xmrig/xmrig ]]; check "macos-x64_b/xmrig/xmrig"
2024-06-28 10:18:34 +00:00
[[ -f macos-x64_b/Gupaxx.app/Contents/MacOS/xmrig-proxy/xmrig-proxy ]]; check "macos-x64_b/xmrig-proxy/xmrig-proxy"
2024-10-09 02:47:49 +00:00
[[ -f macos-x64_b/Gupaxx.app/Contents/MacOS/node/monerod ]]; check "macos-x64_b/node/monerod"
2023-06-03 15:30:26 +00:00
title "macOS-arm64 folder check"
[[ -d macos-arm64/Gupaxx.app ]]; check "macos-arm64/Gupaxx.app"
[[ -d macos-arm64_b/Gupaxx.app ]]; check "macos-arm64_b/Gupaxx.app"
[[ -f macos-arm64_b/Gupaxx.app/Contents/MacOS/p2pool/p2pool ]]; check "macos-arm64_b/p2pool/p2pool"
[[ -f macos-arm64_b/Gupaxx.app/Contents/MacOS/xmrig/xmrig ]]; check "macos-arm64_b/xmrig/xmrig"
2024-06-28 10:08:22 +00:00
## no macos-arm64 xmrig-proxy released todo
2024-06-28 10:13:09 +00:00
# [[ -f macos-arm64_b/Gupaxx.app/Contents/MacOS/xmrig-proxy/xmrig-proxy ]]; check "macos-arm64_b/xmrig-proxy/xmrig-proxy"
2024-10-09 02:47:49 +00:00
[[ -f macos-arm64_b/Gupaxx.app/Contents/MacOS/node/monerod ]]; check "macos-arm64_b/node/monerod"
2022-11-22 18:18:18 +00:00
title "Windows folder check"
[[ -f windows/Gupaxx.exe ]]; check "windows/Gupaxx.exe"
[[ -f windows_b/Gupaxx.exe ]]; check "windows_b/Gupaxx.exe"
[[ -f windows_b/P2Pool/p2pool.exe ]]; check "windows_b/P2Pool/p2pool.exe"
[[ -f windows_b/XMRig/xmrig.exe ]]; check "windows_b/XMRig/xmrig.exe"
[[ -f windows_b/XMRig/WinRing0x64.sys ]]; check "windows_b/XMRig/WinRing0x64.sys"
2024-06-28 10:13:09 +00:00
[[ -f windows_b/XMRig-Proxy/xmrig-proxy.exe ]]; check "windows_b/XMRig-Proxy/xmrig-proxy.exe"
2024-10-09 02:47:49 +00:00
[[ -f windows_b/Node/monerod.exe ]]; check "windows_b/Node/monerod.exe"
2022-11-22 18:18:18 +00:00
# Get random date for tar/zip
title "RNG Date"
2024-05-23 15:44:54 +00:00
RNG=$((EPOCHSECONDS-RANDOM*4)); check "RNG ... $RNG"
2022-11-22 18:18:18 +00:00
DATE=$(date -d @${RNG}); check "DATE ... $DATE"
# Tar Linux Bundle
title "Tar Linux"
2024-03-25 21:55:56 +00:00
# give execution permission
chmod +x linux/gupaxx
chmod +x linux_b/gupaxx
2024-04-21 16:47:32 +00:00
chmod +x linux_b/p2pool/p2pool
chmod +x linux_b/xmrig/xmrig
2024-06-28 10:18:34 +00:00
chmod +x linux_b/xmrig-proxy/xmrig-proxy
2024-10-09 02:47:49 +00:00
chmod +x linux_b/node/monerod
mv linux_b "gupaxx-$NEW_VER-linux-x64-bundle"; check "linux -> gupaxx-$NEW_VER-linux-x64-bundle"
tar -czpf "gupaxx-${NEW_VER}-linux-x64-bundle.tar.gz" "gupaxx-$NEW_VER-linux-x64-bundle" --owner=lm --group=lm ; check "tar linux-bundle"
2022-11-22 18:18:18 +00:00
# Tar Linux Standalone
mv linux "gupaxx-$NEW_VER-linux-x64-standalone"
tar -czpf "gupaxx-${NEW_VER}-linux-x64-standalone.tar.gz" "gupaxx-$NEW_VER-linux-x64-standalone" --owner=lm --group=lm ; check "tar linux-standalone"
2022-11-22 18:18:18 +00:00
# Remove dir
rm -r "gupaxx-$NEW_VER-linux-x64-standalone"; check "rm linux dir"
rm -r "gupaxx-$NEW_VER-linux-x64-bundle"; check "rm linux_b dir"
2022-11-22 18:18:18 +00:00
2023-06-03 15:30:26 +00:00
# x64
2022-11-22 18:18:18 +00:00
# Tar macOS Bundle
2023-06-03 15:30:26 +00:00
title "Tar macOS-x64"
mv macos-x64_b "gupaxx-$NEW_VER-macos-x64-bundle"; check "macos-x64_b -> gupaxx-$NEW_VER-macos-x64-bundle"
tar -czpf "gupaxx-${NEW_VER}-macos-x64-bundle.tar.gz" "gupaxx-$NEW_VER-macos-x64-bundle" --owner=lm --group=lm ; check "tar macos-bundle"
2022-11-22 18:18:18 +00:00
# Tar macOS Standalone
mv macos-x64 "gupaxx-$NEW_VER-macos-x64-standalone"; check "macos-x64 -> gupaxx-$NEW_VER-macos-x64-standalone"
tar -czpf "gupaxx-${NEW_VER}-macos-x64-standalone.tar.gz" "gupaxx-$NEW_VER-macos-x64-standalone" --owner=lm --group=lm ; check "tar macos-x64-standalone"
2022-11-22 18:18:18 +00:00
# Remove dir
rm -r "gupaxx-$NEW_VER-macos-x64-standalone"; check "rm macos-x64 dir"
rm -r "gupaxx-$NEW_VER-macos-x64-bundle"; check "rm macos-x64_b dir"
2023-06-03 15:30:26 +00:00
# ARM
# Tar macOS Bundle
title "Tar macOS-arm64"
mv macos-arm64_b "gupaxx-$NEW_VER-macos-arm64-bundle"; check "macos-arm64_b -> gupaxx-$NEW_VER-macos-arm64-bundle"
tar -czpf "gupaxx-${NEW_VER}-macos-arm64-bundle.tar.gz" "gupaxx-$NEW_VER-macos-arm64-bundle" --owner=lm --group=lm ; check "tar macos-bundle"
2023-06-03 15:30:26 +00:00
# Tar macOS Standalone
mv macos-arm64 "gupaxx-$NEW_VER-macos-arm64-standalone"; check "macos-arm64 -> gupaxx-$NEW_VER-macos-arm64-standalone"
tar -czpf "gupaxx-${NEW_VER}-macos-arm64-standalone.tar.gz" "gupaxx-$NEW_VER-macos-arm64-standalone" --owner=lm --group=lm ; check "tar macos-arm64-standalone"
2023-06-03 15:30:26 +00:00
# Remove dir
rm -r "gupaxx-$NEW_VER-macos-arm64-standalone"; check "rm macos-arm64 dir"
rm -r "gupaxx-$NEW_VER-macos-arm64-bundle"; check "rm macos-arm64_b dir"
2022-11-22 18:18:18 +00:00
# Zip Windows Bundle
title "Zip Windows"
mv windows_b "gupaxx-$NEW_VER-windows-x64-bundle"; check "windows_b -> gupaxx-$NEW_VER-windows-x64-bundle"
zip -qr "gupaxx-${NEW_VER}-windows-x64-bundle.zip" "gupaxx-$NEW_VER-windows-x64-bundle"; check "zip windows-bundle"
2022-11-22 18:18:18 +00:00
# Zip Windows Standalone
mv windows "gupaxx-$NEW_VER-windows-x64-standalone"; check "windows -> gupaxx-$NEW_VER-windows-x64-standalone"
zip -qr "gupaxx-${NEW_VER}-windows-x64-standalone.zip" "gupaxx-$NEW_VER-windows-x64-standalone"; check "zip windows-standalone"
2022-11-22 18:18:18 +00:00
# Remove dir
rm -r "gupaxx-$NEW_VER-windows-x64-standalone"; check "rm windows dir"
rm -r "gupaxx-$NEW_VER-windows-x64-bundle"; check "rm windows_b dir"
2022-11-22 18:18:18 +00:00
# SHA256SUMS + Sign
title "Hash + Sign"
SHA256SUMS=$(sha256sum gupaxx* | gpg --clearsign --local-user 8EFFE4A8C0FD4B6D21C3AAB2EC6E5BB401C6362D); check "Hash + Sign"
2022-11-22 18:18:18 +00:00
echo "${SHA256SUMS}" > SHA256SUMS; check "Create SHA256SUMS file"
sha256sum -c SHA256SUMS; check "Verify SHA"
gpg --verify SHA256SUMS; check "Verify GPG"
# Get changelog + SHA256SUMS into clipboard
title "Clipboard"
clipboard() {
grep -B999 -m1 "^$" CHANGELOG.md
echo "## SHA256SUM & [PGP Signature](https://github.com/cyrix126/gupaxx/blob/main/pgp/cyrix126.asc)"
2022-11-22 18:18:18 +00:00
echo '```'
cat SHA256SUMS
echo '```'
}
CHANGELOG=$(clipboard); check "Create changelog + sign"
echo "$CHANGELOG" | wl-copy $clipboard
2022-11-22 18:18:18 +00:00
check "Changelog into clipboard"
# Reset timezone
title "End"
printf "\n%s\n" "package.sh ... Took [$((EPOCHSECONDS-START_TIME))] seconds ... OK!"