Commit Graph

190 Commits

Author SHA1 Message Date
Michael Stapelberg
11cde81bb7 allow configuring gokrazy system packages, too (e.g. dhcp) 2021-05-27 08:48:45 +02:00
Michael Stapelberg
97aac5cffd Run go tool with -mod=mod to automatically download missing modules 2021-05-24 11:55:57 +02:00
Mark Bryars
e39dd5e7c9 Add mkfs.ext4 instructions with --overwrite mode (#25)
Allows easy creating of perm partition when making image files.

related to https://github.com/gokrazy/gokrazy/issues/
2021-04-21 11:14:34 +02:00
Michael Stapelberg
5b8d8ebd00 packer: ensure eeprom package is present, too
fixes https://github.com/gokrazy/tools/issues/24
2021-02-22 09:15:20 +01:00
Michael Stapelberg
fd0b073737 packer: add -testboot flag
related to https://github.com/gokrazy/gokrazy/issues/75
2021-01-30 18:56:23 +01:00
Michael Stapelberg
9e2217c2fd pad cmdline with enough space for during-testboot kernel parameters
related to https://github.com/gokrazy/gokrazy/issues/75
2021-01-30 18:55:40 +01:00
andig
86f779c5f0 Split package build flags (one per line) (#23) 2021-01-18 09:39:32 +01:00
Michael Stapelberg
aa957668af packer: report config files for packages + last modification time
related to https://github.com/gokrazy/gokrazy/issues/65
2021-01-17 19:14:40 +01:00
Michael Stapelberg
135ad236ac packer: pick up extra environment variables from env/<pkg>/env.txt
The file format is one key=val pair per line (\n-separated).

Preparation example:

mkdir -p env/github.com/gokrazy/timestamps
echo 'FOO=bar' > env/github.com/gokrazy/timestamps/env.txt

Packer example:

gokr-packer -update=yes -hostname=gokrazy \
  github.com/gokrazy/breakglass \
  github.com/gokrazy/timestamps \
  github.com/gokrazy/serial-busybox

You can check the effect locally by adding -overwrite_init=/tmp/init.go to your
gokr-packer invocation and examining /tmp/init.go afterwards.

related to https://github.com/gokrazy/gokrazy/issues/65
2021-01-17 18:47:58 +01:00
andig
eed7270eba Support custom build flags (#21) 2021-01-13 09:07:46 +01:00
Michael Stapelberg
588704f522 packer: increase -target_storage_bytes lower bound (for /perm)
The previous lower bound was technically correct, but not very user-friendly.
The new lower bound arranges for a 100 MB /perm partition by default.
2021-01-10 15:13:17 +01:00
Michael Stapelberg
5e9cfcb6e9 packer: write /etc/gokr-pw.txt with mode 0400
When using privilege separation, non-root users cannot read the device password
anymore.

related to https://github.com/gokrazy/gokrazy/issues/76
2021-01-07 08:57:29 +01:00
andig
2708a2ca2a Print correct uri when http(s)_port ist used (#20) 2021-01-07 08:43:33 +01:00
Michael Stapelberg
e15b6ea744 updater: use new github.com/gokrazy/updater package 2021-01-06 22:20:02 +01:00
Michael Stapelberg
608ca46ed4 packer: use new github.com/gokrazy/updater package 2021-01-06 22:03:29 +01:00
Michael Stapelberg
90d0f0f832 packer: add -http_port and -https_port flags (persisted to /etc)
related to https://github.com/gokrazy/gokrazy/pull/77
related to https://github.com/gokrazy/gokrazy/issues/74
2021-01-06 18:19:43 +01:00
Michael Stapelberg
fdd90fc681 packer: pick up extra command-line flags from flags/<pkg>/flags.txt
The file format is one flag per line (\n-separated).

Preparation example:

mkdir -p flags/github.com/gokrazy/timestamps
echo '--ohai' > flags/github.com/gokrazy/timestamps/flags.txt

Packer example:

gokr-packer -update=yes -hostname=gokrazy \
  github.com/gokrazy/breakglass \
  github.com/gokrazy/timestamps \
  github.com/gokrazy/serial-busybox

Resulting stderr:

1970/01/01 01:00:09 gokrazy: attempt 0, starting [/user/timestamps --ohai]

You can check the effect locally by adding -overwrite_init=/tmp/init.go to your
gokr-packer invocation and examining /tmp/init.go afterwards.

related to https://github.com/gokrazy/gokrazy/issues/65
2021-01-04 16:54:11 +01:00
andig
f17e3ee018 Don't apply https when -insecure requested (#19)
Fix https://github.com/gokrazy/tools/issues/18
2021-01-04 12:48:19 +01:00
Michael Stapelberg
3f3b73e556 init: print hostname and model
This helps identify devices after you forget about them :)
2020-06-26 11:58:16 +02:00
Michael Stapelberg
170b0422a0 switch gokr-updater to new updater API, too 2020-06-26 10:59:19 +02:00
Michael Stapelberg
71c8662bff switch to new updater API 2020-06-26 10:56:42 +02:00
Michael Stapelberg
a664377a48 packer: use go build with tempdir instead of go install
fixes https://github.com/gokrazy/tools/issues/2
2020-06-21 09:08:31 +02:00
Michael Stapelberg
2d49867a09 packer: describe available consoles 2020-06-21 08:27:29 +02:00
Michael Stapelberg
49c46f2511 packer: support symlinks in -overwrite=, use partuuid in mkfs
This allows us to use e.g. -overwrite
/dev/disk/by-id/usb-TS-RDF5_SD_Transcend_000000000037-0:0
2020-06-21 08:05:14 +02:00
Michael Stapelberg
c2553c9cb8 packer: set expectations. startup on the pi 4 can be slow. 2020-06-21 07:45:35 +02:00
Michael Stapelberg
faba15fa08 gotool: plumb through stderr
related to https://github.com/gokrazy/tools/issues/15
2020-06-20 11:33:12 +02:00
Michael Stapelberg
09a065cae0 include commands in error messages
related to https://github.com/gokrazy/tools/issues/15
2020-06-20 10:50:26 +02:00
Michael Stapelberg
ce33e62bcd packer: pi 3 → pi 3 or 4
related to https://github.com/gokrazy/gokrazy/issues/48
2020-06-19 08:59:31 +02:00
Michael Stapelberg
5329ccbb1c packer: skip signature for recovery.bin (not part of the EEPROM) 2020-06-19 08:39:40 +02:00
Michael Stapelberg
de64b88472 packer: include EEPROM files from github.com/gokrazy/rpi-eeprom
Specify an empty -eeprom_package= flag to not include any EEPROM updates.

related to https://github.com/gokrazy/gokrazy/issues/48
2020-06-18 21:08:11 +02:00
Michael Stapelberg
d080103072 packer: pass through -insecure
This fixes disabling TLS via a network update.
2020-06-01 14:04:02 +02:00
Janis Streib
3d2ae8ed96 gokr-packer: TLS support (#7) (#14)
The new `-tls` parameter is empty by default, retaining the current behavior (no change).

If `-tls=self-signed` is specified, the packer generates and signs a RSA4096 certificate, stored in the host-specific config directory, e.g. typically `~/.config/gokrazy/<hostname>/{cert,key}.pem` on Linux.

If `-tls=<certpath>[,<keypath>]` is specified, the packer uses the specified certificate and key.

When TLS is used, the certificate/key is included in the gokrazy root file system at  `/etc/ssl/{web,web_key}.pem`.

To switch an unencrypted (HTTP) installation to HTTPS, use the `-insecure` flag for the first update, e.g.:
`gokr-packer -tls=self-signed -insecure …`
…then remove it for all subsequent updates, which will now be done via HTTPS:
`gokr-packer -tls=self-signed …`
2020-05-31 23:19:06 +02:00
Michael Stapelberg
4d98088ffe refactor ensurePasswordFileExists to use internal/config 2020-05-27 18:37:13 +02:00
Michael Stapelberg
2196ee2eab packer: allow host-specific configuration of the HTTP password
The gokrazy configuration directory is named “gokrazy” underneath
https://golang.org/pkg/os/#UserConfigDir, which on Linux typically
resolves to ~/.config/gokrazy.

The global HTTP password stored in http-password.txt within that
directory will still be used, but in case a host-specific override
directory exists, that directory has priority.

E.g., if you wanted to set up a gokrazy installation named “dev”
for live-coding on a public twitch stream, you could:

  % host_specific=~/.config/gokrazy/hosts/dev/
  % mkdir -p $host_specific
  % echo -n publicly-leaked-on-stream > $host_specific/http-password.txt

This technique was originally contributed by @janisstreib in
https://github.com/gokrazy/tools/pull/14
2020-05-27 18:05:39 +02:00
Michael Stapelberg
a11ea1b259 print PARTUUID= all uppercase to match root= kernel cmdline format 2020-05-01 10:02:09 +02:00
Michael Stapelberg
887bfb76f1 packer: use absolute path when using sudo 2020-04-09 09:36:35 +02:00
Michael Stapelberg
703b26aa27 packer: also include *.upd and *.sig (for Raspberry Pi 4 EEPROM)
releated to https://github.com/gokrazy/gokrazy/issues/48
2020-04-09 09:33:23 +02:00
Michael Stapelberg
87444dca50 packer: check target supports partuuid before using it in cmdline
related to https://github.com/gokrazy/gokrazy/issues/52
2020-04-07 10:00:48 +02:00
Michael Stapelberg
5501e3c235 packer: don’t use PARTUUID= in cmdline.txt when updating yet
related to https://github.com/gokrazy/gokrazy/issues/52
2020-04-07 09:26:06 +02:00
Michael Stapelberg
156ba20b17 packer: write PARTUUID=
related to https://github.com/gokrazy/gokrazy/issues/52
2020-04-07 09:02:08 +02:00
Michael Stapelberg
27bcb247d9 packer: print suggestion upon -EROFS 2020-01-16 22:38:08 +01:00
Michael Stapelberg
5a50ad0a49 packer: verify DNS resolution works
fixes #12
2019-10-21 19:01:21 +02:00
Michael Stapelberg
46ded5b93b packer: use password from update URL if provided
fixes #13
2019-10-21 17:53:39 +02:00
mikioh
3364436881 cmd/gokr-packer: add missing rereadPartitions for darwin (#11)
This change makes it possible to use the combination of gokr-packer and
image manipulation tools like balenaEtcher on macOS.
2019-03-08 15:38:47 +01:00
Michael Stapelberg
f352a9f6d1 gofmt parttable.go 2019-01-05 23:04:46 +01:00
Michael Stapelberg
d5a93c3f7e localtime: correct path to Go’s zoneinfo.zip 2019-01-05 23:01:43 +01:00
Michael Stapelberg
2c4d21a7dd localtime: fall back to Go’s zoneinfo.zip
And don’t error out if that’s missing. gokrazy can still boot.
2019-01-05 22:38:12 +01:00
Michael Stapelberg
6219658570 use sudo to elevate privileges when required
fixes #9
2018-11-01 16:59:56 +01:00
Michael Stapelberg
09013ce6e2 -override: verify no partitions of the target device are mounted 2018-11-01 09:48:12 +01:00
Michael Stapelberg
09e23c73a7 -overwrite: seek instead of relying on re-reading the partition table
This makes the packer more flexible with regards to permissions: write
permissions for the target device are now sufficient.

The downside is that the SD card needs to be unplugged and re-plugged before the
persistent file system can be created (if desired).

related to https://github.com/gokrazy/tools/issues/9
2018-11-01 09:46:34 +01:00