/**
* Called when the connection to Hatch goes away.
*/
-function onDisconnected() {
- console.warn("Hatch disconnected: " + chrome.runtime.lastError.message);
+function onDisconnected(port) {
+ var reason = "unspecified reason";
+
+ if (port && port.error) {
+ reason = port.error.message;
+ } else if (chrome.runtime.lastError) {
+ reason = chrome.runtime.lastError.message;
+ }
+
+ console.warn("Hatch disconnected: " + reason);
hatchPort = null;
+ // Firefox gives some indication a NativeMessaging app doesn't exist, does Chrome? (port.error.message starts with No such...)
if (hatchHostUnavailable) return;
// If we can reasonablly assume a connection to the Hatch host
; Find any installed JRE/JDK and return the version or -1
Function DetectJava
+ ; FYI: Because it appears there won't ever be a 64 bit version of makensis for linux
+ ; this script assumes that it will always be run as part of a 32 bit installer.
+ ; If that should ever change this script will require some significant adjustment.
+
; 32 bit JRE >= 9
ReadRegStr $0 HKLM "SOFTWARE\JavaSoft\JRE" "CurrentVersion"
StrCmp $0 "" +1 Found
File ..\..\hatch.bat
File ..\..\hatch.properties
File ..\..\logging.properties
-
- ; Set path variable in org.ils_evergreen.hatch.json to $INSTDIR\hatch.bat
- ${StrRep} '$0' '$INSTDIR' '\' '\\'
- !insertmacro _ReplaceInFile "$INSTDIR\extension\host\org.evergreen_ils.hatch.json" "/path/to/hatch.sh" "$0\\hatch.bat"
- AccessControl::EnableFileInheritance "$INSTDIR\extension\host\org.evergreen_ils.hatch.json"
- ; Uninstaller
- writeUninstaller "$INSTDIR\Uninstall ${APPNAME}.exe"
+ ; Set path variable in org.ils_evergreen.hatch.*.json to $INSTDIR\hatch.bat
+ ${StrRep} '$0' '$INSTDIR' '\' '\\'
+ !insertmacro _ReplaceInFile "$INSTDIR\extension\host\org.evergreen_ils.hatch.chrome.json" "/path/to/hatch.sh" "$0\\hatch.bat"
+ !insertmacro _ReplaceInFile "$INSTDIR\extension\host\org.evergreen_ils.hatch.firefox.json" "/path/to/hatch.sh" "$0\\hatch.bat"
+ AccessControl::EnableFileInheritance "$INSTDIR\extension\host\org.evergreen_ils.hatch.chrome.json"
+ AccessControl::EnableFileInheritance "$INSTDIR\extension\host\org.evergreen_ils.hatch.firefox.json"
; Registry info for Add/Remove Programs
WriteRegStr HKLM "SOFTWARE\${COMPANYNAME}\${APPNAME}" "Install Path" $INSTDIR
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
; Connect Hatch to Chrome and install the Hatch extension from the Chrome Web Store
- WriteRegStr HKLM "SOFTWARE\Google\Chrome\NativeMessagingHosts\org.evergreen_ils.hatch" "" "$INSTDIR\extension\host\org.evergreen_ils.hatch.json"
+ WriteRegStr HKLM "SOFTWARE\Google\Chrome\NativeMessagingHosts\org.evergreen_ils.hatch" "" "$INSTDIR\extension\host\org.evergreen_ils.hatch.chrome.json"
WriteRegStr HKLM "Software\Google\Chrome\Extensions\${EXTENSIONID}" "update_url" "${EXTENSION_UPDATEURL}"
+
+ ; Firefox won't check both the 32 and 64 bit views, so it's on us to put the key in the right place.
+ ; Firefox doesn't allow automatic installation of remote extensions either, so there's no (good) auto-install option here. :-/
+ ; A link should be added to the web client to simplify locating the FF extension. (Links to both would likely be a good practice.)
+ ${If} ${RunningX64}
+ SetRegView 64
+ ${EndIf}
+
+ WriteRegStr HKLM "SOFTWARE\Mozilla\NativeMessagingHosts\org.evergreen_ils.hatch" "" "$INSTDIR\extension\host\org.evergreen_ils.hatch.firefox.json"
+
+ ${If} ${RunningX64}
+ SetRegView 32
+ ${EndIf}
+
+ ; Uninstaller
+ writeUninstaller "$INSTDIR\Uninstall ${APPNAME}.exe"
+
SectionEnd
function un.onInit
SetShellVarContext all
-
+
# Verify uninstaller
MessageBox MB_OKCANCEL "Permanently remove ${APPNAME}?" /SD IDOK IDOK next
Abort
!insertmacro VerifyUserIsAdmin
functionEnd
-section "uninstall"
+section "uninstall"
# Remove the actual files
Delete /REBOOTOK "$INSTDIR\hatch.bat"
Delete /REBOOTOK "$INSTDIR\hatch.properties"
RmDir /r /REBOOTOK "$INSTDIR\lib"
# Delete uninstaller last
Delete /REBOOTOK "$INSTDIR\Uninstall ${APPNAME}.exe"
-
+
# Remove installation directory
RmDir /REBOOTOK "$INSTDIR"
-
+
# Remove uninstaller info from registry
DeleteRegKey HKLM "SOFTWARE\${COMPANYNAME}\${APPNAME}"
DeleteRegKey HKLM "SOFTWARE\${COMPANYNAME}"
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
DeleteRegKey HKLM "SOFTWARE\Google\Chrome\NativeMessagingHosts\org.evergreen_ils.hatch"
DeleteRegKey HKLM "SOFTWARE\Google\Chrome\Extensions\${EXTENSIONID}"
+
${If} ${RunningX64}
- DeleteRegKey HKLM "SOFTWARE\Wow6432Node\Google\Chrome\Extensions\${EXTENSIONID}"
+ SetRegView 64
+ ${EndIf}
+
+ DeleteRegKey HKLM "SOFTWARE\Mozilla\NativeMessagingHosts\org.evergreen_ils.hatch"
+
+ ${If} ${RunningX64}
+ SetRegView 32
${EndIf}
IfRebootFlag 0 Done
Reboot
Done:
-
+
sectionEnd