Michael Stapelberg
05762f796b
packer: initialize pack.Pack correctly in sudo child process
...
fixes https://github.com/gokrazy/gokrazy/issues/170
2023-02-06 22:47:48 +01:00
Mark Drayton
b369a67fef
pull in latest gokrazy/updater for gok run flag passing
2023-02-06 20:54:01 +01:00
Mark Drayton
8c7ed9ae16
gok: pass command line flags to run
2023-02-06 20:54:01 +01:00
Michael Stapelberg
2ab27fd29e
pull in latest gokrazy/internal
...
related to https://github.com/gokrazy/tools/issues/47
2023-02-06 08:44:32 +01:00
Michael Stapelberg
2b269a6d8d
correctly plumb through config struct to GenerateSBOM
2023-02-05 21:43:49 +01:00
Michael Stapelberg
20bd48bfb6
include SBOM as /etc/gokrazy/sbom.json
...
related to https://github.com/gokrazy/gokrazy/issues/167
2023-02-05 16:14:49 +01:00
Michael Stapelberg
f9ec9d9abf
pull in latest gokrazy/internal
...
related to https://github.com/gokrazy/gokrazy/issues/167
2023-02-05 16:04:18 +01:00
Damiano Donati
7e4c5df8fb
gok overwrite: add gaf as output format
...
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).
2023-02-05 13:51:32 +01:00
Damiano Donati
239461d80e
packer: use Pack as receiver for Main and logic
2023-02-05 13:51:32 +01:00
Damiano Donati
db4f55e31a
gok sbom: prefactor mv GenerateSBOM to internal/packer
2023-02-05 13:51:32 +01:00
Michael Stapelberg
ca01203cad
gok: add sbom subcommand
2023-01-29 21:55:42 +01:00
Michael Stapelberg
86691439bf
drop github.com/gokrazy/gokrazy dependency
...
This should not make a difference with Go modules enabled,
which should be the case for all running gokrazy installations.
2023-01-29 19:42:57 +01:00
Michael Stapelberg
ce2433aa1a
gok: move code to internal/gok
2023-01-29 19:30:23 +01:00
Mark Drayton
a515c601c0
parttable: pass HOME env var to sudo ( #44 )
...
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.
2023-01-25 23:22:13 +01:00
Michael Stapelberg
5499f548a3
pull in latest gokrazy/internal for httpclient.For fix
2023-01-22 18:31:59 +01:00
Michael Stapelberg
d5f9cee29d
gok: use config.NewStruct()
...
related to https://github.com/gokrazy/tools/issues/43
2023-01-17 19:05:43 +01:00
Michael Stapelberg
45ce7ad200
implement 'gok get' subcommand
...
fixes https://github.com/gokrazy/gokrazy/issues/162
2023-01-15 18:27:02 +01:00
Michael Stapelberg
d9681ee8cb
gok run, logs: remove --update flag in favor of --instance
2023-01-15 17:15:52 +01:00
Michael Stapelberg
f354e13fdf
packer: get host fallback from instance hostname, not update host
...
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).
2023-01-15 16:55:25 +01:00
Michael Stapelberg
bdb14f7080
use new httpclient.For() instead of GetHTTPClientForInstance()
2023-01-15 16:41:49 +01:00
Michael Stapelberg
5e5fb5cf29
packer: use the httpclient package directly
2023-01-15 16:26:10 +01:00
Michael Stapelberg
4f93af68c8
packer: set HTTP(S)Port fallback values after host-specific fallback
2023-01-15 16:15:42 +01:00
Michael Stapelberg
c61213349c
provide a programmatic entry point to the gok CLI
...
This interfaces with spf13/cobra without typing ourselves to its types, and
exerting control (for better of for worse) about what aspects one can control.
With this, we can move the code in cmd to internal/
2023-01-15 15:55:51 +01:00
Michael Stapelberg
10ba0192aa
gok new: generate a machine-id(5) by default
2023-01-15 14:44:44 +01:00
Michael Stapelberg
e11eeb6a52
localtime: document why time/tzdata does not help
2023-01-15 14:12:11 +01:00
Michael Stapelberg
b89d9dc6e0
README: remove outdated documentation, reference website
2023-01-14 09:28:20 +01:00
Michael Stapelberg
8c217798be
pull in latest gokrazy/internal
2023-01-14 09:12:25 +01:00
Michael Stapelberg
a84f008488
identify gokrazy packer vs. gok in log output
2023-01-10 20:41:41 +01:00
Michael Stapelberg
8f9863a4c2
Config.Update.Hostname: fall back to Config.Hostname if empty
2023-01-07 18:59:26 +01:00
Michael Stapelberg
8471dd27bc
internal: pull cert.pem/key.pem fix
2023-01-07 18:50:11 +01:00
Michael Stapelberg
444a52a283
gok add: store go.mod at package level for local disk additions
...
This way, non-local and local operate at the same hierarchy level, which means
you can switch from non-local to local override.
2023-01-07 18:50:11 +01:00
Michael Stapelberg
b169c0894c
use two dashes for flags in error messages
...
That way, they work for cobra (gok) and Go flag parsing (gokr-packer).
2023-01-07 18:50:11 +01:00
Michael Stapelberg
9ed9d3b936
internal/version: pull git revision out of module version, too
...
Before this commit, the version would be blank when built as a Go module.
2023-01-07 18:50:11 +01:00
Michael Stapelberg
41ef295683
pull in latest gokrazy/internal
2023-01-07 18:50:11 +01:00
Michael Stapelberg
05070adf9d
gokr-packer: convert common -update URLs to config.Update fields
2023-01-07 18:50:11 +01:00
Michael Stapelberg
12d755c6e9
gok run: read instance config to set build flags/tags
2023-01-07 16:16:46 +01:00
Michael Stapelberg
2cce27b0b0
add Makefile with a few example invocation make targets
2023-01-07 16:16:46 +01:00
Michael Stapelberg
7d22eb8e32
add integration test for gokr-packer and its migration path
2023-01-07 16:16:46 +01:00
Michael Stapelberg
5b3aa31300
populate PackageConfig for packer logic / writing config.json
2023-01-07 16:16:46 +01:00
Michael Stapelberg
2b958254f0
gok add: copy replace directives from local go.mod
...
This fixes the build of github.com/evcc-io/evcc, which doesn’t build without
the replace directives from its go.mod file.
2023-01-07 16:16:46 +01:00
Michael Stapelberg
e3e0c0fb2a
gok add: create go.mod in non-local mode, too
...
The go tool needs a go.mod to function.
2023-01-07 16:16:46 +01:00
Michael Stapelberg
1b8e74f331
gok add: use go mod edit instead of go get for adding require line
...
Adding the require line using `go get` does not work for
https://github.com/evcc-io/evcc as of commit
504ed7172efdd6e849985280a21feccbbf455b9d:
panic: internal error: can't find reason for requirement on
github.com/rogpeppe/go-internal@v1.6.1.
2023-01-07 16:16:46 +01:00
Michael Stapelberg
496c018caf
remove Env
2023-01-07 16:01:39 +01:00
Michael Stapelberg
1194a73d20
group commands in gok help output
2023-01-07 16:01:39 +01:00
Michael Stapelberg
d4fa52f791
uppercase HTTP(S)
2023-01-07 16:01:39 +01:00
Michael Stapelberg
ec011de8da
gok new: create config.json with 0600 permissions
...
The instance config contains the device password.
2023-01-07 16:01:39 +01:00
Michael Stapelberg
c72e5e19f4
rename instance_dir to parent_dir, to make its role clearer
2023-01-07 16:01:39 +01:00
Michael Stapelberg
dc4131ed8b
implement gok add
2023-01-07 16:01:39 +01:00
Michael Stapelberg
a2832b7d25
move left-over flags
2023-01-07 16:01:39 +01:00
Michael Stapelberg
3a96e0840b
implement gok edit
2023-01-07 16:01:39 +01:00