From cbf693dfb37dd7e04ec8ed588b9e0fa12d85a0fc Mon Sep 17 00:00:00 2001 From: idk Date: Sun, 30 Apr 2023 05:50:03 +0000 Subject: [PATCH] move more stuff out of makefiles and into scripts --- Makefile | 54 +++------------------------------ buildscripts/release-support.sh | 50 ++++++++++++++++++++++++++++++ buildscripts/release-torrent.sh | 16 +++++----- buildscripts/release-upload.sh | 4 +-- config.sh | 24 +++++++++++++++ makefiles/su-unsigned.mk | 35 --------------------- makefiles/su.mk | 42 ------------------------- 7 files changed, 88 insertions(+), 137 deletions(-) create mode 100644 buildscripts/release-support.sh delete mode 100644 makefiles/su-unsigned.mk delete mode 100644 makefiles/su.mk diff --git a/Makefile b/Makefile index f884790..dd7fc16 100644 --- a/Makefile +++ b/Makefile @@ -14,29 +14,19 @@ all: version install.exe fmt: find . -name '*.java' -exec clang-format -i {} \; -tag: - git tag $(PROFILE_VERSION) - version: ./buildscripts/version.sh -jpackage: version I2P build/I2P/config all +jpackage: version I2P build/I2P all help: version @echo "I2P-Easy-Install-Bundle-$(PROFILE_VERSION)" - @echo "$(SIGNER)" @echo "$(I2P_VERSION)" @echo "$(MAJOR).$(MINOR).$(BUILD)" @echo "$(preset)" -prep: - install.exe: - ./buildscripts/nsis.sh - -export RES_DIR="../i2p.i2p.jpackage-build/installer/resources" -export PKG_DIR="../i2p.i2p.jpackage-build/pkg-temp" -#export I2P_JBIGI="../i2p.i2p.jpackage-build/installer/lib/jbigi" + ./buildscripts/unsigned.sh distclean: clean rm -rf I2P @@ -45,10 +35,9 @@ I2P: ./buildscripts/build.sh build/I2P: I2P build + cp -v I2P build/I2P -src/I2P/config: - -build/I2P/config: src/I2P/config build/I2P +build/I2P: build/I2P # # Warning: a displayed license file of more than 28752 bytes @@ -65,38 +54,3 @@ build: @echo "creating build directory" mkdir -p build -include makefiles/su.mk - -include makefiles/su-unsigned.mk - -I2P_DATE=`date +%Y-%m-%d` - -MAGNET=`bttools torrent dumpinfo i2pwinupdate.su3.torrent | grep 'Magnet' | sed 's|Magnet: ||g' | sed 's|%3A|:|g'| sed 's|%2F|/|g'` -MAGNET_TESTING=`bttools torrent dumpinfo i2pwinupdate-testing.su3.torrent | grep 'MagNet' | sed 's|MagNet: ||g' | sed 's|%3A|:|g'| sed 's|%2F|/|g'` - -magnet: - echo "$(MAGNET)" - -BLANK=`awk '! NF { print NR; exit }' changelog.txt` - -I2P.zip: I2P-jpackage-windows-$(I2P_VERSION).zip - -I2P-jpackage-windows-$(I2P_VERSION).zip: - sh -c 'powershell Compress-Archive I2P I2P-jpackage-windows-$(I2P_VERSION).zip || zip I2P-jpackage-windows-$(I2P_VERSION).zip -r I2P' - -changelog: - head -n "$(BLANK)" changelog.txt - -release-jpackage: I2P-jpackage-windows-$(I2P_VERSION).zip - head -n "$(BLANK)" changelog.txt | gothub release -p -u eyedeekay -r i2p -t i2p-jpackage-windows-$(I2P_VERSION) -n i2p-jpackage-windows-$(I2P_VERSION) -d -; true - -update-release-jpackage: - head -n "$(BLANK)" changelog.txt | gothub edit -p -u eyedeekay -r i2p -t i2p-jpackage-windows-$(I2P_VERSION) -n i2p-jpackage-windows-$(I2P_VERSION) -d -; true - -delete-release-jpackage: - gothub delete -u eyedeekay -r i2p -t i2p-jpackage-windows-$(I2P_VERSION); true - -upload-release-jpackage: - gothub upload -R -u eyedeekay -r i2p -t i2p-jpackage-windows-$(I2P_VERSION) -n "i2p-jpackage-windows-$(I2P_VERSION)" -f "./I2P-jpackage-windows-$(I2P_VERSION).zip" - -jpackage-release: release-jpackage upload-release-jpackage diff --git a/buildscripts/release-support.sh b/buildscripts/release-support.sh new file mode 100644 index 0000000..5b286a9 --- /dev/null +++ b/buildscripts/release-support.sh @@ -0,0 +1,50 @@ +#! /usr/bin/env bash + +SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.. +cd "$SCRIPT_DIR" || exit 1 + +. "$SCRIPT_DIR/i2pversion" + +if [ -f i2pversion_override ]; then + . "$SCRIPT_DIR/i2pversion_override" +fi + +mv "$SCRIPT_DIR/config_override.sh" "$SCRIPT_DIR/config_override.sh.bak" +. "$SCRIPT_DIR/config.sh" + +### How to set up this script: +# +# This script will not work unless you give it a Github API key. +# You need to create a file in your $HOME directory, which on +# Windows will by /c/Users/yourusername, called github-release-config.sh, +# containing this key as the variable GITHUB_TOKEN. +# github-release-config.sh must also contain: +# GITHUB_USERNAME=your github username + +. "$HOME/github-release-config.sh" + +if [ -f ./i2pversion_override ]; then + . ./i2pversion_override +fi + +echo github-release download -u "$GITHUB_USERNAME" -r "i2p.firefox" -n "i2pwinupdate.su3" -t "$I2P_VERSION" +github-release download -u "$GITHUB_USERNAME" -r "i2p.firefox" -n "i2pwinupdate.su3" -t "$I2P_VERSION" + +echo github-release download -u "$GITHUB_USERNAME" -r "i2p.firefox" -n "i2pwinupdate.su3.torrent" -t "$I2P_VERSION" +github-release download -u "$GITHUB_USERNAME" -r "i2p.firefox" -n "i2pwinupdate.su3.torrent" -t "$I2P_VERSION" + +if [ ! -z "$I2P_SNARK_DIR" ]; then + if [ "$I2P_SNARK_DIR" = "$HOME/.i2p/i2psnark" ]; then + cp -v "i2pwinupdate.su3" "$I2P_SNARK_DIR" + cp -v "i2pwinupdate.su3.torrent" "$I2P_SNARK_DIR" + fi + if [ "$I2P_SNARK_DIR" = "$LOCALAPPDATA/i2p/i2psnark/" ]; then + cp -v "i2pwinupdate.su3" "$I2P_SNARK_DIR" + cp -v "i2pwinupdate.su3.torrent" "$I2P_SNARK_DIR" + fi + if [ "$I2P_SNARK_DIR" = "/var/lib/i2p/i2p-config/i2psnark/" ]; then + sudo cp -v "i2pwinupdate.su3" "$I2P_SNARK_DIR" + sudo cp -v "i2pwinupdate.su3.torrent" "$I2P_SNARK_DIR" + sudo chown i2psvc:i2psvc "$I2P_SNARK_DIR/i2pwinupdate.su3" "$I2P_SNARK_DIR/i2pwinupdate.su3.torrent" + fi +fi \ No newline at end of file diff --git a/buildscripts/release-torrent.sh b/buildscripts/release-torrent.sh index bce4f47..7700b69 100755 --- a/buildscripts/release-torrent.sh +++ b/buildscripts/release-torrent.sh @@ -27,14 +27,14 @@ if [ -f ./i2pversion_override ]; then . ./i2pversion_override fi -#cp -v "I2P-Easy-Install-Bundle-$I2P_VERSION.exe" "I2P-Easy-Install-Bundle-$I2P_VERSION-signed.exe" -#java -cp "$HOME/i2p/lib/*" net.i2p.crypto.SU3File sign -c ROUTER -f EXE I2P-Easy-Install-Bundle-$I2P_VERSION-signed.exe I2P-Easy-Install-Bundle-$I2P_VERSION-signed.su3 "$HOME/.i2p-plugin-keys/news-su3-keystore.ks" $I2P_VERSION $SIGNER -#rm -f i2pwinupdate.su3.torrent -#mktorrent \ -# --announce=http://tracker2.postman.i2p/announce.php \ -# --announce=http://w7tpbzncbcocrqtwwm3nezhnnsw4ozadvi2hmvzdhrqzfxfum7wa.b32.i2p/a \ -# --announce=http://mb5ir7klpc2tj6ha3xhmrs3mseqvanauciuoiamx2mmzujvg67uq.b32.i2p/a \ -# i2pwinupdate.su3 +cp -v "I2P-Easy-Install-Bundle-$I2P_VERSION.exe" "I2P-Easy-Install-Bundle-$I2P_VERSION-signed.exe" +java -cp "$I2P_LIBS/*" net.i2p.crypto.SU3File sign -c ROUTER -f EXE I2P-Easy-Install-Bundle-$I2P_VERSION-signed.exe I2P-Easy-Install-Bundle-$I2P_VERSION-signed.su3 "$HOME/.i2p-plugin-keys/news-su3-keystore.ks" $I2P_VERSION $SIGNER +rm -f i2pwinupdate.su3.torrent +mktorrent \ + --announce=http://tracker2.postman.i2p/announce.php \ + --announce=http://w7tpbzncbcocrqtwwm3nezhnnsw4ozadvi2hmvzdhrqzfxfum7wa.b32.i2p/a \ + --announce=http://mb5ir7klpc2tj6ha3xhmrs3mseqvanauciuoiamx2mmzujvg67uq.b32.i2p/a \ + i2pwinupdate.su3 ZIPCHECKSUM=$(sha256sum "i2pwinupdate.su3") echo github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "i2pwinupdate.su3" -l "$ZIPCHECKSUM" -t "$I2P_VERSION" -n "i2pwinupdate.su3" github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "i2pwinupdate.su3" -l "$ZIPCHECKSUM" -t "$I2P_VERSION" -n "i2pwinupdate.su3" diff --git a/buildscripts/release-upload.sh b/buildscripts/release-upload.sh index 89bc1ac..d501351 100755 --- a/buildscripts/release-upload.sh +++ b/buildscripts/release-upload.sh @@ -51,5 +51,5 @@ TARCHECKSUM=$(sha256sum "../i2p.i2p.jpackage-build.tar.gz") echo github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "../i2p.i2p.jpackage-build.tar.gz" -l "Upstream I2P Router source code $TARCHECKSUM" -t "$I2P_VERSION" -n "i2p.i2p.jpackage-build.tar.gz" github-release upload -R -u "$GITHUB_USERNAME" -r "i2p.firefox" -f "../i2p.i2p.jpackage-build.tar.gz" -l "Upstream I2P Router source code $TARCHECKSUM" -t "$I2P_VERSION" -n "i2p.i2p.jpackage-build.tar.gz" sh -c "powershell Compress-Archive I2P I2P-jpackage-windows-$I2P_VERSION.zip || zip I2P-jpackage-windows-$I2P_VERSION.zip -r I2P" -echo github-release upload -R -u "$GITHUB_USERNAME" -r i2p -t i2p-jpackage-windows-$I2P_VERSION -n "i2p-jpackage-windows-$I2P_VERSION" -f "./I2P-jpackage-windows-$I2P_VERSION.zip" -github-release upload -R -u "$GITHUB_USERNAME" -r i2p -t i2p-jpackage-windows-$I2P_VERSION -n "i2p-jpackage-windows-$I2P_VERSION" -f "./I2P-jpackage-windows-$I2P_VERSION.zip" +echo github-release upload -R -u "$GITHUB_USERNAME" -r i2p -t "i2p.firefox" -n "i2p-jpackage-windows-$I2P_VERSION" -f "./I2P-jpackage-windows-$I2P_VERSION.zip" +github-release upload -R -u "$GITHUB_USERNAME" -r i2p -t "i2p.firefox" -n "i2p-jpackage-windows-$I2P_VERSION" -f "./I2P-jpackage-windows-$I2P_VERSION.zip" diff --git a/config.sh b/config.sh index c9c5851..e429821 100755 --- a/config.sh +++ b/config.sh @@ -11,6 +11,30 @@ if [ -z "$SIGNER" ]; then export SIGNER=hankhill19580@gmail.com fi +if [ -z "$I2P_LIBS" ]; then + if [ -d "$HOME/i2p/lib/" ]; then + I2P_LIBS="$HOME/i2p/lib/" + fi + if [ -d "$LOCALAPPDATA/i2p/lib/" ]; then + I2P_LIBS="$LOCALAPPDATA/i2p/lib/" + fi + if [ -d "/usr/share/i2p/lib/" ]; then + I2P_LIBS="/usr/share/i2p/lib/" + fi +fi + +if [ -z "$I2P_SNARK_DIR" ]; then + if [ -d "$HOME/.i2p/i2psnark" ]; then + I2P_SNARK_DIR="$HOME/.i2p/i2psnark" + fi + if [ -d "$LOCALAPPDATA/i2p/i2psnark/" ]; then + I2P_SNARK_DIR="$LOCALAPPDATA/i2p/i2psnark/" + fi + if [ -d "/var/lib/i2p/i2p-config/i2psnark/" ]; then + I2P_SNARK_DIR="/var/lib/i2p/i2p-config/i2psnark/" + fi +fi + NSIS_PATH="/c/Program Files (x86)/NSIS/Bin" PATH="$NSIS_PATH:$PATH:$NSIS_PATH/" export PATH="$NSIS_PATH:$PATH:$NSIS_PATH/" diff --git a/makefiles/su-unsigned.mk b/makefiles/su-unsigned.mk deleted file mode 100644 index 9a1ea43..0000000 --- a/makefiles/su-unsigned.mk +++ /dev/null @@ -1,35 +0,0 @@ - -prepupdate-unsignedexe: - cp -v "I2P-Profile-Installer-$(PROFILE_VERSION).su3" i2pwinupdate-unsignedexe.su3 - -su3-unsignedexe: $(GOPATH)/src/i2pgit.org/idk/su3-tools/su3-tools - $(GOPATH)/src/i2pgit.org/idk/su3-tools/su3-tools -name "I2P-Profile-Installer-$(PROFILE_VERSION)" -signer "$(SIGNER)" -version "$(I2P_VERSION)" - java -cp "$(HOME)/i2p/lib/*" net.i2p.crypto.SU3File sign -c ROUTER -f EXE I2P-Profile-Installer-$(PROFILE_VERSION).exe I2P-Profile-Installer-$(PROFILE_VERSION)-signed.su3 "$(HOME)/.i2p-plugin-keys/news-su3-keystore.ks" "$(I2P_VERSION)" $(SIGNER) - -i2pwinupdate-unsignedexe.su3.torrent: prepupdate-unsignedexe su3-unsignedexe - mktorrent \ - --announce=http://tracker2.postman.i2p/announce.php \ - --announce=http://w7tpbzncbcocrqtwwm3nezhnnsw4ozadvi2hmvzdhrqzfxfum7wa.b32.i2p/a \ - --announce=http://mb5ir7klpc2tj6ha3xhmrs3mseqvanauciuoiamx2mmzujvg67uq.b32.i2p/a \ - i2pwinupdate-unsignedexe.su3 - -torrent-unsignedexe: i2pwinupdate-unsignedexe.su3.torrent - -testing-releases.json: torrent-unsignedexe - mkdir -p ../i2p.newsxml/data/win/testing/ - @echo "[" | tee ../i2p.newsxml/data/win/testing/releases.json - @echo " {" | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo " \"date\": \"$(I2P_DATE)\"," | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo " \"version\": \"$(I2P_VERSION)\"," | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo " \"minVersion\": \"1.5.0\"," | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo " \"minJavaVersion\": \"1.8\"," | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo " \"updates\": {" | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo " \"su3\": {" | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo " \"torrent\": \"$(MAGNET_TESTING)\"," | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo " \"url\": [" | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo " \"http://ekm3fu6fr5pxudhwjmdiea5dovc3jdi66hjgop4c7z7dfaw7spca.b32.i2p/i2pwinupdate.su3\"" | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo " ]" | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo " }" | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo " }" | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo " }" | tee -a ../i2p.newsxml/data/win/testing/releases.json - @echo "]" | tee -a ../i2p.newsxml/data/win/testing/releases.json diff --git a/makefiles/su.mk b/makefiles/su.mk deleted file mode 100644 index 245f049..0000000 --- a/makefiles/su.mk +++ /dev/null @@ -1,42 +0,0 @@ -GOPATH=$(HOME)/go - -$(GOPATH)/src/i2pgit.org/idk/su3-tools/su3-tools: - git clone https://i2pgit.org/idk/su3-tools $(GOPATH)/src/i2pgit.org/idk/su3-tools; true - git pull --all - cd $(GOPATH)/src/i2pgit.org/idk/su3-tools && \ - go mod vendor && go build - -prepupdate: - cp -v "I2P-Easy-Install-Bundle-$(PROFILE_VERSION)-signed.su3" i2pwinupdate.su3 - -su3: $(GOPATH)/src/i2pgit.org/idk/su3-tools/su3-tools - cp -v "I2P-Easy-Install-Bundle-$(PROFILE_VERSION).exe" "I2P-Easy-Install-Bundle-$(PROFILE_VERSION)-signed.exe" - $(GOPATH)/src/i2pgit.org/idk/su3-tools/su3-tools -name "I2P-Easy-Install-Bundle-$(PROFILE_VERSION)-signed" -signer "$(SIGNER)" -version "$(PROFILE_VERSION)" - java -cp "$(HOME)/i2p/lib/*" net.i2p.crypto.SU3File sign -c ROUTER -f EXE I2P-Easy-Install-Bundle-$(PROFILE_VERSION)-signed.exe I2P-Easy-Install-Bundle-$(PROFILE_VERSION)-signed.su3 "$(HOME)/.i2p-plugin-keys/news-su3-keystore.ks" $(PROFILE_VERSION) $(SIGNER) - -i2pwinupdate.su3.torrent: prepupdate su3 - mktorrent \ - --announce=http://tracker2.postman.i2p/announce.php \ - --announce=http://w7tpbzncbcocrqtwwm3nezhnnsw4ozadvi2hmvzdhrqzfxfum7wa.b32.i2p/a \ - --announce=http://mb5ir7klpc2tj6ha3xhmrs3mseqvanauciuoiamx2mmzujvg67uq.b32.i2p/a \ - i2pwinupdate.su3 - -torrent: i2pwinupdate.su3.torrent - -releases.json: - @echo "[" | tee ../i2p.newsxml/data/win/beta/releases.json - @echo " {" | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo " \"date\": \"$(I2P_DATE)\"," | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo " \"version\": \"$(PROFILE_VERSION)\"," | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo " \"minVersion\": \"1.5.0\"," | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo " \"minJavaVersion\": \"1.8\"," | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo " \"updates\": {" | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo " \"su3\": {" | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo " \"torrent\": \"$(MAGNET)\"," | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo " \"url\": [" | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo " \"http://ekm3fu6fr5pxudhwjmdiea5dovc3jdi66hjgop4c7z7dfaw7spca.b32.i2p/i2pwinupdate.su3\"" | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo " ]" | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo " }" | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo " }" | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo " }" | tee -a ../i2p.newsxml/data/win/beta/releases.json - @echo "]" | tee -a ../i2p.newsxml/data/win/beta/releases.json