NSIS Installer Script

Simple installer script using NSIS Installer

# define installer name
outFile “qr-setup.exe”

# set desktop as install directory
InstallDir “C:”

# default section start
Section
# define output path
setOutPath $INSTDIR
#writeuninstaller $INSTDIR\uninstaller.exe
SectionEnd
# default section end

# install query reporter and oracle client
Section “install query reporter and oracle instant client”
SetOutPath $INSTDIR
MessageBox MB_YESNO “Install Query Reporter” /SD IDYES IDNO endQueryReporter
File “QueryReporter.exe”
ExecWait “$INSTDIR\QueryReporter.exe”
Goto endQueryReporter
endQueryReporter:
MessageBox MB_YESNO “Install Oracle Instant Client” /SD IDYES IDNO endOracleClient
File “orainst.exe”
ExecWait “$INSTDIR\orainst.exe”
Goto endOracleClient
endOracleClient:
delete $INSTDIR\QueryReporter.exe
delete $INSTDIR\orainst.exe
SectionEnd

# set environment variables
!define ORACLE_HOME “C:\orainst”
!define TNS_ADMIN “C:\orainst”

!include WriteEnvStr.nsh
!include EnvVarUpdate.nsh

Section “setup environment variables”
!ifdef ALL_USERS
!define ReadEnvStr_RegKey \
‘HKLM “SYSTEM\CurrentControlSet\Control\Session Manager\Environment”‘
!else
!define ReadEnvStr_RegKey ‘HKCU “Environment”‘
!endif

Push ORACLE_HOME
Push ‘${ORACLE_HOME}’
Call WriteEnvStr
Push TNS_ADMIN
Push ‘${TNS_ADMIN}’
Call WriteEnvStr

ReadEnvStr $R0 “PATH”
ReadRegStr $0 ${ReadEnvStr_RegKey} ‘ORACLE_HOME’
${EnvVarUpdate} $0 “PATH” “A” “HKCU” “$0”
SectionEnd

# create a section to define what the uninstaller does.
# the section will always be named “Uninstall”
#Section “Uninstall”
# remove the variables
#  Push ORACLE_HOME
#  Call un.DeleteEnvStr
#  Push TNS_ADMIN
#  Call un.DeleteEnvStr
#  Always delete uninstaller
#  delete $INSTDIR\uninstaller.exe
#SectionEnd

NSIS Installer Script

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s