From 1baae54523d2f1f9564095b318da29127a99cd7d Mon Sep 17 00:00:00 2001 From: idk Date: Tue, 13 Apr 2021 17:17:10 -0400 Subject: [PATCH 1/5] Includable NSIS installer script and example --- bin/i2p-zero.nsi | 35 ++++++++++++++++++++++++++++++++ bin/nsis-example.nsi | 48 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 bin/i2p-zero.nsi create mode 100644 bin/nsis-example.nsi diff --git a/bin/i2p-zero.nsi b/bin/i2p-zero.nsi new file mode 100644 index 0000000..7968523 --- /dev/null +++ b/bin/i2p-zero.nsi @@ -0,0 +1,35 @@ + +!define ZERONAME "I2P-Zero" +!define I2PINSTDIR "$PROGRAMFILES64\${APPNAME}\" + +function buildZero + !system "echo '#! /usr/bin/env sh' > build-docker.sh" + !system "echo 'docker rm -f i2p-zero-build' >> build-docker.sh" + !system "echo 'docker run -td --name i2p-zero-build --rm ubuntu' >> build-docker.sh" + !system "echo 'docker exec -ti i2p-zero-build bash -c ;' >> build-docker.sh" + !system "echo ' apt-get update && ' >> build-docker.sh" + !system "echo ' apt-get -y install git wget zip unzip && ' >> build-docker.sh" + !system "echo ' git clone https://github.com/i2p-zero/i2p-zero.git && ' >> build-docker.sh" + !system "echo ' cd i2p-zero && bash bin/build-all-and-zip.sh;' >> build-docker.sh" + !system "echo 'docker cp i2p-zero-build:/i2p-zero/dist-zip' ./ >> build-docker.sh" + !system "echo 'docker container stop i2p-zero-build' >> build-docker.sh" + !system "sed -i $\"s|;|'|g$\" build-docker.sh" + !system "chmod +x build-docker.sh" + !system ./build-docker.sh + !system "unzip dist-zip/i2p-zero-win-gui.*.zip" + !system "mv i2p-zero-win-gui.* I2P-Zero" +functionEnd + +function installZero + CreateShortcut "$SMPROGRAMS\Run I2P-Zero.lnk" "$I2PINSTDIR\router\i2p-zero.exe" + + SetOutPath $I2PINSTDIR + File /a /r "./I2P-Zero/" + +functionEnd + +function uninstallZero + Delete "$SMPROGRAMS\Run I2P-Zero.lnk" + RMDir $INSTDIR + +functionEnd \ No newline at end of file diff --git a/bin/nsis-example.nsi b/bin/nsis-example.nsi new file mode 100644 index 0000000..46edb8b --- /dev/null +++ b/bin/nsis-example.nsi @@ -0,0 +1,48 @@ +UniCode true + +# define name of installer +OutFile "../I2P-Zero-installer.exe" + +# define installation directory +!define APPNAME "I2P-Zero" +InstallDir "$PROGRAMFILES64\${APPNAME}\" + +!define LICENSE_TITLE "BSD 3-Clause License" +PageEx license + licensetext "${LICENSE_TITLE}" + licensedata "../LICENSE" +PageExEnd +Page instfiles + +# For removing Start Menu shortcut in Windows 7 +RequestExecutionLevel admin + +!include i2p-zero.nsi + +# start default section +Section + + # Call the function that builds an I2P-Zero in the current directory + Call buildZero + # Call the function that installs I2P-Zero + Call installZero + + # create the uninstaller + WriteUninstaller "$INSTDIR\uninstall.exe" +# end default section +SectionEnd + +# uninstaller section start +Section "uninstall" + + # Call the function that un-installs I2P-Zero + Call uninstallZero + + # first, delete the uninstaller + Delete "$INSTDIR\uninstall.exe" + + Delete "$SMPROGRAMS\Run I2P-Zero.lnk" + + RMDir $INSTDIR +# uninstaller section end +SectionEnd \ No newline at end of file From e85549ef1f7563efadf5ff33a7b93034da1ed4ab Mon Sep 17 00:00:00 2001 From: idk Date: Tue, 13 Apr 2021 17:30:45 -0400 Subject: [PATCH 2/5] Includable NSIS installer script and example --- bin/i2p-zero.nsi | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/bin/i2p-zero.nsi b/bin/i2p-zero.nsi index 7968523..44f4930 100644 --- a/bin/i2p-zero.nsi +++ b/bin/i2p-zero.nsi @@ -1,6 +1,8 @@ !define ZERONAME "I2P-Zero" -!define I2PINSTDIR "$PROGRAMFILES64\${APPNAME}\" +!define I2P64INSTDIR "$PROGRAMFILES64\I2P\" +!define I2P32INSTDIR "$PROGRAMFILES32\I2P\" +!define ZEROINSTDIR "$PROGRAMFILES64\${APPNAME}\" function buildZero !system "echo '#! /usr/bin/env sh' > build-docker.sh" @@ -21,10 +23,19 @@ function buildZero functionEnd function installZero - CreateShortcut "$SMPROGRAMS\Run I2P-Zero.lnk" "$I2PINSTDIR\router\i2p-zero.exe" + ${If} ${FileExists} `$I2P64INSTDIR\I2P.exe` + + ${If} ${FileExists} `$I2P32INSTDIR\I2P.exe` + + ${Else} + SetOutPath $ZEROINSTDIR + File /a /r "./I2P-Zero/" + + CreateShortcut "$SMPROGRAMS\Run I2P-Zero.lnk" "$ZEROINSTDIR\router\i2p-zero.exe" + ${EndIf} + + - SetOutPath $I2PINSTDIR - File /a /r "./I2P-Zero/" functionEnd From 137eed7a31fe7e966e307004fe534ad94a0d3985 Mon Sep 17 00:00:00 2001 From: idk Date: Tue, 13 Apr 2021 17:34:10 -0400 Subject: [PATCH 3/5] Includable NSIS installer script and example --- bin/nsis-example.nsi | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/nsis-example.nsi b/bin/nsis-example.nsi index 46edb8b..7fc1409 100644 --- a/bin/nsis-example.nsi +++ b/bin/nsis-example.nsi @@ -17,6 +17,7 @@ Page instfiles # For removing Start Menu shortcut in Windows 7 RequestExecutionLevel admin +# Include the i2p-zero.nsi script !include i2p-zero.nsi # start default section From bc08ea5e0e6caf4d19b058462a412144c5d8e905 Mon Sep 17 00:00:00 2001 From: idk Date: Tue, 13 Apr 2021 17:49:49 -0400 Subject: [PATCH 4/5] Includable NSIS installer script and example --- bin/i2p-zero.nsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/i2p-zero.nsi b/bin/i2p-zero.nsi index 44f4930..f9c4f8a 100644 --- a/bin/i2p-zero.nsi +++ b/bin/i2p-zero.nsi @@ -24,9 +24,9 @@ functionEnd function installZero ${If} ${FileExists} `$I2P64INSTDIR\I2P.exe` - + SetOutPath $ZEROINSTDIR ${If} ${FileExists} `$I2P32INSTDIR\I2P.exe` - + SetOutPath $ZEROINSTDIR ${Else} SetOutPath $ZEROINSTDIR File /a /r "./I2P-Zero/" From ba3e8d246d0437537b42608b91ed1f002ce83a49 Mon Sep 17 00:00:00 2001 From: idk Date: Tue, 13 Apr 2021 18:04:01 -0400 Subject: [PATCH 5/5] Remove unpacked NSIS-installable directory before copying artifact directory --- bin/i2p-zero.nsi | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/i2p-zero.nsi b/bin/i2p-zero.nsi index f9c4f8a..890a36d 100644 --- a/bin/i2p-zero.nsi +++ b/bin/i2p-zero.nsi @@ -19,6 +19,7 @@ function buildZero !system "chmod +x build-docker.sh" !system ./build-docker.sh !system "unzip dist-zip/i2p-zero-win-gui.*.zip" + !system "rm -rf I2P-Zero" !system "mv i2p-zero-win-gui.* I2P-Zero" functionEnd @@ -34,9 +35,6 @@ function installZero CreateShortcut "$SMPROGRAMS\Run I2P-Zero.lnk" "$ZEROINSTDIR\router\i2p-zero.exe" ${EndIf} - - - functionEnd function uninstallZero