162 Commits
Author SHA1 Message Date
Timmy Welch b0b74af2dd xattr stuff 2026-10-29 00:36:02 -07:00
Timmy Welch e87ec5e2f8 Add support for defining package capabilities 2026-10-29 00:31:45 -07:00
Michael Stapelberg 942a8faaca packer: fix sync'ing on macOS
This regressed with commit 64f7f697df.

Thanks to https://github.com/emcfarlane for the report.

related to https://github.com/gokrazy/gokrazy/issues/22
2026-10-26 20:19:44 +01:00
Michael Stapelberg 64f7f697df internal/packer: add Sync() throughout
I had a case where I unplugged an SD card and it did not boot.
Overwriting it again fixed the issue.
Let’s sync to make it safe to unplug SD cards right after overwrite.
2026-09-13 18:33:31 +02:00
Damiano Donati ef964f3028 gok logs: fix data race on http.Client.CheckRedirect
eventsource.SubscribeWith mutates the passed http.Client's
CheckRedirect field. Since streamLog is called concurrently for
stdout and stderr, this is a data race. Clone the client before
passing it to the library.

Add TestStreamLogConcurrentCancel to exercise both the concurrent
client usage and context cancellation under the race detector.
2026-06-23 08:58:23 +02:00
Damiano Donati 1713398904 gok logs: don't call stream.Close() to avoid send-on-closed-channel panic
The eventsource library's background goroutine may still be sending on
the Events/Errors channels when Close() is called, causing a panic.
Context cancellation already aborts the HTTP request, which makes the
library goroutine exit on its own.

This fixes TestGokRun failing in CI with:
  panic: send on closed channel
