# # This file is subject to the MPL license. # Copyright is 2008, Virginia Tech. # libx.org@gmail.com # # Note: this file contains $xxx$ place holders, which are replaced # by xcreateextension.pl with actual values #Install script for LibX-IE !define PRODUCT_NAME "LibX for IE" !define PRODUCT_VERSION "1.0" !define PRODUCT_PUBLISHER "Virginia Tech" !define PRODUCT_WEB_SITE "http://www.libx.org" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" !define PRODUCT_REGISTRY_KEY "Software\LibX for IE" #Needs the following symbols: # DLL_PATH: Path to LibXIE core DLLs # DLL_URL URL to download dependencies # JS_PATH: Path to LibX JavaScript files # LOCALE_PATH: Path to LibX locale base directory # LOCALE: Locale ID (like en-US) # EDITION_PATH: Output directory # EDITION_ID: Edition short ID (vt for the Virginia Tech edition, say) SetCompressor bzip2 # Modern UI !include "MUI.nsh" !include nsDialogs.nsh !include LogicLib.nsh Var userDialogChoice Var userDialogLabel Var radioButtonAllUsers Var radioButtonThisUser Var allUsersInstall # MUI Settings #!define MUI_ABORTWARNING # Warn user if install is canceled in midstream !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" # Stuff for the finish page -- show checkbox to start IE # For some reason just passing 'iexplore.exe' to MUI_FINISHPAGE_RUN doesn't # work, so instead we have to do it using ExecShell in a function. !define MUI_FINISHPAGE_RUN_FUNCTION execIE # Run this function !define MUI_FINISHPAGE_RUN !define MUI_FINISHPAGE_RUN_NOTCHECKED # Default to no !define MUI_FINISHPAGE_RUN_TEXT "Start Internet Explorer now" !define MUI_FINISHPAGE_SHOWREADME README.txt !define MUI_FINISHPAGE_SHOWREADME_TEXT "View Installation Notes" !define MUI_FINISHPAGE_SHOWREADME_FUNCTION viewReadme # Welcome page !insertmacro MUI_PAGE_WELCOME # License page !insertmacro MUI_PAGE_LICENSE "${DLL_PATH}MPL-1.1.txt" !insertmacro MUI_PAGE_INIT # All user versus current user selection page # Page Custom nsDialogsPage nsDialogsPageLeave # Directory page !insertmacro MUI_PAGE_DIRECTORY # Files to install page !insertmacro MUI_PAGE_INSTFILES # Finish page !insertmacro MUI_PAGE_FINISH # Uninstaller pages !insertmacro MUI_UNPAGE_INSTFILES # Language files !insertmacro MUI_LANGUAGE "English" # Reserve files !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS Name "${PRODUCT_NAME}" # localbuild is a (possibly non-empty) prefix to allow for alternate builds OutFile "${EDITION_PATH}libx-${EDITION_ID}.exe" InstallDir "$PROGRAMFILES\LibX for IE" #Get installation folder from registry if available InstallDirRegKey HKCU "${PRODUCT_REGISTRY_KEY}" "Directory" XPStyle on ShowInstDetails show ShowUnInstDetails show # Function to display all users versus current user choice # Not used at this time, but left here for future reference/use Function nsDialogsPage nsDialogs::Create /NOUNLOAD 1018 Pop $userDialogChoice #${If} $UserDialog ${NSD_CreateLabel} 0 0 100% 12u "Install Option" Pop $userDialogLabel ${NSD_CreateRadioButton} 0 13u 100% 12u "All Users" Pop $radioButtonAllUsers ${NSD_CreateRadioButton} 0 26u 100% 12u "Current User" Pop $radioButtonThisUser nsDialogs::Show FunctionEnd # Function to execute after all users / current user choice made # Not used at this time, but left here for future reference/use Function nsDialogsPageLeave ${NSD_GetState} $radioButtonAllUsers $allUsersInstall FunctionEnd # Launch Internet Explorer Function execIE ExecShell 'open' 'iexplore.exe' FunctionEnd Function viewReadme Exec '"$SYSDIR\notepad.exe" $APPDATA\LibX\README.txt' FunctionEnd # Download the file on the stack if it doesn't exist in the directory on the stack # Params: # Directory # File Function getDependency Pop $1 #File Pop $0 #Directory IfFileExists "$0\$1" +6 NSISdl::download "${DLL_URL}/$1" "$0\$1" Pop $R0 ;Get the return value StrCmp $R0 "success" +3 MessageBox MB_OK "Download of necessary component failed: $R0" Quit FunctionEnd Function getResource Pop $2 #File Pop $1 #ResourceID Pop $0 #Directory IfFileExists "$0\$1" +6 NSISdl::download "${DLL_URL}/$1/$2" "$0\$1\$2" Pop $R0 ;Get the return value StrCmp $R0 "success" +3 MessageBox MB_OK "Download of necessary component failed: $R0" Quit FunctionEnd Section "Pre-Install Download" SEC00 # Make the install dir CreateDirectory "$INSTDIR" CreateDirectory "$INSTDIR\en-US" CreateDirectory "$INSTDIR\ja" # Auto-generated by xcreateextension.pl IfFileExists "$SYSDIR\msxml6.dll" +6 Push "$TEMP" Push "msxml6.msi" Call getDependency # Download installer to temp dir nsExec::ExecToLog 'msiexec /quiet /i "$TEMP\msxml6.msi"' # Install Delete "$TEMP\msxml6.msi" # Clean up Push "$INSTDIR" Push "ActivScp.dll" Call getDependency Push "$INSTDIR" Push "Interop.SHDocVw.dll" Call getDependency Push "$INSTDIR" Push "Interop.MSXML2.dll" Call getDependency Push "$INSTDIR" Push "Microsoft.mshtml.dll" Call getDependency Push "$INSTDIR" Push "stdole.dll" Call getDependency Push "$INSTDIR" Push "GACMeUp.exe" Call getDependency Push "$INSTDIR" Push "en-US" Push "LibXIE.resources.dll" Call getResource Push "$INSTDIR" Push "ja" Push "LibXIE.resources.dll" Call getResource SectionEnd Section "LibX Core" SEC01 SetOverwrite ifdiff SetOutPath "$INSTDIR" # Toolbar files File "${DLL_PATH}LibXIE.dll" # Needed to register assemblies File "${DLL_PATH}Register.bat" File "${DLL_PATH}Unregister.bat" SectionEnd Section "LibX JavaScript" SEC02 #Set SetShellVarContext so that files are written to the all users folders SetShellVarContext all SetOverwrite on # Auto-generated by xcreateextension.pl SetOutPath "$APPDATA\LibX\content" File "${JS_PATH}filelist.txt" File "${JS_PATH}libx.js" SetOutPath "$APPDATA\LibX\content\catalogs" File "${JS_PATH}catalogs/catalog.js" SetOutPath "$APPDATA\LibX\content" File "${JS_PATH}proxy.js" File "${JS_PATH}xisbn.js" File "${JS_PATH}libx.ie.js" File "${JS_PATH}prefs.js" File "${JS_PATH}prefs.ie.js" File "${JS_PATH}menuObjects.js" File "${JS_PATH}openurl.js" File "${JS_PATH}config.js" File "${JS_PATH}config.ie.js" File "${JS_PATH}contextMenuUtils.js" File "${JS_PATH}isbnutils.js" File "${JS_PATH}fileCache.js" File "${JS_PATH}doiutils.js" File "${JS_PATH}magicsearch.js" File "${JS_PATH}libxprefs.js" File "${JS_PATH}doforurl.js" File "${JS_PATH}crossref.js" File "${JS_PATH}pubmed.js" File "${JS_PATH}iepagecomplete.js" SetOutPath "$APPDATA\LibX\content\catalogs" File "${JS_PATH}catalogs/alephopac.js" File "${JS_PATH}catalogs/centralsearch.js" File "${JS_PATH}catalogs/custom.js" File "${JS_PATH}catalogs/horizonopac.js" File "${JS_PATH}catalogs/milleniumopac.js" File "${JS_PATH}catalogs/openURLCatalog.js" File "${JS_PATH}catalogs/sirsiopac.js" File "${JS_PATH}catalogs/voyageropac.js" File "${JS_PATH}catalogs/web2opac.js" File "${JS_PATH}catalogs/worldcat.js" File "${JS_PATH}catalogs/vubis.js" File "${JS_PATH}catalogs/voyager7.js" File "${JS_PATH}catalogs/talisprism.js" File "${JS_PATH}catalogs/polaris.js" SetShellVarContext current # Auto-generated by xcreateextension.pl SetOutPath "$APPDATA\LibX\content" File "${JS_PATH}filelist.txt" File "${JS_PATH}libx.js" SetOutPath "$APPDATA\LibX\content\catalogs" File "${JS_PATH}catalogs/catalog.js" SetOutPath "$APPDATA\LibX\content" File "${JS_PATH}proxy.js" File "${JS_PATH}xisbn.js" File "${JS_PATH}libx.ie.js" File "${JS_PATH}prefs.js" File "${JS_PATH}prefs.ie.js" File "${JS_PATH}menuObjects.js" File "${JS_PATH}openurl.js" File "${JS_PATH}config.js" File "${JS_PATH}config.ie.js" File "${JS_PATH}contextMenuUtils.js" File "${JS_PATH}isbnutils.js" File "${JS_PATH}fileCache.js" File "${JS_PATH}doiutils.js" File "${JS_PATH}magicsearch.js" File "${JS_PATH}libxprefs.js" File "${JS_PATH}doforurl.js" File "${JS_PATH}crossref.js" File "${JS_PATH}pubmed.js" File "${JS_PATH}iepagecomplete.js" SetOutPath "$APPDATA\LibX\content\catalogs" File "${JS_PATH}catalogs/alephopac.js" File "${JS_PATH}catalogs/centralsearch.js" File "${JS_PATH}catalogs/custom.js" File "${JS_PATH}catalogs/horizonopac.js" File "${JS_PATH}catalogs/milleniumopac.js" File "${JS_PATH}catalogs/openURLCatalog.js" File "${JS_PATH}catalogs/sirsiopac.js" File "${JS_PATH}catalogs/voyageropac.js" File "${JS_PATH}catalogs/web2opac.js" File "${JS_PATH}catalogs/worldcat.js" File "${JS_PATH}catalogs/vubis.js" File "${JS_PATH}catalogs/voyager7.js" File "${JS_PATH}catalogs/talisprism.js" File "${JS_PATH}catalogs/polaris.js" SectionEnd Section "LibX Locale" SEC03 SetShellVarContext all SetOverwrite ifdiff SetOutPath "$APPDATA\LibX\locale\${LOCALE}" File "${LOCALE_PATH}${LOCALE}/libx/definitions.properties" SetShellVarContext current SetOutPath "$APPDATA\LibX\locale\${LOCALE}" File "${LOCALE_PATH}${LOCALE}/libx/definitions.properties" SectionEnd Section "Edition" SEC04 SetShellVarContext all SetOverwrite on # $editionfiles will be replaced with the edition-specific files. # This replacement is done by xcreateextension.pl # Auto-generated by xcreateextension.pl SetOutPath "$APPDATA\LibX\content\" File "${EDITION_PATH}config.xml" File "${EDITION_PATH}defaultprefs.xml" SetOutPath "$APPDATA\LibX\" File "/home/www/libx.org/libx/src/editions/tmp2.12768/install.rdf" SetOutPath "$APPDATA\LibX\skin\" File "${EDITION_PATH}msuspartan.ico" File "${EDITION_PATH}logo_msu_pos_122.gif" File "${EDITION_PATH}favicon.ico" SetShellVarContext current # Auto-generated by xcreateextension.pl SetOutPath "$APPDATA\LibX\content\" File "${EDITION_PATH}config.xml" File "${EDITION_PATH}defaultprefs.xml" SetOutPath "$APPDATA\LibX\" File "/home/www/libx.org/libx/src/editions/tmp2.12768/install.rdf" SetOutPath "$APPDATA\LibX\skin\" File "${EDITION_PATH}msuspartan.ico" File "${EDITION_PATH}logo_msu_pos_122.gif" File "${EDITION_PATH}favicon.ico" SectionEnd Section "Permission" SEC05 # Set the permission for each file such that the Users group has read access SetShellVarContext all nsExec::ExecToLog '"$SYSDIR\cacls.exe $APPDATA\LibX /E /T /G Users:R"' SectionEnd Section "Readme" SEC06 SetShellVarContext current SetOutPath "$APPDATA\LibX\" File "${DLL_PATH}\README.txt" SectionEnd Section -Post # Post-install registry manipulation SetOutPath "$INSTDIR" WriteUninstaller "$INSTDIR\uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" #Let's turn off some IE security hacks (er, I mean features) WriteRegDWORD HKLM "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_LOCALMACHINE_LOCKDOWN" \ "LibXIE.dll" 0x0 #Store install location WriteRegStr HKCU "${PRODUCT_REGISTRY_KEY}" "Directory" $INSTDIR # Register in GAC and for interop nsExec::ExecToLog '"$INSTDIR\Register.bat"' SectionEnd ##############Uninstall Function un.onInit MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \ "Uninstalling the LibX toolbar for IE will completely remove the toolbar and all its functionality for all users. Continue?" \ /SD IDYES IDYES +2 Abort FunctionEnd Function un.onUninstSuccess HideWindow MessageBox MB_ICONINFORMATION|MB_OK \ "LibX for IE was successfully removed from your computer." \ /SD IDOK FunctionEnd Section Uninstall SetOutPath "$INSTDIR" # Deregister nsExec::ExecToLog '"$INSTDIR\Unregister.bat"' SetOutPath "$TEMP" # Remove edition files (this is expanded by xcreateextension.pl) SetShellVarContext all # Auto-generated by xcreateextension.pl Delete "$APPDATA\LibX\content\config.xml" Delete "$APPDATA\LibX\content\defaultprefs.xml" Delete "$APPDATA\LibX\install.rdf" Delete "$APPDATA\LibX\skin\msuspartan.ico" Delete "$APPDATA\LibX\skin\logo_msu_pos_122.gif" Delete "$APPDATA\LibX\skin\favicon.ico" SetShellVarContext current # Auto-generated by xcreateextension.pl Delete "$APPDATA\LibX\content\config.xml" Delete "$APPDATA\LibX\content\defaultprefs.xml" Delete "$APPDATA\LibX\install.rdf" Delete "$APPDATA\LibX\skin\msuspartan.ico" Delete "$APPDATA\LibX\skin\logo_msu_pos_122.gif" Delete "$APPDATA\LibX\skin\favicon.ico" # Remove files from all users directory (while this should have been in a # function, NSIS has some problem with function naming and resolving in the # uninstall section) SetShellVarContext all Delete "$APPDATA\LibX\content\catalogs\*.js" Delete "$APPDATA\LibX\content\*.js" Delete "$INSTDIR\installLog.txt" Delete "$INSTDIR\uninst.exe" Delete "$INSTDIR\ja\LibXIE.resources.dll" Delete "$INSTDIR\en-US\LibXIE.resources.dll" Delete "$INSTDIR\Interop.SHDocVw.dll" Delete "$INSTDIR\Interop.MSXML2.dll" Delete "$INSTDIR\Microsoft.mshtml.dll" Delete "$INSTDIR\ActivScp.dll" Delete "$INSTDIR\LibXIE.dll" Delete "$INSTDIR\stdole.dll" Delete "$INSTDIR\GACMeUp.exe" Delete "$INSTDIR\Register.bat" Delete "$INSTDIR\Unregister.bat" RMDir "$APPDATA\LibX\ja" RMDir "$APPDATA\LibX\en-US" RMDir "$APPDATA\LibX\skin" RMDir "$APPDATA\LibX\content\catalogs" RMDir "$APPDATA\LibX\content" RMDir /r "$APPDATA\LibX\locale" RMDir "$APPDATA\LibX" RMDir "$INSTDIR" # Remove files from current user's directory SetShellVarContext current Delete "$APPDATA\LibX\content\catalogs\*.js" Delete "$APPDATA\LibX\content\*.js" Delete "$INSTDIR\installLog.txt" Delete "$INSTDIR\uninst.exe" Delete "$INSTDIR\ja\LibXIE.resources.dll" Delete "$INSTDIR\en-US\LibXIE.resources.dll" Delete "$INSTDIR\Interop.SHDocVw.dll" Delete "$INSTDIR\Interop.MSXML2.dll" Delete "$INSTDIR\Microsoft.mshtml.dll" Delete "$INSTDIR\ActivScp.dll" Delete "$INSTDIR\LibXIE.dll" Delete "$INSTDIR\stdole.dll" Delete "$INSTDIR\GACMeUp.exe" Delete "$INSTDIR\Register.bat" Delete "$INSTDIR\Unregister.bat" RMDir "$APPDATA\LibX\ja" RMDir "$APPDATA\LibX\en-US" RMDir "$APPDATA\LibX\skin" RMDir "$APPDATA\LibX\content\catalogs" RMDir "$APPDATA\LibX\content" RMDir /r "$APPDATA\LibX\locale" RMDir "$APPDATA\LibX" RMDir "$INSTDIR" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" SetAutoClose true SectionEnd