Install ucode for valid types in x86_64. Also copy over sound settings and network used during live media.

This commit is contained in:
Storm Dragon committed 2026-11-17 16:39:43 -05:00
1 parent dc209ae275
commit 1df6d1740e
5 files changed
+232 -2

No files matched your search

+13 -1
View File
@@ -131,7 +131,13 @@ The old `stormux-speech.service` boot launcher is also disabled in the live ISO.
On first login to tty1, setup calibrates volume, selects the default speech engine, and asks whether to use Fenrir's laptop layout. These prompts use Speech Dispatcher directly while Fenrir is stopped. Enter at the layout prompt selects desktop layout. Setup then starts Fenrir, presents the welcome prompt, checks for network access, updates the live environment clock, and asks whether to run `install-stormux`. On first login to tty1, setup calibrates volume, selects the default speech engine, and asks whether to use Fenrir's laptop layout. These prompts use Speech Dispatcher directly while Fenrir is stopped. Enter at the layout prompt selects desktop layout. Setup then starts Fenrir, presents the welcome prompt, checks for network access, updates the live environment clock, and asks whether to run `install-stormux`.
The installer gives one last chance to accept or change the timezone before installation. The live setup changes are for the temporary live environment only; the installed system is configured by `install-stormux`. The installer gives one last chance to accept or change the timezone before installation. Live setup configures the running ISO; `install-stormux` carries the settings described below into the installed system.
The installed system includes `intel-ucode` for Intel CPUs or `amd-ucode` for AMD CPUs, selected from the running machine's CPU vendor. Other or unidentified vendors produce a warning and do not select a microcode package. Arch's default mkinitcpio `microcode` hook includes the installed microcode in the initramfs used by either bootloader. The installer also installs `irqbalance` and enables `irqbalance.service` for the installed system's next boot.
Before finishing, the installer saves the live ALSA mixer settings and copies WirePlumber's saved volumes, output selection, and audio profiles to root, the user skeleton, and each installed user. This carries the volume selected during live setup into the installed system while allowing later volume changes to be saved normally. If the live audio state is unavailable, the installer logs a warning.
Active Wi-Fi and Ethernet profiles are exported from NetworkManager with their available saved credentials, IP settings, and any referenced 802.1X certificate/key files. The installed copies autoconnect and are usable by the new users, even when the live profile was restricted to the `stormux` user. Credentials and certificates are stored in root-owned files with mode 600 and are not printed in the installation log. Existing target profiles with the same UUID are preserved. VPNs and other connection types, unavailable secrets, and unreadable certificates produce transfer warnings and may need manual setup. Live connections are not changed or restarted.
## Differences from Pi4 Build ## Differences from Pi4 Build
@@ -154,9 +160,15 @@ Before building, run the focused checks from this directory:
```bash ```bash
python3 tests/test-live-fenrir-setup.py python3 tests/test-live-fenrir-setup.py
python3 tests/test-installer-hardware.py
python3 -B tests/test-installer-live-settings.py
bash ../tests/test-select-speech-module.sh bash ../tests/test-select-speech-module.sh
``` ```
The installer hardware tests mock package installation and service management. After a test installation on Intel or AMD hardware, check the selected microcode package, inspect the initramfs with `lsinitcpio --early /boot/initramfs-linux.img`, and confirm `systemctl is-enabled irqbalance.service`. After booting the installed system, check `systemctl status irqbalance.service` and `journalctl -b -k -g microcode`. Verify both UEFI and BIOS installations; mocked tests do not prove boot-time microcode loading or interrupt balancing.
The live-settings tests require `python-gobject` and NetworkManager's libnm bindings. They use real libnm serialization and temporary files, with a simulated active-connection list and credential retrieval. They do not contact NetworkManager, change mixer controls, start services, or produce speech. For live acceptance, select an audible volume and a Wi-Fi or Ethernet connection in the ISO, install using a different username, and reboot without the ISO. Confirm the first spoken output uses the selected volume, networking reconnects without re-entering credentials, and a later volume change survives another reboot. Also check a console-only installation and a multi-user installation. Keep passwords and certificate contents out of shared test logs.
For boot acceptance, confirm that Fenrir stays silent during volume calibration and voice selection, the laptop prompt uses the selected voice, and Fenrir starts once afterward. Test both desktop (Enter or N) and laptop (Y) bindings, voice selection with Enter and Escape, network setup with and without a connection, and declining the installer. After a test installation, confirm that the selected voice persists and Fenrir starts at boot. Automated checks do not establish audible speech, physical keyboard behavior, or installed-system acceptance. For boot acceptance, confirm that Fenrir stays silent during volume calibration and voice selection, the laptop prompt uses the selected voice, and Fenrir starts once afterward. Test both desktop (Enter or N) and laptop (Y) bindings, voice selection with Enter and Escape, network setup with and without a connection, and declining the installer. After a test installation, confirm that the selected voice persists and Fenrir starts at boot. Automated checks do not establish audible speech, physical keyboard behavior, or installed-system acceptance.
For VM testing with audio: For VM testing with audio:
+75 -1
View File
@@ -1390,9 +1390,23 @@ install_base_system() {
local basePackages=( local basePackages=(
base base-devel linux linux-firmware base base-devel linux linux-firmware
networkmanager sudo dialog git ii rsync wget curl networkmanager sudo dialog git ii rsync wget curl
bash-completion cronie openssh rng-tools bash-completion cronie openssh rng-tools irqbalance
) )
local cpuVendor
cpuVendor=$(awk '/^vendor_id[[:space:]]*:/ { print $3; exit }' /proc/cpuinfo)
case "$cpuVendor" in
GenuineIntel)
basePackages+=(intel-ucode)
;;
AuthenticAMD)
basePackages+=(amd-ucode)
;;
*)
log_warning "No CPU microcode package selected for vendor: ${cpuVendor:-unknown}"
;;
esac
local audioPackages=( local audioPackages=(
pipewire pipewire-alsa pipewire-pulse pipewire-jack pipewire pipewire-alsa pipewire-pulse pipewire-jack
wireplumber alsa-utils sox gstreamer wireplumber alsa-utils sox gstreamer
@@ -1615,6 +1629,60 @@ EOF
log_info "Audio configuration installed" log_info "Audio configuration installed"
} }
#
# Live settings transfer
#
copy_live_audio_settings() {
log_info "Saving live audio settings for the installed system"
local alsaState liveHome stateName targetHome stateDir
local targetHomes=("$mountPoint/etc/skel" "$mountPoint/root")
local stateNames=(default-routes default-nodes default-profile stream-properties restore-stream)
mkdir -p "$mountPoint/var/lib/alsa"
alsaState=$(mktemp "$mountPoint/var/lib/alsa/asound.state.XXXXXX")
if alsactl -f "$alsaState" store; then
mv -f "$alsaState" "$mountPoint/var/lib/alsa/asound.state"
else
rm -f "$alsaState"
log_warning "Could not save live ALSA mixer settings"
fi
if ! liveHome=$(getent passwd stormux | cut -d: -f6) || [[ -z "$liveHome" ]]; then
log_warning "Could not find the live user's audio settings"
return 0
fi
stateDir="$liveHome/.local/state/wireplumber"
if [[ ! -f "$stateDir/default-routes" ]]; then
log_warning "Live WirePlumber volume settings are unavailable"
return 0
fi
for targetHome in "${userNames[@]}"; do
targetHomes+=("$mountPoint/home/$targetHome")
done
for targetHome in "${targetHomes[@]}"; do
mkdir -p "$targetHome/.local/state"
chown --reference="$targetHome" "$targetHome/.local" "$targetHome/.local/state"
install -d -m 700 "$targetHome/.local/state/wireplumber"
chown --reference="$targetHome" "$targetHome/.local/state/wireplumber"
for stateName in "${stateNames[@]}"; do
if [[ -f "$stateDir/$stateName" && ! -L "$stateDir/$stateName" ]]; then
install -m 600 "$stateDir/$stateName" "$targetHome/.local/state/wireplumber/$stateName"
chown --reference="$targetHome" "$targetHome/.local/state/wireplumber/$stateName"
fi
done
done
}
copy_live_network_connections() {
log_info "Saving active network connections for the installed system"
if ! /usr/local/lib/stormux/copy-live-network "$mountPoint" 2>&1 | tee -a "$logFile"; then
log_warning "Some live network settings could not be copied; review the network transfer warnings"
fi
}
# #
# SSH login monitor installation (script + service) # SSH login monitor installation (script + service)
# #
@@ -1798,6 +1866,7 @@ systemctl enable NetworkManager.service
systemctl enable brltty.path systemctl enable brltty.path
systemctl enable fenrirscreenreader.service systemctl enable fenrirscreenreader.service
systemctl enable cronie.service systemctl enable cronie.service
systemctl enable irqbalance.service
# Enable bluetooth if present # Enable bluetooth if present
if ! systemctl enable bluetooth.service; then if ! systemctl enable bluetooth.service; then
@@ -2277,6 +2346,11 @@ install_ssh_login_monitor
currentStep="chroot system configuration" currentStep="chroot system configuration"
configure_system configure_system
# Preserve the live selections after package setup and user creation.
currentStep="live audio and network settings"
copy_live_audio_settings
copy_live_network_connections
# Install bootloader # Install bootloader
currentStep="bootloader installation" currentStep="bootloader installation"
install_bootloader install_bootloader
+142
View File
@@ -0,0 +1,142 @@
#!/usr/bin/env python3
"""Export active Wi-Fi/Ethernet profiles without modifying the live connection."""
from pathlib import Path
import os
import sys
import tempfile
from uuid import UUID
import gi
gi.require_version("NM", "1.0")
from gi.repository import GLib, NM
def write_private_file(filePath, contents):
filePath.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
descriptor, tempName = tempfile.mkstemp(dir=filePath.parent)
try:
with os.fdopen(descriptor, "wb") as targetFile:
targetFile.write(contents)
os.replace(tempName, filePath)
finally:
if os.path.exists(tempName):
os.unlink(tempName)
def profile_exists(profileDir, connectionUuid):
for profilePath in profileDir.glob("*"):
if not profilePath.is_file():
continue
keyfile = GLib.KeyFile.new()
try:
keyfile.load_from_file(str(profilePath), GLib.KeyFileFlags.NONE)
if keyfile.get_string("connection", "uuid") == connectionUuid:
return True
except GLib.Error:
continue
return False
def copy_certificates(connection, targetRoot, connectionUuid):
setting = connection.get_setting_802_1x()
if setting is None:
return
for propertyName in (
"ca-cert", "client-cert", "private-key",
"phase2-ca-cert", "phase2-client-cert", "phase2-private-key",
):
methodName = propertyName.replace("-", "_")
if getattr(setting, f"get_{methodName}_scheme")() != NM.Setting8021xCKScheme.PATH:
continue
sourcePath = Path(getattr(setting, f"get_{methodName}_path")())
installedPath = Path("/etc/NetworkManager/certs") / connectionUuid / propertyName
write_private_file(targetRoot / installedPath.relative_to("/"), sourcePath.read_bytes())
setting.set_property(
propertyName, GLib.Bytes.new(b"file://" + os.fsencode(installedPath) + b"\0")
)
def copy_connection(remote, targetRoot):
connectionUuid = str(UUID(remote.get_uuid()))
profileDir = targetRoot / "etc/NetworkManager/system-connections"
if profile_exists(profileDir, connectionUuid):
print(f"Preserving existing installed network profile {connectionUuid}")
return
connection = NM.SimpleConnection.new_clone(remote)
connection.verify()
for setting in remote.get_settings():
secretNames = [
prop.name for prop in setting.list_properties()
if prop.flags & NM.SETTING_PARAM_SECRET
]
if not secretNames:
continue
settingName = setting.get_name()
secrets = remote.get_secrets(settingName, None)
if secrets is not None:
connection.update_secrets(settingName, secrets)
copiedSetting = connection.get_setting_by_name(settingName)
for secretName in secretNames:
if copiedSetting.get_property(secretName) is not None:
copiedSetting.set_secret_flags(secretName, NM.SettingSecretFlags.NONE)
if connection.need_secrets()[0]:
raise ValueError("Required credentials are unavailable")
# Live-user restrictions must not exclude the newly created users.
settings = connection.get_setting_connection()
settings.props.permissions = []
settings.props.autoconnect = True
copy_certificates(connection, targetRoot, connectionUuid)
connection.verify()
connection.verify_secrets()
keyfile = NM.keyfile_write(connection, NM.KeyfileHandlerFlags.NONE, None, None)
write_private_file(
profileDir / f"stormux-live-{connectionUuid}.nmconnection",
keyfile.to_data()[0].encode("utf-8"),
)
def copy_active_connections(client, targetRoot):
failed = False
copiedCount = 0
for active in client.get_active_connections():
connectionType = active.get_connection_type()
if connectionType == "loopback":
continue
if connectionType not in ("802-11-wireless", "802-3-ethernet"):
print("WARNING: An active network profile needs manual transfer (unsupported connection type)")
failed = True
continue
try:
remote = active.get_connection()
if remote is None:
raise ValueError("Active connection has no profile")
copy_connection(remote, targetRoot)
copiedCount += 1
except (GLib.Error, OSError, ValueError):
# Exceptions may contain credentials or private paths. Never log them.
print("WARNING: Could not transfer an active network profile and its credentials or certificates")
failed = True
print(f"Preserved {copiedCount} active network connection(s)")
return not failed
def main():
if len(sys.argv) != 2 or os.geteuid() != 0:
print("Usage (as root): copy-live-network TARGET_ROOT", file=sys.stderr)
return 1
try:
client = NM.Client.new(None)
if not client.get_nm_running():
raise ValueError("NetworkManager is not running")
return 0 if copy_active_connections(client, Path(sys.argv[1])) else 1
except (GLib.Error, OSError, ValueError):
print("WARNING: Could not read live NetworkManager connections")
return 1
if __name__ == "__main__":
sys.exit(main())
+1
View File
@@ -108,6 +108,7 @@ ppp
pptpclient pptpclient
pv pv
python-dbus python-dbus
python-gobject
python-pyenchant python-pyenchant
python-pyte python-pyte
python-pyperclip python-pyperclip
+1
View File
@@ -25,6 +25,7 @@ file_permissions=(
["/usr/local/bin/configure-stormux"]="0:0:755" ["/usr/local/bin/configure-stormux"]="0:0:755"
["/usr/local/bin/install-stormux"]="0:0:755" ["/usr/local/bin/install-stormux"]="0:0:755"
["/usr/local/lib/stormux/select-speech-module"]="0:0:755" ["/usr/local/lib/stormux/select-speech-module"]="0:0:755"
["/usr/local/lib/stormux/copy-live-network"]="0:0:755"
["/usr/local/bin/stormux-setup.sh"]="0:0:755" ["/usr/local/bin/stormux-setup.sh"]="0:0:755"
["/usr/local/bin/init-pipewire-sound.sh"]="0:0:755" ["/usr/local/bin/init-pipewire-sound.sh"]="0:0:755"
["/usr/share/fenrirscreenreader/scripts/ssh-login-monitor.sh"]="0:0:755" ["/usr/share/fenrirscreenreader/scripts/ssh-login-monitor.sh"]="0:0:755"