From 05bc3260b9c958a72096e7a28956f4666bd65603 Mon Sep 17 00:00:00 2001 From: kali Date: Tue, 26 Jun 2018 23:15:27 +0200 Subject: [pkg] fix service run on install --- win/RiseupVPN-installer.nsi | 31 +++++++++++++++++++------------ win/payload/uninstall | 5 +++-- win/template.nsi | 26 ++++++++++++++++---------- 3 files changed, 38 insertions(+), 24 deletions(-) (limited to 'win') diff --git a/win/RiseupVPN-installer.nsi b/win/RiseupVPN-installer.nsi index 35a72b0..3561c57 100755 --- a/win/RiseupVPN-installer.nsi +++ b/win/RiseupVPN-installer.nsi @@ -3,7 +3,7 @@ Name "RiseupVPN" RequestExecutionLevel admin -Outfile RiseupVPN-installer.exe +Outfile "..\dist\RiseupVPN-installer.exe" ;TODO make the installdir configurable - and set it in the registry. InstallDir "C:\Program Files\RiseupVPN\" @@ -12,7 +12,6 @@ InstallDir "C:\Program Files\RiseupVPN\" !define MUI_PAGE_CUSTOMFUNCTION_PRE WelcomePageSetupLinkPre !define MUI_PAGE_CUSTOMFUNCTION_SHOW WelcomePageSetupLinkShow -; TODO fixme icons PATH !define MUI_ICON "..\assets\riseupvpn.ico" !define MUI_UNICON "..\assets\riseupvpn.ico" @@ -58,10 +57,15 @@ FunctionEnd Section "InstallFiles" SetOutPath $INSTDIR - WriteUninstaller $INSTDIR\uninstaller.exe + WriteUninstaller $INSTDIR\uninstall.exe + + ;Start Menu + createDirectory "$SMPROGRAMS\RiseupVPN\" + createShortCut "$SMPROGRAMS\RiseupVPN\RiseupVPN.lnk" "$INSTDIR\bitmask-systray.exe" "" "$INSTDIR\riseupvpn.ico" File "readme.txt" File "..\staging\nssm.exe" + File "..\assets\riseupvpn.ico" File ..\staging\bitmask_helper.exe @@ -73,38 +77,41 @@ Section "InstallFiles" 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. + ; Easy service management thanks to nssm + ExecWait '"$INSTDIR\nssm.exe" remove riseupvpn-helper confirm' 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 + ExecWait '"$INSTDIR\nssm.exe" start riseupvpn-helper' SectionEnd Section "Uninstall" ExecWait '"$INSTDIR"\nssm.exe stop riseupvpn-helper' - ExecWait '"$INSTDIR"\nssm.exe remove riseupvpn-helper' + ExecWait '"$INSTDIR"\nssm.exe remove riseupvpn-helper confirm' - Delete $INSTDIR\uninstaller.exe Delete $INSTDIR\readme.txt Delete $INSTDIR\nssm.exe - Delete $INSTDIR\bitmask_helper.exe - Delete $INSTDIR\bitmask-systray.exe + Delete $INSTDIR\riseupvpn.ico 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 + Delete $INSTDIR\bitmask_helper.exe + Delete $INSTDIR\bitmask-systray.exe + + ; uninstaller must be always the last thing to remove + Delete $INSTDIR\uninstall.exe SectionEnd - + ;---------------------------------------- ;Languages diff --git a/win/payload/uninstall b/win/payload/uninstall index d49745a..ad3c6b4 100755 --- a/win/payload/uninstall +++ b/win/payload/uninstall @@ -1,8 +1,9 @@ -bitmask_helper.exe -bitmask-systray.exe +riseupvpn.ico openssl.exe openvpn.exe ssleay32.dll libeay32.dll liblzo2-2.dll libpkcs11-helper-1.dll +bitmask_helper.exe +bitmask-systray.exe diff --git a/win/template.nsi b/win/template.nsi index 0c92684..009be7b 100755 --- a/win/template.nsi +++ b/win/template.nsi @@ -3,7 +3,7 @@ Name "$app_name" RequestExecutionLevel admin -Outfile $app_name-installer.exe +Outfile "..\dist\$app_name-installer.exe" ;TODO make the installdir configurable - and set it in the registry. InstallDir "C:\Program Files\$app_name\" @@ -12,7 +12,6 @@ InstallDir "C:\Program Files\$app_name\" !define MUI_PAGE_CUSTOMFUNCTION_PRE WelcomePageSetupLinkPre !define MUI_PAGE_CUSTOMFUNCTION_SHOW WelcomePageSetupLinkShow -; TODO fixme icons PATH !define MUI_ICON "..\assets\$app_name_lower.ico" !define MUI_UNICON "..\assets\$app_name_lower.ico" @@ -58,35 +57,42 @@ FunctionEnd Section "InstallFiles" SetOutPath $INSTDIR - WriteUninstaller $INSTDIR\uninstaller.exe + 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" - ; TODO: make sure that this is not running before attempting - ; to install it. + ; 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' - ; Exec cmd.exe + ExecWait '"$INSTDIR\nssm.exe" start $app_name_lower-helper' SectionEnd Section "Uninstall" ExecWait '"$INSTDIR"\nssm.exe stop $app_name_lower-helper' - ExecWait '"$INSTDIR"\nssm.exe remove $app_name_lower-helper' + ExecWait '"$INSTDIR"\nssm.exe remove $app_name_lower-helper confirm' - Delete $INSTDIR\uninstaller.exe 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 - + ;---------------------------------------- ;Languages -- cgit v1.2.3