Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
55e7a70
test(installer): add recorded Windows outputs for the media mode
Developer-Simon Nov 25, 2026
c0a7cd7
feat(installer): check the target again before writing and read Windo…
Developer-Simon Nov 25, 2026
8f5d163
docs(installer): describe what the log sink removes
Developer-Simon Nov 25, 2026
d895abc
feat(installer): add the zone tables for the media defaults
Developer-Simon Nov 25, 2026
e77c96b
refactor(installer): move the media platform choices behind one file …
Developer-Simon Nov 25, 2026
fe178db
docs(installer): name the winget link kind
Developer-Simon Nov 25, 2026
b24ec8d
feat(installer): add the media helper that runs the imager on behalf …
Developer-Simon Nov 25, 2026
6d84c06
feat(installer): run the imager in a pseudo console on Windows
Developer-Simon Nov 25, 2026
ec6df47
feat(installer): write media on Windows through an elevated helper
Developer-Simon Nov 25, 2026
917581f
feat(installer): find the Raspberry Pi Imager on Windows
Developer-Simon Nov 25, 2026
02a87d6
feat(installer): list Windows drives for the media mode
Developer-Simon Nov 25, 2026
d89dfb6
feat(installer): take timezone, keyboard and country from Windows
Developer-Simon Nov 25, 2026
8b1e9d2
refactor(installer): share the Wi-Fi merge and add the Windows Wi-Fi …
Developer-Simon Nov 25, 2026
f643b40
feat(installer): read Wi-Fi networks and stored keys on Windows
Developer-Simon Nov 25, 2026
4b4a5c1
feat(installer): show the Windows install paths for the imager
Developer-Simon Nov 25, 2026
c7d413f
ci: run the installer media tests on Windows
Developer-Simon Nov 25, 2026
e847692
docs(installer): describe the media mode on Windows
Developer-Simon Nov 25, 2026
efa2c66
docs(installer): correct the driver note and the Windows Wi-Fi passage
Developer-Simon Nov 25, 2026
ec65d4c
fix(installer): watch for cancel while the UAC prompt is open
Developer-Simon Nov 25, 2026
527d98f
fix(installer): hand the console pipe to the copy goroutine
Developer-Simon Nov 25, 2026
bc24cad
test(installer): compare the state dirs with the system path separator
Developer-Simon Nov 29, 2026
8e1ab65
fix(installer): match Windows volumes when PowerShell wraps the acces…
Developer-Simon Nov 29, 2026
693afe7
fix(installer): keep a cancelled write running until the imager has e…
Developer-Simon Nov 29, 2026
670a16f
feat(installer): eject the written medium on Windows
Developer-Simon Nov 29, 2026
e9b2ed8
fix(installer): show the whole imager error with correct characters
Developer-Simon Nov 29, 2026
a2dbda5
fix(installer): keep recently seen Wi-Fi networks in the list
Developer-Simon Nov 29, 2026
a56fbd1
fix(installer): close the own console window once the app window is open
Developer-Simon Nov 29, 2026
2fb9672
feat(installer): add texts for the running and cancelling write
Developer-Simon Nov 29, 2026
cbfa3ce
fix(installer): keep the write screen moving and show cancelling
Developer-Simon Nov 29, 2026
b4d7e92
feat(installer): add the hint text for small media
Developer-Simon Nov 29, 2026
b502ec8
fix(installer): name only known used space and warn about small cards
Developer-Simon Nov 29, 2026
749c561
chore(release): bump component versions
Nov 29, 2026
69ddd40
docs(changelog): update changelogs
Nov 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,32 @@ jobs:
fi
- run: go test ./...

# Die Medien-Tests laufen unter Windows, weil der Windows-Pfad (Laufwerke,
# WLAN, Imager, Helfer) sonst ungetestet bliebe. Tests, die Unix-Rechte,
# Symlinks oder ein Linux-Shellskript brauchen, überspringen sich dort selbst.
installer-windows:
name: Installer media tests (Windows)
needs: changes
if: needs.changes.outputs.installer_go == 'true' || github.event_name == 'push'
runs-on: windows-latest
defaults:
run:
working-directory: installer
env:
CGO_ENABLED: '0'
steps:
# Vor dem Checkout gibt es den Ordner installer noch nicht, daher hier
# den Arbeitsordner des Runners. Eingebettete Vorlagen und Fixtures
# sollen LF behalten.
- name: Keep LF line endings in the checkout
working-directory: ${{ github.workspace }}
run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: installer/go.mod
- run: go test ./internal/media/... ./internal/host/... ./cmd/installer/...

