feat: add timestamp to installed file

This adds a timestamp to /boot/installed. It can be useful for
determining the last known successful install.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
This commit is contained in:
Andrew Rynhard 2019-11-03 18:05:40 +00:00
parent 45a3406fba
commit 3ce6f34995

View File

@ -10,6 +10,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"time"
"unsafe"
"golang.org/x/sys/unix"
@ -131,7 +132,7 @@ func (i *Installer) Install() (err error) {
return err
}
if err = ioutil.WriteFile(filepath.Join(constants.BootMountPoint, "installed"), []byte{}, 0400); err != nil {
if err = ioutil.WriteFile(filepath.Join(constants.BootMountPoint, "installed"), []byte(time.Now().String()), 0400); err != nil {
return err
}