lp1825891 Hatch Windows Installer ProgramData logs user/berick/lp1825896-hatch-workstations-hostname
authorKyle Huckins <khuckins@catalyte.io>
Thu, 2 May 2019 21:11:09 +0000 (21:11 +0000)
committerBill Erickson <berickxx@gmail.com>
Mon, 13 May 2019 17:01:54 +0000 (13:01 -0400)
- Create ProgramData/Hatch dir and associated registry key upon installation
- Remove ProgramData/Hatch dir upon uninstallation
- Set hatch.properties and logging.properties data directory and logging path
to ProgramData/Hatch(/hatch.log)

Signed-off-by: Kyle Huckins <khuckins@catalyte.io>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
 Changes to be committed:
modified:   installer/windows/hatch.nsi

installer/windows/hatch.nsi

index f5e9e11..08ef332 100644 (file)
@@ -115,8 +115,17 @@ section "install"
     !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"
+    ; Set logging to be in ProgramData
+    SetShellVarContext all
+    ${IfNot} ${FileExists} "$APPDATA\${APPNAME}"
+        CreateDirectory "$APPDATA\${APPNAME}"
+    ${EndIf}
+    !insertmacro _ReplaceInFile  "$INSTDIR\hatch.properties" "#data.directory=/tmp/foo" "data.directory=C://ProgramData//${APPNAME}"
+    !insertmacro _ReplaceInFile  "$INSTDIR\logging.properties" "%h/.evergreen/hatch.log" "C://ProgramData//${APPNAME}//hatch.log"
 
     ; Registry info for Add/Remove Programs
+    WriteRegStr HKLM "SOFTWARE\${COMPANYNAME}\${APPNAME}" "Logging Path" $APPDATA
+    SetShellVarContext current
     WriteRegStr HKLM "SOFTWARE\${COMPANYNAME}\${APPNAME}" "Install Path" $INSTDIR
     WriteRegStr HKLM "SOFTWARE\${COMPANYNAME}\${APPNAME}" "Version" "${FULLVERSION}"
     WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${COMPANYNAME} - ${APPNAME} - ${DESCRIPTION}"
@@ -177,6 +186,13 @@ function un.onInit
 functionEnd
 
 section "uninstall"
+    # Remove the data log directory
+    SetShellVarContext all
+    ${If} ${FileExists} "$APPDATA\${APPNAME}"
+        RmDir /r /REBOOTOK "$APPDATA\${APPNAME}"
+    ${EndIf}
+    SetShellVarContext current
+
     # Remove the actual files
     Delete /REBOOTOK "$INSTDIR\hatch.bat"
     Delete /REBOOTOK "$INSTDIR\hatch.properties"