; NSIS script for Barracuda Firewall Admin ; Written by: lunarg@blackmanticore.com (v0.1) ; ; v0.1 -- Initial release ; ;-------------------------------- ;Static variables (like version-info) !define MY_VERINFO_INT 801 !define MY_VERINFO_STR "8.0.1-225" !define MY_VERINFO_MIN 01 !define MY_VERINFO_MAJ 8 !define MY_FILESIZE 55296 ;Dynamic variables (like files) !define MY_APPFILE "FirewallAdmin_${MY_VERINFO_STR}.exe" ;-------------------------------- ;Include Modern UI !include "MUI2.nsh" !include "WinVer.nsh" ;-------------------------------- ;Custom graphics settings ; MUI Settings / Icons !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico" ; MUI Settings / Header !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_RIGHT !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-r.bmp" !define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall-r.bmp" ; MUI Settings / Wizard !define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp" !define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp" ;-------------------------------- ;General ;Name and file Name "Barracuda FirewallAdmin" Caption "Barracuda FirewallAdmin" BrandingText "Barracuda" OutFile "FirewallAdmin-setup.exe" SetDatablockOptimize on CRCCheck on ;Default installation folder InstallDir "$PROGRAMFILES\Barracuda\FirewallAdmin" ;Get installation folder from registry if available InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "InstallLocation" ;Request application privileges for Windows Vista RequestExecutionLevel admin ;-------------------------------- ;Interface Settings !define MUI_ABORTWARNING ;-------------------------------- ;Language Selection Dialog Settings ;Remember the installer language !define MUI_LANGDLL_REGISTRY_ROOT "HKLM" !define MUI_LANGDLL_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" ;-------------------------------- ;Pages !insertmacro MUI_PAGE_WELCOME ;!insertmacro MUI_PAGE_LICENSE $(F_License) !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM ;!insertmacro MUI_UNPAGE_COMPONENTS !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ;Reserve Files ;If you are using solid compression, files that are required before ;the actual installation should be stored first in the data block, ;because this will make your installer start faster. !insertmacro MUI_RESERVEFILE_LANGDLL ;-------------------------------- ;Language strings ;LicenseLangString F_License ${LANG_ENGLISH} "License.txt" LangString SEC_Core ${LANG_ENGLISH} "Program files" LangString DESC_Core ${LANG_ENGLISH} "The actual program files." LangString SEC_Shortcuts ${LANG_ENGLISH} "Start menu shortcuts" LangString DESC_Shortcuts ${LANG_ENGLISH} "Create shortcuts in start menu." LangString SEC_Desktop ${LANG_ENGLISH} "Desktop shortcut" LangString DESC_Desktop ${LANG_ENGLISH} "Create a shortcut on the desktop." LangString INST_BadWin ${LANG_ENGLISH} "This program requires at least Windows 7. Setup cannot continue." ;-------------------------------- ;Installer Sections Section $(SEC_Core) Core SectionIn RO ; Set context to all users SetShellVarContext all SetOutPath "$INSTDIR" ;ADD YOUR OWN FILES HERE... File ${MY_APPFILE} ;Store installation folder WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "InstallLocation" $INSTDIR ;Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" ;Write the uninstall keys for Windows WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "DisplayName" "Barracuda FirewallAdmin" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "Publisher" "Barracuda" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "DisplayIcon" "$INSTDIR\${MY_APPFILE}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "Version" "${MY_VERINFO_STR}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "DisplayVersion" "${MY_VERINFO_STR}" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "VersionMajor" ${MY_VERINFO_MAJ} WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "VersionMinor" ${MY_VERINFO_MIN} WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "NoRepair" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "EstimatedSize" ${MY_FILESIZE} WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "URLInfoAbout" "https://dlportal.barracudanetworks.com/" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" "HelpLink" "https://campus.barracuda.com/" SectionEnd Section $(SEC_Shortcuts) Shortcuts ; Set context to all users SetShellVarContext all CreateDirectory "$SMPROGRAMS\Barracuda" CreateShortCut "$SMPROGRAMS\Barracuda\FirewallAdmin.lnk" "$INSTDIR\${MY_APPFILE}" "" "$INSTDIR\${MY_APPFILE}" 0 SectionEnd Section /o $(SEC_Desktop) Desktop ; Set context to current user SetShellVarContext current CreateShortCut "$DESKTOP\FirewallAdmin.lnk" "$INSTDIR\${MY_APPFILE}" "" "$INSTDIR\${MY_APPFILE}" 0 SectionEnd ;-------------------------------- ;Installer Functions Function .onInit ; !insertmacro MUI_LANGDLL_DISPLAY ${IfNot} ${AtLeastWin7} MessageBox MB_OK $(INST_BadWin) Quit ${EndIf} FunctionEnd ;-------------------------------- ;Descriptions !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${Core} $(DESC_Core) !insertmacro MUI_DESCRIPTION_TEXT ${Shortcuts} $(DESC_Shortcuts) !insertmacro MUI_FUNCTION_DESCRIPTION_END ;-------------------------------- ;Uninstaller Section Section "Uninstall" ; Set context to all users SetShellVarContext all ; Remove file association ;ADD YOUR OWN FILES HERE... Delete "$INSTDIR\${MY_APPFILE}" Delete "$INSTDIR\Uninstall.exe" ; Remove shortcuts, if any Delete "$SMPROGRAMS\Barracuda\*.*" ; Remove directories used RMDir "$SMPROGRAMS\Barracuda" RMDir "$INSTDIR" ; Remove registry keys DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BarracudaFirewallAdmin" ; Remove desktop shortcut, if any SetShellVarContext current Delete "$DESKTOP\FirewallAdmin.lnk" SectionEnd ;-------------------------------- ;Uninstaller Functions Function un.onInit ; !insertmacro MUI_UNGETLANGUAGE FunctionEnd