summaryrefslogtreecommitdiff
path: root/win
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2018-06-25 19:10:41 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2018-06-25 19:10:41 +0200
commit9547df797f7a12e2410df2e4a82e3436248a282f (patch)
tree211d493674eccf986d77cb5cad01277f313d7b7e /win
parent14f278bc06ae528b1c50df81660f847c5d2ea870 (diff)
[pkg] windows installer templates
Diffstat (limited to 'win')
-rwxr-xr-xwin/INSTALL.txt4
-rwxr-xr-xwin/Makefile2
-rwxr-xr-xwin/RiseupVPN-installer.nsi111
-rwxr-xr-xwin/build.bat1
-rwxr-xr-xwin/generate.py45
-rwxr-xr-xwin/payload/install8
-rwxr-xr-xwin/payload/uninstall8
-rwxr-xr-xwin/provider.py5
-rwxr-xr-xwin/readme.txt2
-rwxr-xr-xwin/template.nsi93
10 files changed, 279 insertions, 0 deletions
diff --git a/win/INSTALL.txt b/win/INSTALL.txt
new file mode 100755
index 0000000..00f61e6
--- /dev/null
+++ b/win/INSTALL.txt
@@ -0,0 +1,4 @@
+For windows 10, you have to use this pre-release:
+* https://nssm.cc/ci/nssm-2.24-101-g897c7ad.zip
+
+(TODO check the version that is shipped via chocolatey)
diff --git a/win/Makefile b/win/Makefile
new file mode 100755
index 0000000..f8b33bb
--- /dev/null
+++ b/win/Makefile
@@ -0,0 +1,2 @@
+generate:
+ python ./generate.py
diff --git a/win/RiseupVPN-installer.nsi b/win/RiseupVPN-installer.nsi
new file mode 100755
index 0000000..fea8e60
--- /dev/null
+++ b/win/RiseupVPN-installer.nsi
@@ -0,0 +1,111 @@
+!include "MUI.nsh"
+
+Name "RiseupVPN"
+RequestExecutionLevel admin
+
+Outfile RiseupVPN-installer.exe
+;TODO make the installdir configurable - and set it in the registry.
+InstallDir "C:\Program Files\RiseupVPN\"
+
+
+!define BITMAP_FILE riseupvpn.bmp
+!define MUI_PAGE_CUSTOMFUNCTION_PRE WelcomePageSetupLinkPre
+!define MUI_PAGE_CUSTOMFUNCTION_SHOW WelcomePageSetupLinkShow
+
+; TODO fixme icons PATH
+!define MUI_ICON "riseupvpn.ico"
+!define MUI_UNICON "riseupvpn.ico"
+
+!define MUI_WELCOMEPAGE_TITLE "RiseupVPN"
+!define MUI_WELCOMEPAGE_TEXT "This will install RiseupVPN in your computer. RiseupVPN is a simple VPN Client, powered by Bitmask."
+#!define MUI_WELCOMEFINISHPAGE_BITMAP "riseup.png"
+
+!insertmacro MUI_PAGE_WELCOME
+#!insertmacro MUI_PAGE_DIRECTORY
+!insertmacro MUI_PAGE_INSTFILES
+!insertmacro MUI_PAGE_FINISH
+
+
+Function WelcomePageSetupLinkPre
+ File "..\assets\riseupvpn.png"
+ File "..\assets\riseupvpn.ico"
+
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "Numfields" "4" ; increase counter
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Bottom" "122" ; limit size of the upper label
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Type" "Link"
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Text" "https://riseup.net"
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "State" "https://riseup.net"
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Left" "120"
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Right" "315"
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Top" "123"
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Bottom" "132"
+FunctionEnd
+
+Function WelcomePageSetupLinkShow
+ ; Thanks to pengyou
+ ; Fix colors of added link control
+ ; See http://forums.winamp.com/showthread.php?s=&threadid=205674
+ Push $0
+
+ GetDlgItem $0 $MUI_HWND 1203
+ SetCtlColors $0 "0000FF" "FFFFFF"
+ ; underline font
+ CreateFont $1 "$(^Font)" "$(^FontSize)" "400" /UNDERLINE
+ SendMessage $0 ${WM_SETFONT} $1 1
+ Pop $0
+
+FunctionEnd
+
+Section "InstallFiles"
+ SetOutPath $INSTDIR
+ WriteUninstaller $INSTDIR\uninstaller.exe
+
+ File "readme.txt"
+ File "..\staging\nssm.exe"
+
+
+ File ..\staging\bitmask_helper.exe
+ File ..\staging\bitmask-systray.exe
+ File ..\staging\openssl.exe
+ File ..\staging\openvpn.exe
+ File ..\staging\ssleay32.dll
+ File ..\staging\libeay32.dll
+ File ..\staging\liblzo2-2.dll
+ File ..\staging\libpkcs11-helper-1.dll
+
+SectionEnd
+
+Section "InstallService"
+ ; TODO: make sure that this is not running before attempting
+ ; to install it.
+ ExecWait '"$INSTDIR\nssm.exe" install riseupvpn-helper "$INSTDIR\bitmask_helper.exe"'
+ ExecWait '"$INSTDIR\nssm.exe" set riseupvpn-helper AppDirectory "$INSTDIR"'
+ ExecWait '"$INSTDIR"\nssm.exe start riseupvpn-helper'
+ ; Exec cmd.exe
+
+SectionEnd
+
+Section "Uninstall"
+ ExecWait '"$INSTDIR"\nssm.exe stop riseupvpn-helper'
+ ExecWait '"$INSTDIR"\nssm.exe remove riseupvpn-helper'
+
+ Delete $INSTDIR\uninstaller.exe
+ Delete $INSTDIR\readme.txt
+ Delete $INSTDIR\nssm.exe
+
+
+ Delete $INSTDIR\bitmask_helper.exe
+ Delete $INSTDIR\bitmask-systray.exe
+ Delete $INSTDIR\openssl.exe
+ Delete $INSTDIR\openvpn.exe
+ Delete $INSTDIR\ssleay32.dll
+ Delete $INSTDIR\libeay32.dll
+ Delete $INSTDIR\liblzo2-2.dll
+ Delete $INSTDIR\libpkcs11-helper-1.dll
+
+SectionEnd
+
+;----------------------------------------
+;Languages
+
+!insertmacro MUI_LANGUAGE "English"
diff --git a/win/build.bat b/win/build.bat
new file mode 100755
index 0000000..a064db4
--- /dev/null
+++ b/win/build.bat
@@ -0,0 +1 @@
+"C:\Program Files (x86)\NSIS\makensis.exe" RiseupVPN-installer.nsi
diff --git a/win/generate.py b/win/generate.py
new file mode 100755
index 0000000..efc2108
--- /dev/null
+++ b/win/generate.py
@@ -0,0 +1,45 @@
+"""
+generate.py
+
+Generate a NSI installer for a given provider.
+"""
+
+from string import Template
+
+from provider import *
+
+
+TEMPLATE = 'template.nsi'
+INSTALLER = APP_NAME + '-installer.nsi'
+
+
+def get_files(which):
+ files = "\n"
+ if which == 'install':
+ action = "File "
+ elif which == 'uninstall':
+ action = "Delete $INSTDIR\\"
+ else:
+ action = ""
+
+ # TODO get relative path
+ for item in open('payload/' + which).readlines():
+ files += " {action}{item}".format(
+ action=action, item=item)
+ return files
+
+
+vardict = {
+ 'app_name': APP_NAME,
+ 'app_name_lower': APP_NAME.lower(),
+ 'url': URL,
+ 'extra_install_files': get_files('install'),
+ 'extra_uninstall_files': get_files('uninstall')
+}
+
+
+template = Template(open(TEMPLATE).read())
+with open(INSTALLER, 'w') as output:
+ output.write(template.safe_substitute(vardict))
+
+print("[+] NSIS installer script written to {path}".format(path=INSTALLER))
diff --git a/win/payload/install b/win/payload/install
new file mode 100755
index 0000000..2ce1159
--- /dev/null
+++ b/win/payload/install
@@ -0,0 +1,8 @@
+..\staging\bitmask_helper.exe
+..\staging\bitmask-systray.exe
+..\staging\openssl.exe
+..\staging\openvpn.exe
+..\staging\ssleay32.dll
+..\staging\libeay32.dll
+..\staging\liblzo2-2.dll
+..\staging\libpkcs11-helper-1.dll
diff --git a/win/payload/uninstall b/win/payload/uninstall
new file mode 100755
index 0000000..d49745a
--- /dev/null
+++ b/win/payload/uninstall
@@ -0,0 +1,8 @@
+bitmask_helper.exe
+bitmask-systray.exe
+openssl.exe
+openvpn.exe
+ssleay32.dll
+libeay32.dll
+liblzo2-2.dll
+libpkcs11-helper-1.dll
diff --git a/win/provider.py b/win/provider.py
new file mode 100755
index 0000000..1f94d8e
--- /dev/null
+++ b/win/provider.py
@@ -0,0 +1,5 @@
+# This is the configuration file for the generation
+# of the NSI installer.
+
+APP_NAME = "RiseupVPN"
+URL = "https://riseup.net"
diff --git a/win/readme.txt b/win/readme.txt
new file mode 100755
index 0000000..3f55159
--- /dev/null
+++ b/win/readme.txt
@@ -0,0 +1,2 @@
+This is RiseupVPN for Windows.
+Anonymous, fast and secure VPN.
diff --git a/win/template.nsi b/win/template.nsi
new file mode 100755
index 0000000..a0e4a3a
--- /dev/null
+++ b/win/template.nsi
@@ -0,0 +1,93 @@
+!include "MUI.nsh"
+
+Name "$app_name"
+RequestExecutionLevel admin
+
+Outfile $app_name-installer.exe
+;TODO make the installdir configurable - and set it in the registry.
+InstallDir "C:\Program Files\$app_name\"
+
+
+!define BITMAP_FILE riseupvpn.bmp
+!define MUI_PAGE_CUSTOMFUNCTION_PRE WelcomePageSetupLinkPre
+!define MUI_PAGE_CUSTOMFUNCTION_SHOW WelcomePageSetupLinkShow
+
+; TODO fixme icons PATH
+!define MUI_ICON "$app_name_lower.ico"
+!define MUI_UNICON "$app_name_lower.ico"
+
+!define MUI_WELCOMEPAGE_TITLE "$app_name"
+!define MUI_WELCOMEPAGE_TEXT "This will install $app_name in your computer. $app_name is a simple VPN Client, powered by Bitmask."
+#!define MUI_WELCOMEFINISHPAGE_BITMAP "riseup.png"
+
+!insertmacro MUI_PAGE_WELCOME
+#!insertmacro MUI_PAGE_DIRECTORY
+!insertmacro MUI_PAGE_INSTFILES
+!insertmacro MUI_PAGE_FINISH
+
+
+Function WelcomePageSetupLinkPre
+ File "..\assets\$app_name_lower.png"
+ File "..\assets\$app_name_lower.ico"
+
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "Numfields" "4" ; increase counter
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Bottom" "122" ; limit size of the upper label
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Type" "Link"
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Text" "$url"
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "State" "$url"
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Left" "120"
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Right" "315"
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Top" "123"
+ !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "Bottom" "132"
+FunctionEnd
+
+Function WelcomePageSetupLinkShow
+ ; Thanks to pengyou
+ ; Fix colors of added link control
+ ; See http://forums.winamp.com/showthread.php?s=&threadid=205674
+ Push $0
+
+ GetDlgItem $0 $MUI_HWND 1203
+ SetCtlColors $0 "0000FF" "FFFFFF"
+ ; underline font
+ CreateFont $1 "$(^Font)" "$(^FontSize)" "400" /UNDERLINE
+ SendMessage $0 ${WM_SETFONT} $1 1
+ Pop $0
+
+FunctionEnd
+
+Section "InstallFiles"
+ SetOutPath $INSTDIR
+ WriteUninstaller $INSTDIR\uninstaller.exe
+
+ File "readme.txt"
+ File "..\staging\nssm.exe"
+
+ $extra_install_files
+SectionEnd
+
+Section "InstallService"
+ ; TODO: make sure that this is not running before attempting
+ ; to install it.
+ ExecWait '"$INSTDIR\nssm.exe" install $app_name_lower-helper "$INSTDIR\bitmask_helper.exe"'
+ ExecWait '"$INSTDIR\nssm.exe" set $app_name_lower-helper AppDirectory "$INSTDIR"'
+ ExecWait '"$INSTDIR"\nssm.exe start $app_name_lower-helper'
+ ; Exec cmd.exe
+
+SectionEnd
+
+Section "Uninstall"
+ ExecWait '"$INSTDIR"\nssm.exe stop $app_name_lower-helper'
+ ExecWait '"$INSTDIR"\nssm.exe remove $app_name_lower-helper'
+
+ Delete $INSTDIR\uninstaller.exe
+ Delete $INSTDIR\readme.txt
+ Delete $INSTDIR\nssm.exe
+
+ $extra_uninstall_files
+SectionEnd
+
+;----------------------------------------
+;Languages
+
+!insertmacro MUI_LANGUAGE "English"