dashboard-js:
name: Dashboard (JS)
needs: changes
Expand Down Expand Up @@ -291,6 +317,11 @@ jobs:
TARGET: ${{ matrix.target }}
CGO_ENABLED: '0'
run: GOOS="${TARGET%/*}" GOARCH="${TARGET#*/}" go build -o "$RUNNER_TEMP/installer-build" ./cmd/installer
- name: Vet for ${{ matrix.target }}
env:
TARGET: ${{ matrix.target }}
CGO_ENABLED: '0'
run: GOOS="${TARGET%/*}" GOARCH="${TARGET#*/}" go vet ./...

python-bridges:
name: Python bridges
Expand Down Expand Up @@ -500,6 +531,7 @@ jobs:
- changes
- dashboard-go
- installer-go
- installer-windows
- dashboard-js
- dashboard-smoke
- installer-webui-go
Expand Down
8 changes: 8 additions & 0 deletions changelog/highlights/298.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"de": {
"*": "Der Installer bereitet Speichermedien jetzt auch unter Windows vor"
},
"en": {
"*": "Prepare storage media on Windows"
}
}
4 changes: 2 additions & 2 deletions dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
- **autolearn:** Learning functions can take minute values from Home Assistant (#294) (7aa657e)
- **monitoring:** Monitoring shows the forecast check, a year comparison and the learned values as a usual day (#297) (4f93975)
- **dashboard:** show system versions on the versions page (#299) (18a2b0b)
- **automations:** Monitoring checks the results of adopted suggestions and rules report a season drift (#300) (d9e023b)
- **automations:** mark rules that came from a learned suggestion (f85130f)
- **webui:** record which suggestion a saved rule came from (ae2baed)
- **autolearn:** measure the effect of an adopted suggestion against the season (a1e9dc6)
Expand All @@ -49,7 +50,6 @@
- **demo:** show every effect state and drift kind (c3e766b)
- **webui:** let a tour expand the suggestions band (fa55c0a)
- **monitoring:** check the results of adopted suggestions in Monitoring (f4755bb)
- **automations:** Monitoring checks the results of adopted suggestions and rules report a season drift (#300)
- **dashboard:** read the system package versions (8d025b3)
- **dashboard:** serve system versions to setup users (8e71270)
- **dashboard:** show the kernel and the Debian point release (93d002d)
Expand Down Expand Up @@ -367,6 +367,7 @@
- **storage:** wipe old file system signatures before formatting a stick (#245) (aeafa63)
- **storage:** set up, back up and replug the additional drive reliably (#247) (b668394)
- **automations:** correct the learning feature after the full review (#296) (88f3c75)
- **backup:** A restore stays in place even when the battery state cannot be written (#288) (e5c5437)
- **webui:** mark rules adopted from the suggestions band (6e20041)
- **autolearn:** accept baseline weeks with five days of data (fbbda8c)
- **autolearn:** keep the comparison values when a drifted rule is replaced (a95dcb5)
Expand All @@ -382,7 +383,6 @@
- **demo:** adopt the surplus window as a scenario and count one effect in hand switches (49a32f9)
- **webui:** fit the effect axis on phones and say what a threshold fix does (0b4bef6)
- **webui:** label only the ends of the before and since axis (222cf12)
- **backup:** A restore stays in place even when the battery state cannot be written (#288) (e5c5437)
- **monitoring:** keep texts and locale out of the insight model (57e2a44)
- **monitoring:** show the legend items for statistics weeks and gaps (82cde6e)
- **monitoring:** route locale formatting through I18n (a664db2)
Expand Down
4 changes: 4 additions & 0 deletions docs/developing/installer-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ Every failing check comes with a retry command you can copy, usually
`installer deploy --only <target>`. Run `diagnose` first when a node behaves
oddly.

`media-helper` and `media-shim` are internal subcommands. The media mode of the
web UI uses them to write a storage medium, and they are not meant to be called
by hand. They are not part of `help`.

## Common flags

These apply to every subcommand:
Expand Down
4 changes: 3 additions & 1 deletion docs/installer-operating-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ signature. Everything else in the package stays verified.

## Raspberry Pi with the Raspberry Pi Imager

- Pick the image from the table above.
- Pick the image from the table above. The installer's **Media** tab can also
write the card for you on Linux and Windows, see
[Preparing a storage medium](installer.md#preparing-a-storage-medium).
- Set hostname, user, SSH, WiFi and timezone in the Imager before it writes
the card. On a headless remote site you do not want to find out afterwards
that SSH is off.
Expand Down
24 changes: 19 additions & 5 deletions docs/installer.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,16 @@ such as a quicker package build for a first try.
## Preparing a storage medium

The **Media** tab writes an SD card for a Raspberry Pi so that you do not need a
second tool for the image. It needs the Raspberry Pi Imager 2.0 or newer, as the
Flatpak or as a package. If it is missing, the tab links to Discover and to the
download page. For now the tab works on Linux only. Windows and macOS follow.
second tool for the image. The tab works on Linux and Windows. macOS follows. It
needs the Raspberry Pi Imager 2.0 or newer.

On Linux that is the Flatpak or a package. If it is missing, the tab links to
Discover and to the download page. On Windows the tab links to the download page
and shows the command
`winget install -e --id RaspberryPiFoundation.RaspberryPiImager`. Run the
command or install the Imager from the page, then use **check again**. The Imager
setup also installs a USB driver (`rpiboot-winusb`) and may ask you to confirm
it.

The same tab also builds a USB stick that installs Debian on other hardware, see
[Other hardware (Debian)](#other-hardware-debian).
Expand All @@ -105,7 +112,10 @@ The same tab also builds a USB stick that installs Debian on other hardware, see

With **Connect to Wi-Fi** switched on, pick a network from the list of
networks in range or choose **Other network** and type its name. The network
this computer is connected to is selected first. If this computer knows the
this computer is connected to is selected first. On Windows this needs
location access for desktop apps. Without it no networks are suggested, you
type the name yourself, and the password check still works. If this computer
knows the
password of that network, or of the same network on the other band, the
installer tells you whether yours matches, and otherwise says that it cannot
check it. The Wi-Fi password only goes onto the card and the installer does
Expand All @@ -119,7 +129,11 @@ The same tab also builds a USB stick that installs Debian on other hardware, see
you tick a box, for an internal drive you type the drive's name.
4. **Write.** The installer downloads the image, checks its checksum, writes the
card with the Imager and ejects it. The Imager asks for administrator rights
through the system's own dialog.
through the system's own dialog. On Windows the prompt names the Energy Node
installer, because only a small helper started from it runs with those
rights. If you refuse, the job ends without writing. Cancelling takes a few
seconds until the Imager has ended, and the card is then incomplete, so write
it again.
5. **Done.** Put the card into the Pi, connect it and switch it on. The installer
waits for the Pi and then offers **Continue to setup**.

Expand Down
32 changes: 31 additions & 1 deletion installer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## v0.3.4-pre.6 (2026-11-15)
## v0.3.4-pre.7 (2026-11-15)

### Features

Expand All @@ -10,6 +10,17 @@
- **installer:** write a Debian install stick from the media mode (#255) (cb9e1aa)
- **installer:** The configure screen of the installer shows its services and tuning as modules (#280) (f85e2a6)
- **installer:** apply a changed service selection without a full update (#282) (ab11a7a)
- **installer:** check the target again before writing and read Windows imager output (c0a7cd7)
- **installer:** add the zone tables for the media defaults (d895abc)
- **installer:** add the media helper that runs the imager on behalf of the installer (b24ec8d)
- **installer:** run the imager in a pseudo console on Windows (6d84c06)
- **installer:** write media on Windows through an elevated helper (ec6df47)
- **installer:** find the Raspberry Pi Imager on Windows (917581f)
- **installer:** list Windows drives for the media mode (02a87d6)
- **installer:** take timezone, keyboard and country from Windows (d89dfb6)
- **installer:** read Wi-Fi networks and stored keys on Windows (f643b40)
- **installer:** eject the written medium on Windows (670a16f)
- **installer:** prepare storage media on Windows (#298)
- **installer:** compute the steps an apply-selection run needs (c855116)
- **installer:** prepare from the package stored on the node (f5b1c87)
- **installer:** run only the changed services in apply-selection mode (7af7686)
Expand Down Expand Up @@ -47,6 +58,13 @@
### Fixes

- **installer:** ask for the pinned host key type when probing and signing in (#241) (a5e2b38)
- **installer:** watch for cancel while the UAC prompt is open (ec65d4c)
- **installer:** hand the console pipe to the copy goroutine (527d98f)
- **installer:** match Windows volumes when PowerShell wraps the access paths (8e1ab65)
- **installer:** keep a cancelled write running until the imager has ended (693afe7)
- **installer:** show the whole imager error with correct characters (e9b2ed8)
- **installer:** keep recently seen Wi-Fi networks in the list (a2dbda5)
- **installer:** close the own console window once the app window is open (a56fbd1)
- **installer:** skip the Debian release lookup for unsupported devices (4b53c16)
- **installer:** install python3 on the Debian stick target (b007104)
- **installer:** manage the Debian node network with NetworkManager (8034938)
Expand All @@ -55,18 +73,30 @@
- **installer:** read the Wi-Fi name without a rescan and keep its band (092e503)
- **installer:** unblock Wi-Fi on Raspberry Pi OS by setting its country (ffb360a)

### Refactors

- **installer:** move the media platform choices behind one file per system (e77c96b)
- **installer:** share the Wi-Fi merge and add the Windows Wi-Fi parsers (8b1e9d2)

### Documentation

- **installer:** describe what the log sink removes (8f5d163)
- **installer:** record the QEMU matrix results and the emergency password run (ce5c7ab)

### Tests

- **installer:** add recorded Windows outputs for the media mode (55e7a70)
- **installer:** compare the state dirs with the system path separator (bc24cad)
- **installer:** cover the ISO layout failures of isopatch (f52f4cc)
- **installer:** pin the disk selection of the Debian install script (3a98409)
- **installer:** keep the Debian stick QEMU matrix in the repo (d0433a1)
- **installer:** let mediastick set the emergency password (052a7b8)
- **installer:** add dev.sh to try the Debian stick in QEMU (#257) (8bb3a60)

### CI

- run the installer media tests on Windows (c7d413f)

## v0.3.3 (2026-11-16)

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion installer/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.3.4-pre.6
v0.3.4-pre.7
5 changes: 5 additions & 0 deletions installer/cmd/installer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"strings"

"github.com/Developer-Simon/energy-node-installer/internal/devcli"
"github.com/Developer-Simon/energy-node-installer/internal/media"
"github.com/Developer-Simon/energy-node-installer/internal/transport"
)

Expand Down Expand Up @@ -41,6 +42,10 @@ func main() {
err = runDiagnoseCmd(os.Args[2:])
case "restart":
err = runRestartCmd(os.Args[2:])
case media.HelperName:
os.Exit(runMediaHelperCmd(os.Args[2:]))
case media.ShimName:
os.Exit(runMediaShimCmd(os.Args[2:]))
case "-h", "--help", "help":
printUsage()
return
Expand Down
66 changes: 66 additions & 0 deletions installer/cmd/installer/mediahelper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package main

import (
"context"
"errors"
"flag"
"fmt"
"io"
"os"

"github.com/Developer-Simon/energy-node-installer/internal/media"
)

// runMediaHelperCmd ist der interne Unterbefehl media-helper. Er steht nicht in printUsage.
func runMediaHelperCmd(args []string) int {
files, name, rest, err := parseMediaHelperArgs(args)
if err != nil {
fmt.Fprintln(os.Stderr, "media-helper:", err)
return 125
}
return media.RunHelper(context.Background(), files, name, rest)
}

// runMediaShimCmd ist der interne Unterbefehl media-shim -- <name> <args...>.
func runMediaShimCmd(args []string) int {
if len(args) < 2 || args[0] != "--" {
fmt.Fprintln(os.Stderr, "usage: media-shim -- <name> <args...>")
return 125
}
return media.RunShim(args[1], args[2:])
}

// parseMediaHelperArgs liest --log, --cancel, optional --status und danach -- <name> <args...>.
func parseMediaHelperArgs(args []string) (media.HelperFiles, string, []string, error) {
var files media.HelperFiles
sep := -1
for i, a := range args {
if a == "--" {
sep = i
break
}
}
if sep < 0 {
return files, "", nil, errors.New("missing -- before the program")
}
rest := args[sep+1:]
if len(rest) == 0 {
return files, "", nil, errors.New("missing program name after --")
}

fs := flag.NewFlagSet(media.HelperName, flag.ContinueOnError)
fs.SetOutput(io.Discard)
fs.StringVar(&files.Log, "log", "", "")
fs.StringVar(&files.Cancel, "cancel", "", "")
fs.StringVar(&files.Status, "status", "", "")
if err := fs.Parse(args[:sep]); err != nil {
return files, "", nil, err
}
if fs.NArg() != 0 {
return files, "", nil, fmt.Errorf("unexpected arguments before --: %v", fs.Args())
}
if files.Log == "" || files.Cancel == "" {
return files, "", nil, errors.New("--log and --cancel are required")
}
return files, rest[0], rest[1:], nil
}
29 changes: 29 additions & 0 deletions installer/cmd/installer/mediahelper_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package main

import (
"reflect"
"testing"
)

func TestMediaHelperParsesItsFlags(t *testing.T) {
files, name, rest, err := parseMediaHelperArgs([]string{"--log", "a", "--cancel", "b", "--", "x", "y", "z"})
if err != nil {
t.Fatal(err)
}
if files.Log != "a" || files.Cancel != "b" || files.Status != "" {
t.Fatalf("files = %+v", files)
}
if name != "x" || !reflect.DeepEqual(rest, []string{"y", "z"}) {
t.Fatalf("name = %q, rest = %v", name, rest)
}

if _, _, _, err := parseMediaHelperArgs([]string{"--log", "a", "--cancel", "b", "x"}); err == nil {
t.Fatal("missing -- must fail")
}
if _, _, _, err := parseMediaHelperArgs([]string{"--log", "a", "--cancel", "b", "--"}); err == nil {
t.Fatal("missing program name must fail")
}
if _, _, _, err := parseMediaHelperArgs([]string{"--cancel", "b", "--", "x"}); err == nil {
t.Fatal("missing --log must fail")
}
}
43 changes: 43 additions & 0 deletions installer/cmd/installer/mediashim_windows_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package main

import (
"fmt"
"os"
"path/filepath"
"strconv"
"testing"
)

// TestMain macht die Testdatei selbst zum Imager: mit gesetzter Variable endet der Prozess
// mit dem angegebenen Code.
func TestMain(m *testing.M) {
if code := os.Getenv("ENERGY_NODE_FAKE_IMAGER_EXIT"); code != "" {
n, err := strconv.Atoi(code)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(125)
}
os.Exit(n)
}
os.Exit(m.Run())
}

func TestMediaShimPassesTheExitCode(t *testing.T) {
exe, err := os.Executable()
if err != nil {
t.Fatal(err)
}
data, err := os.ReadFile(exe)
if err != nil {
t.Fatal(err)
}
imager := filepath.Join(t.TempDir(), "rpi-imager.exe")
if err := os.WriteFile(imager, data, 0o755); err != nil {
t.Fatal(err)
}
t.Setenv("ENERGY_NODE_FAKE_IMAGER_EXIT", "3")

if got := runMediaShimCmd([]string{"--", imager}); got != 3 {
t.Fatalf("runMediaShimCmd = %d, want 3", got)
}
}
Loading
Loading