You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 25, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: middleware/cmd/middleware/main.go
+8-31Lines changed: 8 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -31,25 +31,20 @@ func main() {
31
31
imageUpdateInfoURL:=flag.String("updateinfourl", "https://shiftcrypto.ch/updates/base.json", "URL to query information about Base image updates from")
32
32
notificationNamedPipePath:=flag.String("notificationNamedPipePath", "/tmp/middleware-notification.pipe", "Path where the Middleware creates a named pipe to receive notifications from other processes on the BitBoxBase")
33
33
hsmSerialPort:=flag.String("hsmserialport", "/dev/ttyS0", "Serial port used to communicate with the HSM")
34
+
// hsmFirmwareFile and upgradeHSMFirmware options are to be used only for manually installing the hsm firmare
35
+
// Otherwise firmare is upgraded automatically on boot when new version is specified in Redis hsm:firmware:version
34
36
hsmFirmwareFile:=flag.String("hsmfirmwarefile", "/opt/shift/hsm/firmware-bitboxbase.signed.bin", "Location of the signed HSM firmware binary")
35
-
updateHSMFirmware:=flag.Bool("updatehsmfirmware", false, "Set to true to force HSM firmware update")
37
+
upgradeHSMFirmware:=flag.Bool("upgradehsmfirmware", false, "Set to true to force HSM firmware upgrade")
36
38
flag.Parse()
37
39
38
40
hsm:=hsm.NewHSM(*hsmSerialPort)
39
-
if*updateHSMFirmware {
40
-
err:=hsm.UpdateFirmware(*hsmFirmwareFile)
41
+
if*upgradeHSMFirmware {
42
+
err:=hsm.UpgradeFirmware(*hsmFirmwareFile)
41
43
iferr!=nil {
42
-
log.Printf("Failed to update HSM firmware: %s", err)
44
+
log.Printf("Failed to upgrade HSM firmware: %s", err)
43
45
}
44
46
}
45
47
46
-
hsmFirmware, err:=hsm.WaitForFirmware()
47
-
iferr!=nil {
48
-
log.Printf("Failed to connect to the HSM firmware: %v. Continuing without HSM.", err)
log.Fatalf("error starting the middleware: %s . Is redis connected? \nIf you are running the middleware outside of the base consider setting the redis mock flag to true: '-redismock true' .", err.Error())
83
79
}
84
80
log.Println("--------------- Started middleware --------------")
85
81
86
-
// Check for available hsm firmware update on middleware boot and update if available
0 commit comments