2026-06-23 08:58:23 +02:00
Michael Stapelberg f0114ca45e remove last usages of instanceflag.Instance and .ParentDir 2026-06-23 08:47:45 +02:00
Michael Stapelberg 1e355a5051 all: switch from internal/config to internal/instanceflag 2026-06-22 22:53:21 +02:00
Michael Stapelberg a5ced5bbb6 fix tests for previous commit 2026-06-22 20:45:01 +02:00
Michael Stapelberg 7546480cc0 gok: non-global plumbing of instance flag, remove fallback
At this point, I expect that all gokrazy users have long switched
to the instance config mechanism that was introduced years ago.
2026-06-22 08:52:16 +02:00
Michael Stapelberg f279784ff1 gok ps: non-global plumbing of instance flag, remove fallback
At this point, I expect that all gokrazy users have long switched
to the instance config mechanism that was introduced years ago.
2026-06-22 08:41:04 +02:00
Damiano Donati f9838e18ee gok vm: use cpu:host on macOS with Hypervisor.framework (#100)
macOS Hypervisor.framework (HVF) does not support named CPU models
like cortex-a72 in QEMU 10; only host and max are valid.

Use -cpu host when HVF acceleration is active and keep cortex-a72
for all other cases (Linux KVM, cross-arch software emulation).

ref: https://www.qemu.org/docs/master/system/arm/cpu-features.html
2026-06-20 16:10:20 +02:00
Damiano Donati e4396f9c2c feat(packer): add zstd compression support for extrafiles (#102) 2026-06-01 18:18:59 +02:00
Damiano Donati 0f15665dd1 fix(packer): append new extraEEPROM properties to bootconf.txt (#101)
Previously, overwriteBootconf only replaced existing properties but
silently dropped any extraEEPROM lines for properties not already
present in the upstream bootconf.txt. Now, new properties are appended
at the end in user-specified order.
2026-05-24 18:28:32 +02:00
Michael Stapelberg 5861e2403d gok run: add -watch flag to cap the duration of the log streaming 2026-04-06 17:53:13 +02:00
Ami Fischman 8ed49b4faf gok add: don't add packages that are already part of default GokrazyPackages. (#97)
Adds an integration test for `gok add`.

fixes https://github.com/gokrazy/gokrazy/issues/356
2026-01-09 19:06:32 +01:00
Michael Stapelberg ba6a8936f4 packer: do not check for HTTP→HTTPS redirect
This check was broken: it tried to construct a http URL
by changing the updateBaseUrl schema instead of constructing
such a URL based on the configured HTTPPort.

I also don’t think this check is useful:
HTTPS will be used for updates regardless of the check.
Even if an attacker intercepted HTTP traffic and removed the redirect,
that has no bearing on the update, so why bother checking.

One thing the check (implicitly) did is the required fallback
on initial installation when --insecure is specified.
We now solve that by falling back from HTTPS to HTTP explicitly
(only when --insecure is specified, of course).

related to https://github.com/gokrazy/tools/pull/94
2025-12-09 17:11:22 +01:00
Michael Stapelberg 0daf1b1ae4 packer: stop using tlsflag global state 2025-12-08 21:32:59 +01:00
Michael Stapelberg 8320e69ccc packer: move error check closer to error assignment 2025-12-08 20:58:14 +01:00
Michael Stapelberg 0a82ebcb52 remove stale comment
git commit 87444dca50 accidentally
removed the code (partuuid = 0), but not the comment.
2025-12-08 20:57:45 +01:00
Michael Stapelberg 715673f4b5 packer: clean up sbomHook hack 2025-12-06 21:54:52 +01:00
Michael Stapelberg 2848fa1a69 packer: move findPackageFiles to packerprepare.go 2025-12-06 21:38:46 +01:00
Michael Stapelberg ab66901132 packer: move find* to packerprepare.go 2025-12-06 21:37:13 +01:00
Michael Stapelberg 0bb33e2ae8 packer: move addToFileInfo to write.go 2025-12-06 21:35:56 +01:00
Michael Stapelberg 6ae03bee7a packer: move countingWriter to packerwrite.go 2025-12-06 21:32:21 +01:00
Michael Stapelberg 4fab9e7759 packer: move find* to packerprepare.go 2025-12-06 21:28:53 +01:00
Michael Stapelberg cfba731eae packer: move partitionPath to packerwrite.go 2025-12-06 21:23:36 +01:00
Michael Stapelberg bd1faa7647 packer: move overwrite{File,Device} to packerwrite.go 2025-12-06 21:21:00 +01:00
Michael Stapelberg 3def6ed054 packer: move printHowToInteract to packerwrite.go 2025-12-06 21:17:15 +01:00
Michael Stapelberg 8b448cc312 packer: move update into packerupdate.go 2025-12-06 21:16:38 +01:00
Michael Stapelberg df53492c98 packer: move write into packerwrite.go 2025-12-06 21:14:44 +01:00
Michael Stapelberg f5ddd27c7e packer: move build into packerbuild.go 2025-12-06 21:12:44 +01:00
Michael Stapelberg 23ac917f5b packer: move prepare into packerprepare.go 2025-12-06 21:11:31 +01:00
Michael Stapelberg 485405edac cleanup: remove unused parameters 2025-12-06 21:09:00 +01:00
Michael Stapelberg 45b2b940f6 cleanup: move write{Boot,Root}File next to write{Boot,Root} 2025-12-06 21:04:34 +01:00
Michael Stapelberg 67382a6dbe cleanup: move kernel GOARCH validation code into its own file 2025-12-06 20:59:01 +01:00
Michael Stapelberg b513356080 refactor: split printHowToInteract into its own method
Also remove duplicate URL construction code
2025-12-06 20:55:30 +01:00
Michael Stapelberg cbfacd97a6 refactor: split logicUpdate into a separate method 2025-12-06 20:42:09 +01:00
Michael Stapelberg 1921f918ee cleanup: inline programName now that the old packer is gone 2025-12-06 20:23:57 +01:00
Michael Stapelberg 9e3ab11076 packer: add test for losing HTTPS certificates
related to https://github.com/gokrazy/tools/pull/68
2025-12-06 08:49:22 +01:00
julienrbrt 9c9a33515b fix partuuid probing with --insecure after losing HTTPS certificates (#68) 2025-12-06 08:48:38 +01:00
Michael Stapelberg 52cab9f145 packer: stop using updateflag global state
related to https://github.com/gokrazy/tools/pull/68
2025-12-06 08:37:24 +01:00
Michael Stapelberg 91c487c959 packer: use HTTPS client despite -insecure (post-update) (+test)
While adding the integration test for
https://gokrazy.org/userguide/tls-for-untrusted-networks/,
I noticed that the packer does not actually successfully complete
the initial HTTPS deployment (where -insecure is used).
After writing the image to disk and rebooting, the packer was stuck at:

device not yet reachable: Get "https://localhost:9080/": http:
server gave HTTP response to HTTPS client

related to https://github.com/gokrazy/tools/pull/94
2025-11-29 12:39:22 +01:00
Michael Stapelberg 2c805ed001 refactor cobra command initialization to avoid stale state
Before this commit, we held onto *cobra.Command objects,
but that is not actually supported: after the first Execute(),
commands like updateCmd are stuck on the first-ever provided ctx.

Instead, turn command initialization into functions.

I only noticed this when trying to do two 'gok update'
from within the same test, where the fake build timestamp
is injected via the context (the timestamp was always the same).
2025-11-29 10:47:48 +01:00
Michael Stapelberg 50ceea79c7 internal/packer: apply BootloaderExtraEEPROM
related to https://github.com/gokrazy/gokrazy/issues/338
2025-11-16 19:09:52 +01:00
Michael Stapelberg d57f04bf53 add internal/eeprom package (with test against other impls)
related to https://github.com/gokrazy/gokrazy/issues/338
2025-11-16 15:08:21 +01:00
Michael Stapelberg 57f559232c packer: eeprom: only write vl805-*.bin if present (Pi 4)
The rpi5-eeprom package no longer contains vl805, which is Pi 4-specific.

related to https://github.com/gokrazy/gokrazy/issues/332
2025-11-16 09:57:09 +01:00
Michael Stapelberg 2f0aac76a0 packer: include timestamp (ts: unixtime) in firmware .sig files
Otherwise the Pi 5 firmware will default to a timestamp of 0
and skip the update always.

related to https://github.com/gokrazy/gokrazy/issues/332
2025-11-16 09:08:03 +01:00
Michael Stapelberg 9a9519186b integration: add 'gok update' test
gokrazy CI / CI (macos-latest) (push) Has been cancelled
gokrazy CI / CI (ubuntu-latest) (push) Has been cancelled
gokrazy CI / CI (windows-latest) (push) Has been cancelled
2025-10-03 19:12:17 +02:00
Michael Stapelberg 5675dbb2eb packer: set Accept header (request), not Content-Type (response) 2025-10-03 19:11:55 +02:00