mirror of https://github.com/OpenVPN/openvpn-gui
Browse Source
'make installer' will now spit out an openvpn-gui-installer.exe. The location of the required makensis tool can be specified by appending MAKENSIS=/path/to/makensis to the configure command line. Otherwise it's searched for in your $PATH. The installer target is only available when makensis is available.pull/1/head
Heiko Hund
11 years ago
4 changed files with 275 additions and 1 deletions
@ -0,0 +1,14 @@
|
||||
LangString NAME_SecOverwriteConfiguration ${LANG_ENGLISH} "Overwrite configuration" |
||||
LangString DESC_SecOverwriteConfiguration ${LANG_ENGLISH} "Overwrite previous user-defined ${PACKAGE_NAME} configuration with default values" |
||||
LangString NAME_AddRegistryKeys ${LANG_ENGLISH} "Add registry keys" |
||||
LangString DESC_AddRegistryKeys ${LANG_ENGLISH} "Add OpenVPN-GUI-specific registry keys" |
||||
LangString NAME_SecInstallExecutable ${LANG_ENGLISH} "Install ${PACKAGE_NAME}" |
||||
LangString DESC_SecInstallExecutable ${LANG_ENGLISH} "Install ${PACKAGE_NAME} executable" |
||||
LangString NAME_SecInstallDocumentation ${LANG_ENGLISH} "Install documentation" |
||||
LangString DESC_SecInstallDocumentation ${LANG_ENGLISH} "Install documentation" |
||||
LangString NAME_SecInstallDesktopIcon ${LANG_ENGLISH} "Install desktop icon" |
||||
LangString DESC_SecInstallDesktopIcon ${LANG_ENGLISH} "Install ${PACKAGE_NAME} desktop icon" |
||||
LangString NAME_SecAddStartMenuEntries ${LANG_ENGLISH} "Add start menu entries" |
||||
LangString DESC_SecAddStartMenuEntries ${LANG_ENGLISH} "Add start menu entries for installed components" |
||||
LangString NAME_DeleteAllRegistryKeys ${LANG_ENGLISH} "Delete all registry keys" |
||||
LangString DESC_DeleteAllRegistryKeys ${LANG_ENGLISH} "Delete all registry keys related to OpenVPN-GUI" |
@ -0,0 +1,235 @@
|
||||
; **************************************************************************** |
||||
; * Copyright (C) 2013 OpenVPN Technologies, Inc. * |
||||
; * This program is free software; you can redistribute it and/or modify * |
||||
; * it under the terms of the GNU General Public License version 2 * |
||||
; * as published by the Free Software Foundation. * |
||||
; **************************************************************************** |
||||
|
||||
SetCompressor lzma |
||||
|
||||
; Includes |
||||
!include "LogicLib.nsh" |
||||
!include "MultiUser.nsh" |
||||
!include "MUI2.nsh" |
||||
|
||||
; Defines |
||||
!define MULTIUSER_EXECUTIONLEVEL Admin |
||||
!define PACKAGE_NAME "OpenVPN-GUI" |
||||
!define REG_KEY "HKLM Software\OpenVPN-GUI" |
||||
|
||||
; Basic configuration |
||||
Name "OpenVPN-GUI ${VERSION}" |
||||
OutFile "..\openvpn-gui-installer.exe" |
||||
RequestExecutionLevel admin |
||||
ShowInstDetails show |
||||
|
||||
; Default installation directory. Needed for silent installations. Will get |
||||
; overwritten in the function .onInit |
||||
InstallDir "$PROGRAMFILES\${PACKAGE_NAME}" |
||||
|
||||
; Installer pages |
||||
!insertmacro MUI_PAGE_LICENSE "..\COPYRIGHT.GPL" |
||||
!insertmacro MUI_PAGE_COMPONENTS |
||||
!insertmacro MUI_PAGE_DIRECTORY |
||||
!insertmacro MUI_PAGE_INSTFILES |
||||
|
||||
; Uninstaller pages |
||||
!insertmacro MUI_UNPAGE_COMPONENTS |
||||
!insertmacro MUI_UNPAGE_INSTFILES |
||||
|
||||
Function .onInit |
||||
|
||||
SetShellVarContext all |
||||
|
||||
; Check if we're running on 64-bit Windows |
||||
${If} "${ARCH}" == "x86_64" |
||||
SetRegView 64 |
||||
|
||||
; Change the installation directory to C:\Program Files, but only if the |
||||
; user has not provided a custom install location. |
||||
${If} "$INSTDIR" == "$PROGRAMFILES\${PACKAGE_NAME}" |
||||
StrCpy $INSTDIR "$PROGRAMFILES64\${PACKAGE_NAME}" |
||||
${EndIf} |
||||
${EndIf} |
||||
|
||||
FunctionEnd |
||||
|
||||
Function un.onInit |
||||
ClearErrors |
||||
!insertmacro MULTIUSER_UNINIT |
||||
SetShellVarContext all |
||||
${If} "${ARCH}" == "x86_64" |
||||
SetRegView 64 |
||||
${EndIf} |
||||
FunctionEnd |
||||
|
||||
; This empty section allows selecting whether to reset OpenVPN-GUI registry key |
||||
; values to the default. OpenVPN-specific part of the configuration gets |
||||
; auto-detected and overwritten regardless of this setting. |
||||
Section /o "$(NAME_SecOverwriteConfiguration)" SecOverwriteConfiguration |
||||
SectionEnd |
||||
|
||||
|
||||
Section "-Add registry keys" SecAddRegistryKeys |
||||
|
||||
AddSize 0 |
||||
|
||||
Var /GLOBAL OPENVPN_INSTALL_DIR |
||||
|
||||
; This code checks if OpenVPN is installed and bails out if it's not. |
||||
goto read_32bit_registry |
||||
|
||||
read_32bit_registry: |
||||
ClearErrors |
||||
ReadRegStr $OPENVPN_INSTALL_DIR HKLM "Software\OpenVPN" "" |
||||
IfErrors read_64bit_registry openvpn_found |
||||
|
||||
read_64bit_registry: |
||||
ClearErrors |
||||
SetRegView 64 |
||||
ReadRegStr $OPENVPN_INSTALL_DIR HKLM "Software\OpenVPN" "" |
||||
IfErrors openvpn_not_found openvpn_found |
||||
|
||||
openvpn_not_found: |
||||
Abort "OpenVPN not installed, bailing out..." |
||||
|
||||
openvpn_found: |
||||
DetailPrint "OpenVPN installed to $OPENVPN_INSTALL_DIR" |
||||
|
||||
; If we're told to overwrite existing configuration, we do it. |
||||
${If} ${SectionIsSelected} ${SecOverwriteConfiguration} |
||||
goto overwrite_gui_configuration |
||||
${EndIf} |
||||
|
||||
; If registry values are missing, we need to add them regardless of what |
||||
; we've been told. |
||||
ClearErrors |
||||
ReadRegStr $0 HKLM "Software\OpenVPN-GUI" "allow_edit" |
||||
IfErrors overwrite_gui_configuration update_openvpn_settings |
||||
|
||||
overwrite_gui_configuration: |
||||
|
||||
; OpenVPN-GUI-specific registry keys. We may or may not update |
||||
; these. |
||||
WriteRegStr ${REG_KEY} "allow_edit" "1" |
||||
WriteRegStr ${REG_KEY} "allow_password" "1" |
||||
WriteRegStr ${REG_KEY} "allow_proxy" "1" |
||||
WriteRegStr ${REG_KEY} "allow_service" "0" |
||||
WriteRegStr ${REG_KEY} "connectscript_timeout" "15" |
||||
WriteRegStr ${REG_KEY} "disconnect_on_suspend" "1" |
||||
WriteRegStr ${REG_KEY} "disconnectscript_timeout" "10" |
||||
WriteRegStr ${REG_KEY} "preconnectscript_timeout" "10" |
||||
WriteRegStr ${REG_KEY} "editor" "C:\Windows\notepad.exe" |
||||
WriteRegStr ${REG_KEY} "log_append" "0" |
||||
WriteRegStr ${REG_KEY} "log_viewer" "C:\Windows\notepad.exe" |
||||
WriteRegStr ${REG_KEY} "passphrase_attempts" "3" |
||||
WriteRegStr ${REG_KEY} "priority" "NORMAL_PRIORITY_CLASS" |
||||
WriteRegStr ${REG_KEY} "show_balloon" "1" |
||||
WriteRegStr ${REG_KEY} "show_script_window" "1" |
||||
WriteRegStr ${REG_KEY} "silent_connection" "0" |
||||
|
||||
update_openvpn_settings: |
||||
|
||||
; Registry keys related to OpenVPN. We always update these during |
||||
; install. |
||||
|
||||
DeleteRegValue ${REG_KEY} "config_dir" |
||||
DeleteRegValue ${REG_KEY} "config_ext" |
||||
DeleteRegValue ${REG_KEY} "exe_path" |
||||
DeleteRegValue ${REG_KEY} "log_dir" |
||||
WriteRegStr ${REG_KEY} "config_dir" "$OPENVPN_INSTALL_DIR\config" |
||||
WriteRegStr ${REG_KEY} "config_ext" "ovpn" |
||||
WriteRegStr ${REG_KEY} "exe_path" "$OPENVPN_INSTALL_DIR\bin\openvpn.exe" |
||||
WriteRegStr ${REG_KEY} "log_dir" "$OPENVPN_INSTALL_DIR\log" |
||||
|
||||
SectionEnd |
||||
|
||||
Section "$(NAME_SecInstallExecutable)" SecInstallExecutable |
||||
|
||||
SetOutPath "$INSTDIR\bin" |
||||
AddSize 400 |
||||
File "..\openvpn-gui.exe" |
||||
|
||||
SectionEnd |
||||
|
||||
Section "$(NAME_SecInstallDesktopIcon)" SecInstallDesktopIcon |
||||
AddSize 1 |
||||
SetOverwrite on |
||||
CreateShortcut "$DESKTOP\OpenVPN-GUI.lnk" "$INSTDIR\bin\openvpn-gui.exe" |
||||
SectionEnd |
||||
|
||||
Section "$(NAME_SecAddStartMenuEntries)" SecAddStartMenuEntries |
||||
AddSize 1 |
||||
SetOverwrite on |
||||
CreateDirectory "$SMPROGRAMS\${PACKAGE_NAME}" |
||||
WriteINIStr "$SMPROGRAMS\${PACKAGE_NAME}\${PACKAGE_NAME} Web Site.url" "InternetShortcut" "URL" "http://sourceforge.net/projects/openvpn-gui" |
||||
|
||||
${If} ${SectionIsSelected} ${SecInstallExecutable} |
||||
CreateShortcut "$SMPROGRAMS\${PACKAGE_NAME}\${PACKAGE_NAME}.lnk" "$INSTDIR\bin\openvpn-gui.exe" |
||||
${EndIf} |
||||
SectionEnd |
||||
|
||||
Section "$(NAME_SecInstallDocumentation)" SecInstallDocumentation |
||||
AddSize 1 |
||||
SetOverwrite on |
||||
SetOutPath "$INSTDIR\doc" |
||||
File /oname=README.txt "..\README" |
||||
SectionEnd |
||||
|
||||
Section "-post" |
||||
|
||||
; Create uninstall |
||||
WriteUninstaller "$INSTDIR\Uninstall.exe" |
||||
|
||||
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGE_NAME}" "DisplayName" "${PACKAGE_NAME} ${VERSION}" |
||||
WriteRegExpandStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGE_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe" |
||||
;WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGE_NAME}" "DisplayIcon" "$INSTDIR\icon.ico" |
||||
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGE_NAME}" "DisplayVersion" "${VERSION}" |
||||
|
||||
SectionEnd |
||||
|
||||
; This section is here to allow deletion of user-defined OpenVPN-GUI |
||||
; configuration. Registry keys related to current OpenVPN install are always |
||||
; deleted during uninstall. |
||||
Section /o "un.$(NAME_DeleteAllRegistryKeys)" SecDeleteAllRegistryKeys |
||||
SectionEnd |
||||
|
||||
Section "-un.Uninstall" SecUninstall |
||||
|
||||
; We'll always delete registry keys related to OpenVPN. These will be |
||||
; recreated automatically when OpenVPN-GUI is installed again. |
||||
DeleteRegValue ${REG_KEY} "config_dir" |
||||
DeleteRegValue ${REG_KEY} "config_ext" |
||||
DeleteRegValue ${REG_KEY} "exe_path" |
||||
DeleteRegValue ${REG_KEY} "log_dir" |
||||
|
||||
; We wipe OpenVPN-GUI-specific configuration if asked to |
||||
${If} ${SectionIsSelected} ${SecDeleteAllRegistryKeys} |
||||
DeleteRegKey ${REG_KEY} |
||||
${EndIf} |
||||
|
||||
; Remove desktop icon, start menu entries and installed files |
||||
Delete "$DESKTOP\${PACKAGE_NAME}.lnk" |
||||
RMDir /r "$SMPROGRAMS\${PACKAGE_NAME}" |
||||
RMDir /r "$INSTDIR" |
||||
|
||||
;DeleteRegKey HKCR "${PACKAGE_NAME}File" |
||||
|
||||
; Remove OpenVPN-GUI uninstall/change option from Add/Remove programs list |
||||
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGE_NAME}" |
||||
|
||||
SectionEnd |
||||
|
||||
|
||||
; Language settings |
||||
!include "english.nsh" |
||||
|
||||
!insertmacro MUI_LANGUAGE "English" |
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN |
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecOverwriteConfiguration} $(DESC_SecOverwriteConfiguration) |
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecInstallExecutable} $(DESC_SecInstallExecutable) |
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecInstallDocumentation} $(DESC_SecInstallDocumentation) |
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecInstallDesktopIcon} $(DESC_SecInstallDesktopIcon) |
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecAddStartMenuEntries} $(DESC_SecAddStartMenuEntries) |
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END |
||||
|
Loading…
Reference in new issue