From e6d8fabbab7db1724b6ff6c6501a8d68d0aef235 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Mon, 16 Jul 2018 15:21:30 +0200
Subject: [PATCH] Add more information to update marker file

In addition to the previously added package name / path, the marker file
now gets populated with the following:

- host name (redundant, but easy to parse from here)
- the time stamp when the update happened
- build commit
- build configuration

The encoding of the file is changed to be ASCII, otherwise PowerShell always
places the ugly BOM (byte-order-mark) at the beginning, confusing a lot of
editors.

Fixes #46
---
 Updater/Update-Service.ps1 | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/Updater/Update-Service.ps1 b/Updater/Update-Service.ps1
index 298c025..ddcb850 100644
--- a/Updater/Update-Service.ps1
+++ b/Updater/Update-Service.ps1
@@ -449,8 +449,26 @@ function Update-ServiceBinaries {
 
     $MarkerFile = "$($UpdPathMarkerFiles)\$($env:COMPUTERNAME)"
     try {
+        try {
+            $BuildCommit = Get-Content $UpdPackage\BuildCommit.txt
+        }
+        catch {
+            $BuildCommit = "UNKNOWN"
+        }
+        try {
+            $BuildConfig = Get-Content $UpdPackage\BuildConfiguration.txt
+        }
+        catch {
+            $BuildConfig = "UNKNOWN"
+        }
         New-Item -Type File "$MarkerFile" | Out-Null
-        Write-Output "Installed package: $($UpdPackage)" | Out-File $MarkerFile
+        Write-Output "$($Me): running AutoTx service update" `
+            "  - Host: $($env:COMPUTERNAME)" `
+            "  - Updater Run Timestamp: $(Get-Date -Format o)" `
+            "  - Build Commit: $($BuildCommit)" `
+            "  - Build Configuration: $($BuildConfig)" `
+            "  - Package Name: $($UpdPackage)" `
+            | Out-File -Encoding ASCII $MarkerFile
         Log-Debug "Created marker file [$($MarkerFile)]."
     }
     catch {
-- 
GitLab