Katteker/Creator/Setup.nsi
Holger Boerchers d383f0ef1c Initial commit
2018-03-21 20:07:40 +01:00

103 lines
4.9 KiB
NSIS

!define APPNAME "Shutdown8"
!define EXECUTABLE "Shutdown8.exe"
!define COMPANYNAME "Bandisoft.com"
!define DESCRIPTION "NoDescription"
!define VERSION 1.8.0
!define HELPURL https://srv-lsimctrl01.enercon.de
!define INSTALLSIZE 155573
!define ISMANAGED 1
; exampleCmd: makensis.exe /DVERSION=1.0.0.5 /DNAME=WpfApp1 Setup.nsi
Name "${APPNAME}"
OutFile "${APPNAME}-${VERSION}.exe"
InstallDir "$LOCALAPPDATA\${APPNAME}"
RequestExecutionLevel user
SetCompressor /SOLID lzma
SilentUnInstall silent
; Subcaption 3 " "
XPStyle on
AutoCloseWindow true
ChangeUI all "${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe"
Icon "${NSISDIR}\Contrib\Graphics\Icons\nsis3-install.ico"
UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\nsis3-uninstall.ico"
ShowInstDetails nevershow
ShowUninstDetails nevershow
BrandingText "${COMPANYNAME}"
;--------------------------------
; The stuff to install
Section "install" ;No components page, name is not important
DetailPrint 'Installing ${APPNAME}. Please wait...'
SetShellVarContext current
SetDetailsPrint None
SetOutPath $INSTDIR\app-${VERSION}
; Put file there
File /r /x *.pdb /x *.obj /x *.pch /x *.vshost.exe /x *.vshost.exe.* Release\*.*
SetOutPath $INSTDIR
File "/oname=${Executable}" AppStub.exe
File Rabbit.Shared.dll
WriteINIStr $INSTDIR\app.ini Main Executable "${EXECUTABLE}"
WriteINIStr $INSTDIR\app.ini Main AppName "${APPNAME}"
WriteINIStr $INSTDIR\app.ini Main IsManaged ${ISMANAGED}
WriteUninstaller "$INSTDIR\uninstall.exe"
; Desktop
CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\${Executable}"
# Start Menu
CreateDirectory "$SMPROGRAMS\${COMPANYNAME}"
CreateShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\${Executable}"
# Update pinned Taskbar
IfFileExists "$APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\${APPNAME}.lnk" 0 +2
CreateShortCut "$APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\${APPNAME}.lnk" "$INSTDIR\${Executable}"
SetOutPath $INSTDIR\app-${VERSION}
StrCpy $0 ${EXECUTABLE} -4
IfFileExists "$APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\$0.lnk" 0 +2
CreateShortCut "$APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\$0.lnk" "$INSTDIR\app-${VERSION}\${EXECUTABLE}"
# Registry information for add/remove programs
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$\"$INSTDIR\app-${VERSION}\${EXECUTABLE}$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "${COMPANYNAME}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "HelpLink" "${HELPURL}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "${VERSION}"
# There is no option for modifying or repairing the install
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
SectionEnd ; end the section
Function .onInstSuccess
IfSilent +2
Exec '"$INSTDIR\${Executable}"'
FunctionEnd
Section "uninstall"
DetailPrint 'Please wait...'
SetShellVarContext current
SetDetailsPrint None
SetAutoClose true
# Remove Start Menu launcher
Delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"
Delete "$DESKTOP\${APPNAME}.lnk"
StrCpy $0 ${EXECUTABLE} -4
Delete "$APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\${APPNAME}.lnk"
Delete "$APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\$0.lnk"
# Try to remove the Start Menu folder - this will only happen if it is empty
RMDir "$SMPROGRAMS\${COMPANYNAME}"
# Always delete uninstaller as the last action
delete $INSTDIR\uninstall.exe
# Try to remove the install directory - this will only happen if it is empty
RMDir /r /REBOOTOK $INSTDIR
# Remove uninstaller information from the registry
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
sectionEnd