SetCompressor /SOLID lzma !define PRODUCT_PUBLISHER "LEAP Encryption Access Project" !include "MUI2.nsh" Name "$app_name" Outfile "..\dist\$app_name-$version.exe" ;TODO make the installdir configurable - and set it in the registry. InstallDir "C:\Program Files\$app_name\" RequestExecutionLevel admin !include FileFunc.nsh !insertmacro GetParameters !insertmacro GetOptions ;Macros !macro SelectByParameter SECT PARAMETER DEFAULT ${GetOptions} $R0 "/${PARAMETER}=" $0 ${If} ${DEFAULT} == 0 ${If} $0 == 1 !insertmacro SelectSection ${SECT} ${EndIf} ${Else} ${If} $0 != 0 !insertmacro SelectSection ${SECT} ${EndIf} ${EndIf} !macroend !define BITMAP_FILE riseupvpn.bmp !define MUI_ICON "..\assets\$app_name_lower.ico" !define MUI_UNICON "..\assets\$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, fast and secure VPN Client, powered by Bitmask. \n This VPN service is run by donations from people like you." #!define MUI_WELCOMEFINISHPAGE_BITMAP "riseup.png" !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH Section "InstallFiles" SetOutPath $INSTDIR WriteUninstaller $INSTDIR\uninstall.exe ;Start Menu createDirectory "$SMPROGRAMS\$app_name\" createShortCut "$SMPROGRAMS\$app_name\$app_name.lnk" "$INSTDIR\bitmask-systray.exe" "" "$INSTDIR\$app_name_lower.ico" File "readme.txt" File "..\staging\nssm.exe" File "..\assets\$app_name_lower.ico" $extra_install_files SectionEnd Section "InstallService" ; Easy service management thanks to nssm ExecWait '"$INSTDIR\nssm.exe" remove $app_name_lower-helper confirm' 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' ; why are these here? Delete "C:\$app_name_lower.ico" Delete "C:\$app_name_lower.png" SectionEnd Section /o "TAP Virtual Ethernet Adapter" SecTAP ; Adapted from the windows nsis installer from OpenVPN (openvpn-build repo). DetailPrint "Installing TAP (may need confirmation)..." ExecWait '"$INSTDIR\tap-windows.exe" /SELECT_UTILITIES=1' ;Making it explicit for now. It looks like the /S flag is "silent", isn't it? ;ExecWait '"$INSTDIR\tap-windows.exe" /S /SELECT_UTILITIES=1' Pop $R0 # return value/error/timeout WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$app_name" "tap" "installed" DetailPrint "TAP installed!" SectionEnd Section "Uninstall" ExecWait '"$INSTDIR"\nssm.exe stop $app_name_lower-helper' ExecWait '"$INSTDIR"\nssm.exe remove $app_name_lower-helper confirm' Delete $INSTDIR\readme.txt Delete $INSTDIR\nssm.exe $extra_uninstall_files ; uninstaller must be always the last thing to remove Delete $INSTDIR\uninstall.exe SectionEnd Function .onInit !insertmacro SelectByParameter ${SecTAP} SELECT_TAP 1 FunctionEnd ;---------------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English"