= Hatch Install Documentation =
This documentation assumes Windows users will use the Hatch Windows
-installer. The xref:linux[Linux]-only steps can also be done on Windows, but
-are not documented here.
+installer. The xref:linux[Linux]-only steps can also be done on Windows
+from a source checkout but are not documented here.
== Windows ==
NOTE: See installer/windows/README.adoc for building the Windows
installer from Linux or Windows. When building the Windows installer
-on Windows, the full JDK will be required (for compiling Java).
+on Windows a full JDK is required for compiling.
==== Optional: Test Hatch ====
[source,sh]
-------------------------------------------------------------------------
C:\>cd %ProgramFiles(x86)%\Hatch
-C:\Program Files (x86)\Hatch>hatch.sh test
+C:\Program Files (x86)\Hatch>hatch.bat test
-------------------------------------------------------------------------
=== Install Chrome Extension ===
If the extension was not installed automatically when installing Hatch you can get it directly in the browser from the
-https://chrome.google.com/webstore/detail/hatch-native-messenger/ppooibdipmklfichpmkcgplfgdplgahl[Chrome App Store]
+https://chrome.google.com/webstore/detail/hatch-native-messenger/ppooibdipmklfichpmkcgplfgdplgahl[Chrome App Store].
+
+=== Install Firefox Extension ===
+
+The Firefox extension can not be installed automatically by the native application installer;
+https://addons.mozilla.org/en-US/firefox/addon/hatch-native-messenger/[it is available on the Firefox Addons site].
=== Continue with xref:using-hatch[Using Hatch] ===
=== Configure Native Messaging ===
-Edit extension/host/org.evergreen_ils.hatch.json and change the "path"
+Edit extension/host/org.evergreen_ils.hatch.(chrome|firefox).json and change the "path"
value to match the location of your copy of "hatch.sh", found in the root
directory of the Hatch repository.
-Copy the host file into Chrome's configuration directory.
+Copy the correct host file, changing the filename to org.evergreen_ils.hatch.json, into the browser's configuration directory.
For Chrome:
[source,sh]
-------------------------------------------------------------------------
$ mkdir -p ~/.config/google-chrome/NativeMessagingHosts/
-$ cp extension/host/org.evergreen_ils.hatch.json ~/.config/google-chrome/NativeMessagingHosts/
+$ cp extension/host/org.evergreen_ils.hatch.chrome.json ~/.config/google-chrome/NativeMessagingHosts/org.evergreen_ils.hatch.json
-------------------------------------------------------------------------
For Chromium:
[source,sh]
-------------------------------------------------------------------------
$ mkdir -p ~/.config/chromium/NativeMessagingHosts/
-$ cp extension/host/org.evergreen_ils.hatch.json ~/.config/chromium/NativeMessagingHosts/
+$ cp extension/host/org.evergreen_ils.hatch.chrome.json ~/.config/chromium/NativeMessagingHosts/org.evergreen_ils.hatch.json
+-------------------------------------------------------------------------
+
+For Firefox:
+
+[source,sh]
+-------------------------------------------------------------------------
+$ mkdir -p ~/.mozilla/native-messaging-hosts/
+$ cp extension/host/org.evergreen_ils.hatch.firefox.json ~/.mozilla/native-messaging-hosts/org.evergreen_ils.hatch.json
-------------------------------------------------------------------------
=== Install Chrome Extension ===
-Install the exenstion directly in the browser from the
-https://chrome.google.com/webstore/detail/hatch-native-messenger/ppooibdipmklfichpmkcgplfgdplgahl[Chrome App Store]
+Install the Chrome exenstion directly from the
+https://chrome.google.com/webstore/detail/hatch-native-messenger/ppooibdipmklfichpmkcgplfgdplgahl[Chrome App Store].
+
+=== Install Firefox Extension ===
+
+Install the Firefox extension from the
+https://addons.mozilla.org/en-US/firefox/addon/hatch-native-messenger/[Firefox Addons site].
==== Optional: Test Hatch ====
NOTE: print commands are disabled by default in the tests to avoid
-unexpected printing, but they can be added by un-commenting
+unexpected printing but they can be added by un-commenting
them in src/org/evergreen_ils/hatch/TestHatch.java and recompiling.
[source,sh]
"Connecting to native messaging host: org.evergreen_ils.hatch"
in the Background Page console with no errors.
* Use the "Reload" link to apply local changes made to the
- extension (e.g. main.js). (This might only work when installing
+ extension (e.g. extension.js). (This might only work when installing
the exention manually via developer mode tools).
* See also https://developer.chrome.com/extensions/getstarted
/**
* 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
{
"name": "Hatch Native Messenger",
- "version": "0.1.5",
+ "version": "0.2.0",
"manifest_version": 2,
- "description": "Relays messages to/from Hatch.",
+ "description": "Relays messages to/from the Hatch native printing service for the Evergreen ILS web client.",
"icons": {
- "16": "hatch_icon_16.png",
- "48": "hatch_icon_48.png",
- "128": "hatch_icon_128.png"
+ "48": "icon_48.png",
+ "96": "icon_96.png",
+ "128": "icon_128.png"
},
"background" : {
"scripts" : ["extension.js"]
}
],
"browser_action": {
- "default_title": "Hatch"
+ "default_title": "Hatch",
+ "default_icon": {
+ "48": "icon_48.png",
+ "96": "icon_96.png",
+ "128": "icon_128.png"
+ }
},
"permissions": [
"nativeMessaging"
],
+ "applications": {
+ "gecko": {
+ "id": "hatch-native-messenger@evergreen-ils.org",
+ "strict_min_version": "50.0"
+ }
+ },
"minimum_chrome_version": "38"
}
--- /dev/null
+{
+ "name": "org.evergreen_ils.hatch",
+ "description": "Hatch Native Messaging Host",
+ "path": "/path/to/hatch.sh",
+ "type": "stdio",
+ "allowed_origins": [
+ "chrome-extension://ppooibdipmklfichpmkcgplfgdplgahl/"
+ ]
+}
--- /dev/null
+{
+ "name": "org.evergreen_ils.hatch",
+ "description": "Hatch Native Messaging Host",
+ "path": "/path/to/hatch.sh",
+ "type": "stdio",
+ "allowed_extensions": [
+ "hatch-native-messenger@evergreen-ils.org"
+ ]
+}
+++ /dev/null
-{
- "name": "org.evergreen_ils.hatch",
- "description": "Hatch Native Messaging Host",
- "path": "/path/to/hatch.sh",
- "type": "stdio",
- "allowed_origins": [
- "chrome-extension://ppooibdipmklfichpmkcgplfgdplgahl/"
- ]
-}
IF %ERRORLEVEL% EQU 0 GOTO Huzzah
REM I don't blame you
-EXIT %ERRORLEVEL%
+EXIT /B %ERRORLEVEL%
REM There you are.
:Huzzah
-IF "%1" == "compile" (
+REM %~1 means to strip %1 of any surrounding quotes.
+REM This is necessary if you're going to use a construction like "%1" == "etc" because a quoted %1 will
+REM cause silent failures when the batch file is run and dies because the IF command has a syntax error.
+REM Specifically, "Files was unexpected at this time."
+
+IF "%~1" == "compile" (
%JAVAC% -cp "lib\*" -Xdiags:verbose^
-d lib src\org\evergreen_ils\hatch\*.java
) ELSE (
- IF "%1" == "test" (
+ IF "%~1" == "test" (
%JAVA% -cp "lib\*"^
-Djava.util.logging.config.file=logging.properties^
; 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