Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
75 changes: 75 additions & 0 deletions .github/workflows/installer-macos-media.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Installer media (macOS)

# Abnahme der Medien-Vorbereitung auf macOS. Laeuft auf einem Wegwerf-Runner
# mit RAM-Disk. Nicht Teil von ci-ok, der Lauf kostet macOS-Minuten.

on:
workflow_dispatch:
pull_request:
paths:
- installer/internal/media/**
- installer/internal/host/**
- .github/workflows/installer-macos-media.yml

permissions:
contents: read

jobs:
media-macos:
name: Installer media end to end (macOS)
runs-on: macos-latest
timeout-minutes: 30
defaults:
run:
shell: bash
working-directory: installer
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: installer/go.mod
- name: Install the Raspberry Pi Imager
run: brew install --cask raspberry-pi-imager
- name: Unit tests of the media mode
run: go test ./internal/media/... ./internal/host/... ./cmd/installer/...
- name: Create the RAM disk
run: |
dev=$(hdiutil attach -nomount ram://2500000 | awk '{print $1}')
if ! [[ "$dev" =~ ^/dev/disk[0-9]+$ ]]; then
echo "::error::keine RAM-Disk: '$dev'"
exit 1
fi
echo "EN_MAC_RAMDISK=$dev" >> "$GITHUB_ENV"
- name: Give the RAM disk the node layout of a stick
run: |
dev="$EN_MAC_RAMDISK"
if ! [[ "$dev" =~ ^/dev/disk[0-9]+$ ]]; then
echo "::error::ungueltiges Geraet: '$dev'"
exit 1
fi
sudo chown root:operator "$dev" "/dev/r${dev#/dev/}"
sudo chmod 640 "$dev" "/dev/r${dev#/dev/}"
- name: Allow the imager to open the RAM disk
run: |
dev="$EN_MAC_RAMDISK"
if ! [[ "$dev" =~ ^/dev/disk[0-9]+$ ]]; then
echo "::error::ungueltiges Geraet: '$dev'"
exit 1
fi
sudo security authorizationdb write "sys.openfile.readwrite./dev/r${dev#/dev/}" allow
- name: End-to-end test on the RAM disk
run: go test -tags mediae2e ./internal/host -run TestMacMediaEndToEnd -v
- name: Remove the right
if: always()
run: |
dev="${EN_MAC_RAMDISK:-}"
if [[ "$dev" =~ ^/dev/disk[0-9]+$ ]]; then
sudo security authorizationdb remove "sys.openfile.readwrite./dev/r${dev#/dev/}" || true
fi
- name: Detach the RAM disk
if: always()
run: |
dev="${EN_MAC_RAMDISK:-}"
if [[ "$dev" =~ ^/dev/disk[0-9]+$ ]]; then
hdiutil detach "$dev" -force || true
fi
8 changes: 8 additions & 0 deletions changelog/highlights/301.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"de": {
"*": "Der Installer bereitet Speichermedien jetzt auch unter macOS vor"
},
"en": {
"*": "Prepare storage media on macOS"
}
}
25 changes: 20 additions & 5 deletions docs/installer.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ 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. The tab works on Linux and Windows. macOS follows. It
needs the Raspberry Pi Imager 2.0 or newer.
second tool for the image. The tab works on Linux, Windows and macOS. It needs
the Raspberry Pi Imager 2.0 or newer. On macOS it needs version 2.0.12 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
Expand All @@ -95,6 +95,15 @@ command or install the Imager from the page, then use **check again**. The Image
setup also installs a USB driver (`rpiboot-winusb`) and may ask you to confirm
it.

On macOS the tab links to the download page of the Imager and shows the command
`brew install --cask raspberry-pi-imager` for Homebrew. Run the command or
install the Imager from the page, then use **check again**. The installer does
not accept version 2.0.11.1 on macOS, because that version can hang when the
card is ejected.

macOS support has so far only been checked by automated tests, not on a real
Mac.

The same tab also builds a USB stick that installs Debian on other hardware, see
[Other hardware (Debian)](#other-hardware-debian).

Expand All @@ -114,12 +123,15 @@ The same tab also builds a USB stick that installs Debian on other hardware, see
networks in range or choose **Other network** and type its name. The network
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
type the name yourself, and the password check still works. On macOS no
networks are suggested and the installer does not check the password, so
type the name and the password yourself. 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
not store it. The Wi-Fi country follows the time zone. A Raspberry Pi 3B or
not store it. The Wi-Fi country follows the time zone. On macOS the time zone,
the keyboard layout and the Wi-Fi country come from the Mac. A Raspberry Pi 3B or
Zero W only reaches 2.4 GHz networks, so the installer warns about a network
that only uses 5 GHz and offers the 2.4 GHz network of the same name when
there is one.
Expand All @@ -131,7 +143,10 @@ The same tab also builds a USB stick that installs Debian on other hardware, see
card with the Imager and ejects it. The Imager asks for administrator rights
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
rights. On macOS the Imager asks for your administrator password. If you
refuse, the job ends without writing. On macOS the Imager then opens the
privacy settings, where you may need to allow access to removable volumes
before you try again. 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
Expand Down
14 changes: 12 additions & 2 deletions installer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

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

### Features

Expand All @@ -10,6 +10,12 @@
- **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:** prepare storage media on Windows (#298) (96ffa09)
- **installer:** find the Raspberry Pi Imager on macOS (539c6c9)
- **installer:** write media on macOS with the imager's own authorization (2dde909)
- **installer:** list macOS drives for the media mode (c76d1ae)
- **installer:** take timezone, keyboard and country from macOS (5864fd9)
- **installer:** prepare storage media on macOS (#301)
- **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)
Expand All @@ -20,7 +26,6 @@
- **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 @@ -85,6 +90,10 @@

### Tests

- **installer:** add recorded macOS outputs for the media mode (f0fbf39)
- **installer:** feed the macOS imager lines with their carriage returns (7ac1ea0)
- **installer:** use a neutral home folder in the macOS imager tests (9e86f2e)
- **installer:** skip the unsupported answer check on macOS (0035899)
- **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)
Expand All @@ -95,6 +104,7 @@

### CI

- check the media mode on a macOS runner with a RAM disk (f1eb28c)
- run the installer media tests on Windows (c7d413f)

## v0.3.3 (2026-11-16)
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.7
v0.3.4-pre.8
31 changes: 31 additions & 0 deletions installer/internal/host/media_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//go:build darwin

package host

import (
"context"

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

// mediaBrewCommand installiert den Imager ueber Homebrew.
const mediaBrewCommand = "brew install --cask raspberry-pi-imager"

// mediaPlatform meldet, dass dieser Rechner Medien vorbereiten kann.
func mediaPlatform() (supported bool, links []hostapi.MediaLink) {
return true, []hostapi.MediaLink{
{Kind: "website", URL: mediaWebsiteURL},
{Kind: "brew", Command: mediaBrewCommand},
}
}

var mediaRunner media.Runner = execRunner

// mediaEject ist nil: der Imager wirft das Medium selbst aus.
var mediaEject func(context.Context, media.Drive) error

// locateImager sucht den installierten Imager im Programme-Ordner.
func locateImager(ctx context.Context) (media.Imager, bool) {
return media.LocateMacImager()
}
Loading
Loading