mirror of https://github.com/OpenVPN/openvpn-gui
removed unused nsis installer
parent
67e63328df
commit
68552bf523
18
Makefile.am
18
Makefile.am
|
@ -67,11 +67,7 @@ openvpn_gui_RESOURCES = \
|
||||||
res/reconnecting.ico \
|
res/reconnecting.ico \
|
||||||
res/openvpn-gui.manifest
|
res/openvpn-gui.manifest
|
||||||
|
|
||||||
openvpn_gui_NSIS = \
|
EXTRA_DIST = $(openvpn_gui_RESOURCES)
|
||||||
nsis/openvpn-gui.nsi \
|
|
||||||
nsis/english.nsh
|
|
||||||
|
|
||||||
EXTRA_DIST = $(openvpn_gui_RESOURCES) $(openvpn_gui_NSIS)
|
|
||||||
|
|
||||||
openvpn_gui_SOURCES = \
|
openvpn_gui_SOURCES = \
|
||||||
main.c main.h \
|
main.c main.h \
|
||||||
|
@ -110,15 +106,3 @@ openvpn_gui_LDADD = \
|
||||||
|
|
||||||
openvpn-gui-res.o: $(openvpn_gui_RESOURCES) $(srcdir)/openvpn-gui-res.h
|
openvpn-gui-res.o: $(openvpn_gui_RESOURCES) $(srcdir)/openvpn-gui-res.h
|
||||||
$(RCCOMPILE) -i $< -o $@
|
$(RCCOMPILE) -i $< -o $@
|
||||||
|
|
||||||
if HAVE_NSIS
|
|
||||||
CLEANFILES = openvpn-gui-installer.exe
|
|
||||||
|
|
||||||
openvpn-gui-installer.exe: $(openvpn_gui_NSIS) $(bin_PROGRAMS)
|
|
||||||
$(STRIP) -s $(bin_PROGRAMS)
|
|
||||||
$(MAKENSIS) -DARCH=$(ARCH) -DVERSION=$(VERSION) $<
|
|
||||||
|
|
||||||
installer: openvpn-gui-installer.exe
|
|
||||||
|
|
||||||
.PHONY: installer
|
|
||||||
endif
|
|
||||||
|
|
|
@ -51,9 +51,6 @@ if test -z "$MAX_CONFIGS"; then
|
||||||
fi
|
fi
|
||||||
AC_DEFINE_UNQUOTED([MAX_CONFIGS], [$MAX_CONFIGS], [Maximum number of config files supported.])
|
AC_DEFINE_UNQUOTED([MAX_CONFIGS], [$MAX_CONFIGS], [Maximum number of config files supported.])
|
||||||
|
|
||||||
AC_ARG_VAR([ARCH], [override the CPU architecture for the NSIS installer])
|
|
||||||
test "x$ARCH" = "x" && ARCH=${host%%-*}
|
|
||||||
|
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-mingw*)
|
*-mingw*)
|
||||||
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
|
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
|
||||||
|
@ -69,12 +66,6 @@ AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
|
|
||||||
AC_ARG_VAR([MAKENSIS], [define the path to the makensis tool])
|
|
||||||
if test "x$MAKENSIS" = "x"; then
|
|
||||||
AC_PATH_PROG([MAKENSIS], [makensis])
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL([HAVE_NSIS], [test "x$MAKENSIS" != "x"])
|
|
||||||
|
|
||||||
if test "${enable_password_change}" = "yes"; then
|
if test "${enable_password_change}" = "yes"; then
|
||||||
PKG_PROG_PKG_CONFIG
|
PKG_PROG_PKG_CONFIG
|
||||||
PKG_CHECK_MODULES(
|
PKG_CHECK_MODULES(
|
||||||
|
|
|
@ -1,327 +0,0 @@
|
||||||
/**
|
|
||||||
* EnvVarUpdate.nsh
|
|
||||||
* : Environmental Variables: append, prepend, and remove entries
|
|
||||||
*
|
|
||||||
* WARNING: If you use StrFunc.nsh header then include it before this file
|
|
||||||
* with all required definitions. This is to avoid conflicts
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
* ${EnvVarUpdate} "ResultVar" "EnvVarName" "Action" "RegLoc" "PathString"
|
|
||||||
*
|
|
||||||
* Credits:
|
|
||||||
* Version 1.0
|
|
||||||
* * Cal Turney (turnec2)
|
|
||||||
* * Amir Szekely (KiCHiK) and e-circ for developing the forerunners of this
|
|
||||||
* function: AddToPath, un.RemoveFromPath, AddToEnvVar, un.RemoveFromEnvVar,
|
|
||||||
* WriteEnvStr, and un.DeleteEnvStr
|
|
||||||
* * Diego Pedroso (deguix) for StrTok
|
|
||||||
* * Kevin English (kenglish_hi) for StrContains
|
|
||||||
* * Hendri Adriaens (Smile2Me), Diego Pedroso (deguix), and Dan Fuhry
|
|
||||||
* (dandaman32) for StrReplace
|
|
||||||
*
|
|
||||||
* Version 1.1 (compatibility with StrFunc.nsh)
|
|
||||||
* * techtonik
|
|
||||||
*
|
|
||||||
* http://nsis.sourceforge.net/Environmental_Variables:_append%2C_prepend%2C_and_remove_entries
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
!ifndef ENVVARUPDATE_FUNCTION
|
|
||||||
!define ENVVARUPDATE_FUNCTION
|
|
||||||
!verbose push
|
|
||||||
!verbose 3
|
|
||||||
!include "LogicLib.nsh"
|
|
||||||
!include "WinMessages.NSH"
|
|
||||||
!include "StrFunc.nsh"
|
|
||||||
|
|
||||||
; ---- Fix for conflict if StrFunc.nsh is already includes in main file -----------------------
|
|
||||||
!macro _IncludeStrFunction StrFuncName
|
|
||||||
!ifndef ${StrFuncName}_INCLUDED
|
|
||||||
${${StrFuncName}}
|
|
||||||
!endif
|
|
||||||
!ifndef Un${StrFuncName}_INCLUDED
|
|
||||||
${Un${StrFuncName}}
|
|
||||||
!endif
|
|
||||||
!define un.${StrFuncName} "${Un${StrFuncName}}"
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!insertmacro _IncludeStrFunction StrTok
|
|
||||||
!insertmacro _IncludeStrFunction StrStr
|
|
||||||
!insertmacro _IncludeStrFunction StrRep
|
|
||||||
|
|
||||||
; ---------------------------------- Macro Definitions ----------------------------------------
|
|
||||||
!macro _EnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
|
|
||||||
Push "${EnvVarName}"
|
|
||||||
Push "${Action}"
|
|
||||||
Push "${RegLoc}"
|
|
||||||
Push "${PathString}"
|
|
||||||
Call EnvVarUpdate
|
|
||||||
Pop "${ResultVar}"
|
|
||||||
!macroend
|
|
||||||
!define EnvVarUpdate '!insertmacro "_EnvVarUpdateConstructor"'
|
|
||||||
|
|
||||||
!macro _unEnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
|
|
||||||
Push "${EnvVarName}"
|
|
||||||
Push "${Action}"
|
|
||||||
Push "${RegLoc}"
|
|
||||||
Push "${PathString}"
|
|
||||||
Call un.EnvVarUpdate
|
|
||||||
Pop "${ResultVar}"
|
|
||||||
!macroend
|
|
||||||
!define un.EnvVarUpdate '!insertmacro "_unEnvVarUpdateConstructor"'
|
|
||||||
; ---------------------------------- Macro Definitions end-------------------------------------
|
|
||||||
|
|
||||||
;----------------------------------- EnvVarUpdate start----------------------------------------
|
|
||||||
!define hklm_all_users 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
|
||||||
!define hkcu_current_user 'HKCU "Environment"'
|
|
||||||
|
|
||||||
!macro EnvVarUpdate UN
|
|
||||||
|
|
||||||
Function ${UN}EnvVarUpdate
|
|
||||||
|
|
||||||
Push $0
|
|
||||||
Exch 4
|
|
||||||
Exch $1
|
|
||||||
Exch 3
|
|
||||||
Exch $2
|
|
||||||
Exch 2
|
|
||||||
Exch $3
|
|
||||||
Exch
|
|
||||||
Exch $4
|
|
||||||
Push $5
|
|
||||||
Push $6
|
|
||||||
Push $7
|
|
||||||
Push $8
|
|
||||||
Push $9
|
|
||||||
Push $R0
|
|
||||||
|
|
||||||
/* After this point:
|
|
||||||
-------------------------
|
|
||||||
$0 = ResultVar (returned)
|
|
||||||
$1 = EnvVarName (input)
|
|
||||||
$2 = Action (input)
|
|
||||||
$3 = RegLoc (input)
|
|
||||||
$4 = PathString (input)
|
|
||||||
$5 = Orig EnvVar (read from registry)
|
|
||||||
$6 = Len of $0 (temp)
|
|
||||||
$7 = tempstr1 (temp)
|
|
||||||
$8 = Entry counter (temp)
|
|
||||||
$9 = tempstr2 (temp)
|
|
||||||
$R0 = tempChar (temp) */
|
|
||||||
|
|
||||||
; Step 1: Read contents of EnvVarName from RegLoc
|
|
||||||
;
|
|
||||||
; Check for empty EnvVarName
|
|
||||||
${If} $1 == ""
|
|
||||||
SetErrors
|
|
||||||
DetailPrint "ERROR: EnvVarName is blank"
|
|
||||||
Goto EnvVarUpdate_Restore_Vars
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
; Check for valid Action
|
|
||||||
${If} $2 != "A"
|
|
||||||
${AndIf} $2 != "P"
|
|
||||||
${AndIf} $2 != "R"
|
|
||||||
SetErrors
|
|
||||||
DetailPrint "ERROR: Invalid Action - must be A, P, or R"
|
|
||||||
Goto EnvVarUpdate_Restore_Vars
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
${If} $3 == HKLM
|
|
||||||
ReadRegStr $5 ${hklm_all_users} $1 ; Get EnvVarName from all users into $5
|
|
||||||
${ElseIf} $3 == HKCU
|
|
||||||
ReadRegStr $5 ${hkcu_current_user} $1 ; Read EnvVarName from current user into $5
|
|
||||||
${Else}
|
|
||||||
SetErrors
|
|
||||||
DetailPrint 'ERROR: Action is [$3] but must be "HKLM" or HKCU"'
|
|
||||||
Goto EnvVarUpdate_Restore_Vars
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
; Check for empty PathString
|
|
||||||
${If} $4 == ""
|
|
||||||
SetErrors
|
|
||||||
DetailPrint "ERROR: PathString is blank"
|
|
||||||
Goto EnvVarUpdate_Restore_Vars
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
; Make sure we've got some work to do
|
|
||||||
${If} $5 == ""
|
|
||||||
${AndIf} $2 == "R"
|
|
||||||
SetErrors
|
|
||||||
DetailPrint "$1 is empty - Nothing to remove"
|
|
||||||
Goto EnvVarUpdate_Restore_Vars
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
; Step 2: Scrub EnvVar
|
|
||||||
;
|
|
||||||
StrCpy $0 $5 ; Copy the contents to $0
|
|
||||||
; Remove spaces around semicolons (NOTE: spaces before the 1st entry or
|
|
||||||
; after the last one are not removed here but instead in Step 3)
|
|
||||||
${If} $0 != "" ; If EnvVar is not empty ...
|
|
||||||
${Do}
|
|
||||||
${${UN}StrStr} $7 $0 " ;"
|
|
||||||
${If} $7 == ""
|
|
||||||
${ExitDo}
|
|
||||||
${EndIf}
|
|
||||||
${${UN}StrRep} $0 $0 " ;" ";" ; Remove '<space>;'
|
|
||||||
${Loop}
|
|
||||||
${Do}
|
|
||||||
${${UN}StrStr} $7 $0 "; "
|
|
||||||
${If} $7 == ""
|
|
||||||
${ExitDo}
|
|
||||||
${EndIf}
|
|
||||||
${${UN}StrRep} $0 $0 "; " ";" ; Remove ';<space>'
|
|
||||||
${Loop}
|
|
||||||
${Do}
|
|
||||||
${${UN}StrStr} $7 $0 ";;"
|
|
||||||
${If} $7 == ""
|
|
||||||
${ExitDo}
|
|
||||||
${EndIf}
|
|
||||||
${${UN}StrRep} $0 $0 ";;" ";"
|
|
||||||
${Loop}
|
|
||||||
|
|
||||||
; Remove a leading or trailing semicolon from EnvVar
|
|
||||||
StrCpy $7 $0 1 0
|
|
||||||
${If} $7 == ";"
|
|
||||||
StrCpy $0 $0 "" 1 ; Change ';<EnvVar>' to '<EnvVar>'
|
|
||||||
${EndIf}
|
|
||||||
StrLen $6 $0
|
|
||||||
IntOp $6 $6 - 1
|
|
||||||
StrCpy $7 $0 1 $6
|
|
||||||
${If} $7 == ";"
|
|
||||||
StrCpy $0 $0 $6 ; Change ';<EnvVar>' to '<EnvVar>'
|
|
||||||
${EndIf}
|
|
||||||
; DetailPrint "Scrubbed $1: [$0]" ; Uncomment to debug
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
/* Step 3. Remove all instances of the target path/string (even if "A" or "P")
|
|
||||||
$6 = bool flag (1 = found and removed PathString)
|
|
||||||
$7 = a string (e.g. path) delimited by semicolon(s)
|
|
||||||
$8 = entry counter starting at 0
|
|
||||||
$9 = copy of $0
|
|
||||||
$R0 = tempChar */
|
|
||||||
|
|
||||||
${If} $5 != "" ; If EnvVar is not empty ...
|
|
||||||
StrCpy $9 $0
|
|
||||||
StrCpy $0 ""
|
|
||||||
StrCpy $8 0
|
|
||||||
StrCpy $6 0
|
|
||||||
|
|
||||||
${Do}
|
|
||||||
${${UN}StrTok} $7 $9 ";" $8 "0" ; $7 = next entry, $8 = entry counter
|
|
||||||
|
|
||||||
${If} $7 == "" ; If we've run out of entries,
|
|
||||||
${ExitDo} ; were done
|
|
||||||
${EndIf} ;
|
|
||||||
|
|
||||||
; Remove leading and trailing spaces from this entry (critical step for Action=Remove)
|
|
||||||
${Do}
|
|
||||||
StrCpy $R0 $7 1
|
|
||||||
${If} $R0 != " "
|
|
||||||
${ExitDo}
|
|
||||||
${EndIf}
|
|
||||||
StrCpy $7 $7 "" 1 ; Remove leading space
|
|
||||||
${Loop}
|
|
||||||
${Do}
|
|
||||||
StrCpy $R0 $7 1 -1
|
|
||||||
${If} $R0 != " "
|
|
||||||
${ExitDo}
|
|
||||||
${EndIf}
|
|
||||||
StrCpy $7 $7 -1 ; Remove trailing space
|
|
||||||
${Loop}
|
|
||||||
${If} $7 == $4 ; If string matches, remove it by not appending it
|
|
||||||
StrCpy $6 1 ; Set 'found' flag
|
|
||||||
${ElseIf} $7 != $4 ; If string does NOT match
|
|
||||||
${AndIf} $0 == "" ; and the 1st string being added to $0,
|
|
||||||
StrCpy $0 $7 ; copy it to $0 without a prepended semicolon
|
|
||||||
${ElseIf} $7 != $4 ; If string does NOT match
|
|
||||||
${AndIf} $0 != "" ; and this is NOT the 1st string to be added to $0,
|
|
||||||
StrCpy $0 $0;$7 ; append path to $0 with a prepended semicolon
|
|
||||||
${EndIf} ;
|
|
||||||
|
|
||||||
IntOp $8 $8 + 1 ; Bump counter
|
|
||||||
${Loop} ; Check for duplicates until we run out of paths
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
; Step 4: Perform the requested Action
|
|
||||||
;
|
|
||||||
${If} $2 != "R" ; If Append or Prepend
|
|
||||||
${If} $6 == 1 ; And if we found the target
|
|
||||||
DetailPrint "Target is already present in $1. It will be removed and"
|
|
||||||
${EndIf}
|
|
||||||
${If} $0 == "" ; If EnvVar is (now) empty
|
|
||||||
StrCpy $0 $4 ; just copy PathString to EnvVar
|
|
||||||
${If} $6 == 0 ; If found flag is either 0
|
|
||||||
${OrIf} $6 == "" ; or blank (if EnvVarName is empty)
|
|
||||||
DetailPrint "$1 was empty and has been updated with the target"
|
|
||||||
${EndIf}
|
|
||||||
${ElseIf} $2 == "A" ; If Append (and EnvVar is not empty),
|
|
||||||
StrCpy $0 $0;$4 ; append PathString
|
|
||||||
${If} $6 == 1
|
|
||||||
DetailPrint "appended to $1"
|
|
||||||
${Else}
|
|
||||||
DetailPrint "Target was appended to $1"
|
|
||||||
${EndIf}
|
|
||||||
${Else} ; If Prepend (and EnvVar is not empty),
|
|
||||||
StrCpy $0 $4;$0 ; prepend PathString
|
|
||||||
${If} $6 == 1
|
|
||||||
DetailPrint "prepended to $1"
|
|
||||||
${Else}
|
|
||||||
DetailPrint "Target was prepended to $1"
|
|
||||||
${EndIf}
|
|
||||||
${EndIf}
|
|
||||||
${Else} ; If Action = Remove
|
|
||||||
${If} $6 == 1 ; and we found the target
|
|
||||||
DetailPrint "Target was found and removed from $1"
|
|
||||||
${Else}
|
|
||||||
DetailPrint "Target was NOT found in $1 (nothing to remove)"
|
|
||||||
${EndIf}
|
|
||||||
${If} $0 == ""
|
|
||||||
DetailPrint "$1 is now empty"
|
|
||||||
${EndIf}
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
; Step 5: Update the registry at RegLoc with the updated EnvVar and announce the change
|
|
||||||
;
|
|
||||||
ClearErrors
|
|
||||||
${If} $3 == HKLM
|
|
||||||
WriteRegExpandStr ${hklm_all_users} $1 $0 ; Write it in all users section
|
|
||||||
${ElseIf} $3 == HKCU
|
|
||||||
WriteRegExpandStr ${hkcu_current_user} $1 $0 ; Write it to current user section
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
IfErrors 0 +4
|
|
||||||
MessageBox MB_OK|MB_ICONEXCLAMATION "Could not write updated $1 to $3"
|
|
||||||
DetailPrint "Could not write updated $1 to $3"
|
|
||||||
Goto EnvVarUpdate_Restore_Vars
|
|
||||||
|
|
||||||
; "Export" our change
|
|
||||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
|
||||||
|
|
||||||
EnvVarUpdate_Restore_Vars:
|
|
||||||
;
|
|
||||||
; Restore the user's variables and return ResultVar
|
|
||||||
Pop $R0
|
|
||||||
Pop $9
|
|
||||||
Pop $8
|
|
||||||
Pop $7
|
|
||||||
Pop $6
|
|
||||||
Pop $5
|
|
||||||
Pop $4
|
|
||||||
Pop $3
|
|
||||||
Pop $2
|
|
||||||
Pop $1
|
|
||||||
Push $0 ; Push my $0 (ResultVar)
|
|
||||||
Exch
|
|
||||||
Pop $0 ; Restore his $0
|
|
||||||
|
|
||||||
FunctionEnd
|
|
||||||
|
|
||||||
!macroend ; EnvVarUpdate UN
|
|
||||||
!insertmacro EnvVarUpdate ""
|
|
||||||
!insertmacro EnvVarUpdate "un."
|
|
||||||
;----------------------------------- EnvVarUpdate end----------------------------------------
|
|
||||||
|
|
||||||
!verbose pop
|
|
||||||
!endif
|
|
|
@ -1,14 +0,0 @@
|
||||||
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"
|
|
|
@ -1,315 +0,0 @@
|
||||||
; ****************************************************************************
|
|
||||||
; * Copyright (C) 2013-2015 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"
|
|
||||||
|
|
||||||
; WinMessages.nsh is needed to send WM_CLOSE to the GUI if it is still running
|
|
||||||
!include "WinMessages.nsh"
|
|
||||||
|
|
||||||
; EnvVarUpdate.nsh is needed to update the PATH environment variable
|
|
||||||
!include "EnvVarUpdate.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
|
|
||||||
!insertmacro MUI_PAGE_FINISH
|
|
||||||
|
|
||||||
; Uninstaller pages
|
|
||||||
!insertmacro MUI_UNPAGE_COMPONENTS
|
|
||||||
!insertmacro MUI_UNPAGE_INSTFILES
|
|
||||||
|
|
||||||
;--------------------------------
|
|
||||||
; 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
|
|
||||||
|
|
||||||
;--------------------
|
|
||||||
; Functions
|
|
||||||
|
|
||||||
Function .onInit
|
|
||||||
${GetParameters} $R0
|
|
||||||
ClearErrors
|
|
||||||
|
|
||||||
!insertmacro SelectByParameter ${SecOverwriteConfiguration} SELECT_OVERWRITE_CONFIGURATION 1
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
;--------------------
|
|
||||||
; Sections
|
|
||||||
|
|
||||||
Section -pre
|
|
||||||
Push $0 ; for FindWindow
|
|
||||||
FindWindow $0 "OpenVPN-GUI"
|
|
||||||
StrCmp $0 0 guiNotRunning
|
|
||||||
|
|
||||||
; In silent mode always kill the GUI
|
|
||||||
MessageBox MB_YESNO|MB_ICONEXCLAMATION "To perform the specified operation, OpenVPN-GUI needs to be closed. Shall I close it?" /SD IDYES IDNO guiEndNo
|
|
||||||
DetailPrint "Closing OpenVPN-GUI..."
|
|
||||||
Goto guiEndYes
|
|
||||||
|
|
||||||
guiEndNo:
|
|
||||||
Quit
|
|
||||||
|
|
||||||
guiEndYes:
|
|
||||||
; user wants to close GUI as part of install/upgrade
|
|
||||||
FindWindow $0 "OpenVPN-GUI"
|
|
||||||
IntCmp $0 0 guiNotRunning
|
|
||||||
SendMessage $0 ${WM_CLOSE} 0 0
|
|
||||||
Sleep 100
|
|
||||||
Goto guiEndYes
|
|
||||||
|
|
||||||
guiNotRunning:
|
|
||||||
; openvpn-gui not running/closed successfully, carry on with install/upgrade
|
|
||||||
|
|
||||||
SectionEnd
|
|
||||||
|
|
||||||
; 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" "0"
|
|
||||||
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 "Add ${PACKAGE_NAME} to PATH" SecAddPath
|
|
||||||
|
|
||||||
; append our bin directory to end of current user path
|
|
||||||
${EnvVarUpdate} $R0 "PATH" "A" "HKLM" "$INSTDIR\bin"
|
|
||||||
|
|
||||||
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 uninstaller
|
|
||||||
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
|
|
||||||
|
|
||||||
; Stop OpenVPN-GUI if currently running
|
|
||||||
DetailPrint "Stopping OpenVPN-GUI..."
|
|
||||||
|
|
||||||
StopGUI:
|
|
||||||
|
|
||||||
FindWindow $0 "OpenVPN-GUI"
|
|
||||||
IntCmp $0 0 guiClosed
|
|
||||||
SendMessage $0 ${WM_CLOSE} 0 0
|
|
||||||
Sleep 100
|
|
||||||
Goto StopGUI
|
|
||||||
|
|
||||||
guiClosed:
|
|
||||||
|
|
||||||
; 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