misc.Exists: bubble up any unexpected errors

Fixes https://gitlab.com/postmarketOS/postmarketos-mkinitfs/-/issues/6
This commit is contained in:
Clayton Craft
2023-02-20 22:39:29 -08:00
parent d87a33a751
commit 06f86aadc9
4 changed files with 35 additions and 11 deletions

View File

@@ -48,9 +48,12 @@ func main() {
}
deviceinfoFile := "/etc/deviceinfo"
if !misc.Exists(deviceinfoFile) {
if exists, err := misc.Exists(deviceinfoFile); !exists {
log.Printf("NOTE: %q not found, this file is required by mkinitfs.\n", deviceinfoFile)
return
} else if err != nil {
retCode = 1
log.Printf("received unexpected error when getting status for %q: %s", deviceinfoFile, err)
}
devinfo, err := deviceinfo.ReadDeviceinfo(deviceinfoFile)