From 09335338012d002293f8af7bd29d0d85b3ec72d2 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 9 Nov 2024 05:13:41 +0100 Subject: [PATCH] load config from efi --- a.md | 4 ++++ airootfs/etc/systemd/network/20-ethernet.network | 3 --- airootfs/etc/systemd/network/20-wireless.network | 6 ++++++ airootfs/etc/systemd/system/abrechenbarkeit@.service | 2 +- airootfs/etc/systemd/system/configure_wpa.service | 11 +++++++++++ .../wpa_supplicant.service | 1 + airootfs/usr/local/bin/configure_wpa | 5 +++++ packages.x86_64 | 3 ++- profiledef.sh | 1 + 9 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 a.md create mode 100644 airootfs/etc/systemd/network/20-wireless.network create mode 100644 airootfs/etc/systemd/system/configure_wpa.service create mode 120000 airootfs/etc/systemd/system/network-online.target.wants/wpa_supplicant.service create mode 100644 airootfs/usr/local/bin/configure_wpa diff --git a/a.md b/a.md new file mode 100644 index 0000000..ee665dd --- /dev/null +++ b/a.md @@ -0,0 +1,4 @@ + +- 97b6e7a4-b8a6-4d85-b7c4-0030bb5f2d38-WlanSSID +- 97b6e7a4-b8a6-4d85-b7c4-0030bb5f2d38-WlanPSK +- 97b6e7a4-b8a6-4d85-b7c4-0030bb5f2d38-AppUrl diff --git a/airootfs/etc/systemd/network/20-ethernet.network b/airootfs/etc/systemd/network/20-ethernet.network index ea81109..154417b 100644 --- a/airootfs/etc/systemd/network/20-ethernet.network +++ b/airootfs/etc/systemd/network/20-ethernet.network @@ -1,9 +1,6 @@ [Match] Type=ether -[Link] -RequiredForOnline=routable - [Network] DHCP=yes MulticastDNS=yes diff --git a/airootfs/etc/systemd/network/20-wireless.network b/airootfs/etc/systemd/network/20-wireless.network new file mode 100644 index 0000000..a19489f --- /dev/null +++ b/airootfs/etc/systemd/network/20-wireless.network @@ -0,0 +1,6 @@ +[Match] +Type=wlan + +[Network] +DHCP=yes +MulticastDNS=yes diff --git a/airootfs/etc/systemd/system/abrechenbarkeit@.service b/airootfs/etc/systemd/system/abrechenbarkeit@.service index cf079c5..be7649b 100644 --- a/airootfs/etc/systemd/system/abrechenbarkeit@.service +++ b/airootfs/etc/systemd/system/abrechenbarkeit@.service @@ -12,7 +12,7 @@ Requires=dev-dri-card1.device [Service] Type=simple -ExecStart=/usr/bin/cage -d -- chromium --ozone-platform=wayland --app='https://staging.metamuffin.org/' +ExecStart=/usr/bin/fish -c '/usr/bin/cage -d -- electron --ozone-platform=wayland (cat /sys/firmware/efi/efivars/AppUrl-97b6e7a4-b8a6-4d85-b7c4-0030bb5f2d38 | tail -c +5)' Restart=always User=abrechenbarkeit UtmpIdentifier=%I diff --git a/airootfs/etc/systemd/system/configure_wpa.service b/airootfs/etc/systemd/system/configure_wpa.service new file mode 100644 index 0000000..9fd5fc0 --- /dev/null +++ b/airootfs/etc/systemd/system/configure_wpa.service @@ -0,0 +1,11 @@ +[Unit] +Description=Generate wpa_supplicant config from EFI variables +After=systemd-user-sessions.service +Before=wpa_supplicant.service + +[Service] +Type=simple +ExecStart=/usr/local/bin/configure_wpa + +[Install] +WantedBy=network-online.target diff --git a/airootfs/etc/systemd/system/network-online.target.wants/wpa_supplicant.service b/airootfs/etc/systemd/system/network-online.target.wants/wpa_supplicant.service new file mode 120000 index 0000000..1aff68e --- /dev/null +++ b/airootfs/etc/systemd/system/network-online.target.wants/wpa_supplicant.service @@ -0,0 +1 @@ +/usr/lib/systemd/system/wpa_supplicant.service \ No newline at end of file diff --git a/airootfs/usr/local/bin/configure_wpa b/airootfs/usr/local/bin/configure_wpa new file mode 100644 index 0000000..204bbc6 --- /dev/null +++ b/airootfs/usr/local/bin/configure_wpa @@ -0,0 +1,5 @@ +#!/usr/bin/fish + +set ssid (cat /sys/firmware/efi/efivars/WlanSSID-97b6e7a4-b8a6-4d85-b7c4-0030bb5f2d38 | tail -c +5) +set psk (cat /sys/firmware/efi/efivars/WlanPSK-97b6e7a4-b8a6-4d85-b7c4-0030bb5f2d38 | tail -c +5) +wpa_passphrase $ssid $psk > /etc/wpa_supplicant/wpa_supplicant.conf diff --git a/packages.x86_64 b/packages.x86_64 index 9bcf9bd..0e31ff5 100644 --- a/packages.x86_64 +++ b/packages.x86_64 @@ -9,8 +9,9 @@ qemu-guest-agent cage edk2-shell fish -chromium pipewire pipewire-alsa pipewire-jack pipewire-pulse +wpa_supplicant +efivar diff --git a/profiledef.sh b/profiledef.sh index 42591de..09543cc 100644 --- a/profiledef.sh +++ b/profiledef.sh @@ -16,4 +16,5 @@ airootfs_image_tool_options=('-comp' 'zstd' '-Xcompression-level' '10') bootstrap_tarball_compression=(zstd -c -T0 --long -19) file_permissions=( ["/etc/shadow"]="0:0:400" + ["/usr/local/bin/configure_wpa"]="0:0:755" )