This is not a real fix. I still haven't figured out why a `connection
reset by peer` happens in the first place. `target.Reboot()` will still
block for a bit before giving up. At least it doesn't falsely report a
fail now.
Also moved canc() up so the terminal isn't littered with `[update boot
file system] 0.00% of 16 MiB, uploading at 0 B/s` during the wait.
Related: https://github.com/gokrazy/gokrazy/issues/199
We do this by using the dirhash package, but filtering out any hidden
files (starting with .) and using hash/fnv because we are not interested in
cryptographically secure hashes of local directory contents, just whether the
contents changed.
fixes https://github.com/gokrazy/gokrazy/issues/171
gaf is the new gokrazy archive format output type.
It is immagined for storage and upgrade.
A single, uncompressed zip archive files that contains:
- the MBR image (mbr.img)
- the boot image (boot.img)
- the root image (root.img)
- the SBOM of the gokrazy build (sbom.json)
It is lighter in size than a "full" disk image (it doesn't have the
partition filling bits).
It contains all the necessary bits to upgrade a gokrazy instance (all it
takes is the 3 imgs).
It can be directly accessed for a single file extraction (non compressed
zip property).
It can be easily unarchived by gokrazy appliances (cheap unzipping).
It is easy to verify what the build contains (SBOM alongside to be read).
Without passing $HOME into the `sudo` invocation the instance parent
directory detection
(https://github.com/gokrazy/internal/blob/main/instanceflag/instanceflag.go#L19)
fails:
$ gok -i test overwrite --full /dev/sdc
[..]
2023/01/25 22:13:04 partitioning /dev/sdc (GPT + Hybrid MBR)
2023/01/25 22:13:04 Using sudo to gain permission to format /dev/sdc
2023/01/25 22:13:04 If you prefer, cancel and use: sudo setfacl -m u:${USER}:rw /dev/sdc
2023/01/25 22:13:04 open os.UserHomeDir failed: $HOME is not defined/gokrazy/test/config.json: no such file or directory
2023/01/25 22:13:04 exit status 1
This commit does the necessary passing.
The instance hostname is the logical hostname of the instance, e.g. consrv,
whereas the update hostname is the way to cross the network to get to said
instance, e.g. consrv.monkey-turtle.ts.net (on port 2345).