Compare commits

...
24 Commits
Author SHA1 Message Date
Storm Dragon 1df6d1740e Install ucode for valid types in x86_64. Also copy over sound settings and network used during live media. 2026-11-17 16:39:43 -05:00
Storm Dragon dc209ae275 Install wine-access when audiogame-manager is selected during x86_64 installation. 2026-11-02 09:53:41 -05:00
Storm Dragon 216d93fbff Fix for NetworkManager tracking during setup. 2026-11-02 09:43:05 -05:00
Storm Dragon c7f21c9234 Changes for new version of Fenrir and extended speech customization options. 2026-11-01 18:52:49 -05:00
Storm Dragon d41a531b9d default ~/.Xresources added. 2026-10-10 17:53:17 -04:00
Storm Dragon 4134a16ecd More work on the speech selector. 2026-09-15 23:21:13 -04:00
Storm Dragon 0df6d7b0fc Fixed stale packages. 2026-09-15 22:59:05 -04:00
Storm Dragon a8d4fc1fc1 Experimental: add speech selector to startup. 2026-09-15 22:52:13 -04:00
Storm Dragon 7ee829d56c Updated some packages for x86_64. 2026-09-15 22:27:06 -04:00
Storm Dragon 200c24e2a4 Move maintained package recipes to dedicated repository 2026-09-10 01:59:41 -04:00
Storm Dragon 92bfe467e4 Fixed a bug that could leave fstab unmodified on new installations. 2026-07-23 19:37:42 -04:00
Storm Dragon b2d6cdc25d Fix SSH choice and image build safeguards 2026-07-17 00:12:40 -04:00
Storm Dragon da26909527 Add poweroff prompt to the end of the x86_64 installer. 2026-07-15 16:35:09 -04:00
Storm Dragon 99a944f903 Use official xlibre repository on x86_64 systems. This hopefully means less packages for me to maintain for 2 systems. 2026-07-15 16:05:27 -04:00
Storm Dragon 1f7aea6c7c Make x86_64 image more similar to Pi image if installer is used. Improve RHVoice fixes so they shouldn't be stale any more. 2026-07-15 15:39:43 -04:00
Storm Dragon d67ca0f3e0 Ship I38 in Pi images by default
Add the I38 desktop stack to the Raspberry Pi image build, including Cthulhu, XLibre, nodm, xorg-xinit, and I38 runtime Python dependencies.

Generate the default stormux user's I38 configuration during image creation with the non-interactive I38 mode, configure nodm for that generated xinitrc, and set Speech Dispatcher to use RHVoice by default.

Harden the Pi build for larger GUI images by raising the default image size to 8 GB, skipping mkinitcpio autodetect for the target image initramfs, and validating the root filesystem before compression.

Rework first boot so volume calibration runs before Fenrir starts, temporary tty1 autologin and passwordless sudo are removed during setup, I38/nodm startup is selected explicitly, and physical versus headless X configuration is written before nodm starts.

Document the Pi GUI rollout in gui.md and refresh README size and desktop references.
2026-06-29 15:59:33 -04:00
Storm Dragon 5ec1d7727d Steam now offered in x86_64 installer. Fix up the rhvoice dictionary copy. A few minor cleanups. Rename pi images to more clearly show they support both Raspberry Pi 4 and 5. 2026-06-23 19:40:06 -04:00
Storm Dragon 426069f36a Xlibre build script updated. 2026-06-21 16:21:37 -04:00
Storm Dragon 4aeff109f7 Latest fixes for x86_64 installer. Updated README for Pi images. 2026-06-21 12:56:38 -04:00
Storm Dragon 46e3f0d084 Make sure GUI DISPLAY is set. 2026-06-06 14:22:07 -04:00
Storm Dragon 13e3ce64fd Fix bug in select loop so multiple options do not appear on the same line. 2026-06-05 13:16:48 -04:00
Storm Dragon f6e2e2f4c8 added sas to both images. A few minor updates to image generation for pi images. 2026-06-04 23:52:44 -04:00
Storm Dragon c94a71e0d6 Missed some deamon to daemon updates. This shoulf make Fenrir work with the installer automatically again, switching modes, etc. 2026-06-03 00:34:19 -04:00
Storm Dragon f1dfe1737b qemu-boot.sh now checks for required packages. 2026-06-01 19:37:53 -04:00
47 changed files with 2919 additions and 1688 deletions

No files matched your search

+1
View File
@@ -5,3 +5,4 @@ CLAUDE.md
*.sha1sum *.sha1sum
*.xz *.xz
*.zst *.zst
scripts/xlibre-video-dummy-with-vt/
@@ -1,57 +0,0 @@
# XLibre Updater Design
## Goal
Add a repository-managed workflow for updating and building the Stormux XLibre package set in the correct dependency order, while keeping `xlibre-video-dummy-with-vt` manually maintained and reviewed against upstream `xlibre-video-dummy`.
## Scope
This design covers:
- correcting the package build order in `scripts/upgrade-xlibre.sh`
- reviewing and updating `scripts/xlibre-video-dummy-with-vt/PKGBUILD`
- regenerating `.SRCINFO` after PKGBUILD changes
This design does not automate AUR publication or rewrite the downstream package from upstream sources.
## Current State
The updater script currently builds packages in an order that does not match the XLibre dependency chain. `xlibre-video-dummy-with-vt` is also version-skewed relative to the current AUR `xlibre-video-dummy` package and needs a manual rebase of relevant packaging changes.
## Dependency Order
The package build order will be:
1. `xlibre-xserver-common`
2. `xlibre-xserver-devel`
3. `xlibre-input-libinput`
4. `xlibre-xserver`
5. `xlibre-video-fbdev`
6. `xlibre-video-dummy-with-vt`
This order reflects current AUR dependencies: `xlibre-xserver` requires `xlibre-xserver-common` and `xlibre-input-libinput`, while the input and video driver packages require `xlibre-xserver-devel` to build.
## Downstream Package Policy
`xlibre-video-dummy-with-vt` remains a separate, manually maintained package because it has a different maintainer and should not be auto-derived from the upstream AUR package.
The maintenance rule is:
- treat AUR `xlibre-video-dummy` as the packaging baseline
- manually port relevant upstream PKGBUILD changes into `xlibre-video-dummy-with-vt`
- keep only the intentional downstream delta needed for VT behavior
## Implementation Shape
`scripts/upgrade-xlibre.sh` will continue cloning packages from AUR and building them locally, but with the corrected order.
`scripts/xlibre-video-dummy-with-vt/PKGBUILD` will be updated to match the current upstream package structure where appropriate:
- current version and release
- current `depends` and `makedepends`
- current build flags and source layout
- regenerated checksums
The VT-specific patch remains the only behavioral divergence.
## Error Handling
The script should fail fast on clone or build errors and stop rather than continuing with a broken package chain. Because package order is intentional, partial success should be considered incomplete.
## Verification
Verification will be task-focused:
- confirm the updater script contains the corrected package order
- compare the downstream PKGBUILD against current upstream `xlibre-video-dummy`
- regenerate and verify `.SRCINFO`
- run `shellcheck` on the updater script
- run `makepkg --printsrcinfo` in the downstream package directory
+37 -21
View File
@@ -1,19 +1,19 @@
# Stormux Pi Image Builder # Stormux Pi Image Builder
Stormux provides an Arch-based Raspberry Pi image that already includes Fenrir, Orca, and other screen-reader friendly defaults. This repository hosts the scripts maintained by the Stormux community (originally crafted by Storm) so anyone can rebuild the image, customize the overlay, and share accessible Pi spins. Stormux provides an Arch-based Raspberry Pi image that already includes Fenrir, Cthulhu, I38, and other screen-reader friendly defaults. This repository hosts the scripts maintained by the Stormux community (originally crafted by Storm) so anyone can rebuild the image, customize the overlay, and share accessible Pi spins.
## Purpose & Scope ## Purpose & Scope
This repo captures the complete build pipeline for the Stormux Raspberry Pi images: downloading Arch Linux ARM, layering the accessible defaults, compiling Fenrir and helper tools, and producing a ready-to-flash `.img`. Running the script yourself lets you reproduce the same system the project ships for the Pi 4/400, tweak it, and publish new spins without reverse-engineering the original release. This repo captures the complete build pipeline for the Stormux Raspberry Pi images: bootstrapping Arch Linux ARM, layering the accessible defaults, installing Fenrir and helper tools, and producing a compressed ready-to-flash image. Running the script yourself lets you reproduce the same system the project ships for Raspberry Pi 4/5-class systems, tweak it, and publish new spins without reverse-engineering the original release.
## What You Need ## What You Need
- A 64-bit Arch Linux host (bare metal or VM) with at least 20 GB free disk space. - A 64-bit Arch Linux host (bare metal or VM) with at least 20 GB free disk space.
- Root access on that host. The builder partitions loopback devices and must run as root. - Root access on that host. The builder partitions loopback devices and must run as root.
- Required packages: `arch-install-scripts`, `dosfstools`, `parted`, `wget`, `qemu-user-static`, `qemu-user-static-binfmt`, plus standard developer tools that Arch already ships. - Required packages: `arch-install-scripts`, `dosfstools`, `parted`, `qemu-user-static`, `qemu-user-static-binfmt`, plus standard developer tools that Arch already ships.
- A Raspberry Pi 4/400 or similar board (a Pi 3 works with the `-v 32` option) and a microSD card (8 GB or larger recommended). - A Raspberry Pi 4, Raspberry Pi 400, Raspberry Pi 5, or compatible board, plus a microSD card (16 GB or larger recommended).
Install dependencies on the build host with: Install dependencies on the build host with:
```bash ```bash
sudo pacman -S arch-install-scripts dosfstools parted wget qemu-user-static qemu-user-static-binfmt sudo pacman -S arch-install-scripts dosfstools parted qemu-user-static qemu-user-static-binfmt
``` ```
## Getting the Source ## Getting the Source
@@ -29,24 +29,26 @@ The script is designed for an x86_64 Arch host so it can emulate ARM binaries wi
## Building Your First Image ## Building Your First Image
1. Become root (`sudo -i`) so the script can create loop devices and mount them. 1. Become root (`sudo -i`) so the script can create loop devices and mount them.
2. From `/path/to/stormux`, run: 2. From the Pi builder directory, run:
```bash ```bash
sudo ./pi4/build/build-stormux.sh -v 64 -l en_US -s 6 cd /path/to/stormux/pi4/build
sudo ./build-stormux.sh -l en_US -s 8
``` ```
- `-v 64` builds the aarch64 image (use `-v 32` for the Pi 3/armv7h). - The builder creates an aarch64 image for Raspberry Pi 4/5-class systems.
- `-l en_US` selects the locale (use `es_ES`, `fr_FR`, etc.). - `-l en_US` selects the locale (use `es_ES`, `fr_FR`, etc.).
- `-s 6` sets the image size in gigabytes. - `-s 8` sets the image size in gigabytes.
- Add `-n my-stormux.img` to override the default filename. - Add `-n my-stormux.img` to override the default filename.
3. Grab coffee. The script downloads the latest Arch Linux ARM tarball, provisions packages (Fenrir, Orca, NetworkManager, PipeWire, etc.), copies the overlay from `pi4/files/`, and cleans up. 3. Grab coffee. The script bootstraps Arch Linux ARM, provisions packages (Fenrir, Cthulhu, I38, XLibre, NetworkManager, PipeWire, etc.), copies the overlay from `pi4/files/`, installs the latest `sas`, cleans up, compresses the image, and writes a SHA-1 checksum.
4. When the `build-stormux.sh` command returns, you should have an `.img` file in your working directory (for example `stormux-pi4-aarch64-YYYY-MM-DD.img`). 4. When the `build-stormux.sh` command returns, you should have an `.img.xz` file and matching `.sha1sum` in your working directory (for example `stormux-rpi4-5-aarch64-YYYY-MM-DD.img.xz`).
If the build is interrupted, run `sudo umount -R /mnt && sudo losetup -D` to be sure nothing is still mounted. If the build is interrupted, run `sudo umount -R /mnt && sudo losetup -D` to be sure nothing is still mounted.
## Customizing the Image ## Customizing the Image
- **Overlay files**: Add or edit files in `pi4/files/` using the same paths they should have inside the Pi. Example: to add a custom MOTD, edit `pi4/files/etc/motd`. - **Overlay files**: Add or edit files in `pi4/files/` using the same paths they should have inside the Pi. Example: to add a custom MOTD, edit `pi4/files/etc/motd`.
- **Packages**: Edit the package list inside `pi4/build/build-stormux.sh` (search for `pacman -Su --needed`). Add or remove entries as needed, then rebuild. - **Packages**: Edit the package list inside `pi4/build/build-stormux.sh` (search for `pacman -Su --needed`). Add or remove entries as needed, then rebuild.
- **AUR components**: The script already compiles Fenrir (`fenrir-git`), `growpartfs`, `log2ram`, and `yay`. To add more AUR packages, append them to the `aurPackages` array near the middle of the script. - **Package sources**: The build does not fetch or compile packages from the AUR. Packages are installed from the official Arch Linux ARM repositories or the Stormux repository. The finished image includes `yay`, but it is installed as a prebuilt package from the Stormux repository and is not used during the build.
- **First-boot behavior**: Modify `pi4/files/usr/local/bin/configure-stormux` to change the guided setup that runs when the image boots the first time. - **First-boot behavior**: Modify `pi4/files/usr/local/bin/configure-stormux` to change the guided setup that runs when the image boots the first time.
- **X resources**: `pi4/files/etc/skel/.Xresources` is installed in the default user's home and `/etc/skel`, so newly created users inherit it too.
Remember to keep permissions sensible (`chmod 755` for scripts, `644` for configs) so rsync copies them correctly. Remember to keep permissions sensible (`chmod 755` for scripts, `644` for configs) so rsync copies them correctly.
@@ -61,23 +63,38 @@ Rebuild after pulling so your custom image inherits any upstream fixes (new pack
## Flashing and Booting ## Flashing and Booting
1. Verify the image: 1. Verify the image:
```bash ```bash
ls -lh stormux-pi4-*.img ls -lh stormux-rpi4-5-*.img.xz stormux-rpi4-5-*.img.xz.sha1sum
sha1sum -c stormux-rpi4-5-*.img.xz.sha1sum
``` ```
2. Write it to an SD card (replace `/dev/sdX` with your card, not a partition): 2. Write it to an SD card (replace `/dev/sdX` with your card, not a partition):
```bash ```bash
sudo dd if=stormux-pi4-aarch64-*.img of=/dev/sdX bs=4M status=progress conv=fsync xzcat stormux-rpi4-5-aarch64-*.img.xz | sudo dd of=/dev/sdX bs=4M status=progress conv=fsync
``` ```
3. Insert the card into your Pi 4/400 and power it on. You should hear Fenrir start speaking once the user session loads. 3. Insert the card into your Raspberry Pi and power it on. The first boot automatically logs in on tty1 and starts guided setup.
4. Log in using the default credentials (username `stormux`, password `stormux`). Root uses `root`/`root` until you change it. 4. Setup calibrates volume, offers the default speech-engine selector, and speaks the laptop-layout question using the selected engine. Enter or N selects desktop layout; Y selects laptop layout. Fenrir stays stopped until these choices are complete.
5. Run `sudo configure-stormux` (or follow the automatic prompt) to finish the guided setup: configure networking via `nmtui`, update the clock, optionally resize the SD card with `growpartfs`, and toggle Fenrir’s layout. 5. Setup updates `[keyboard] layout` in `/etc/fenrirscreenreader/settings/settings.toml`, preserving comments, and validates the edited settings with `fenrir --check-config` before replacing the original. It then starts Fenrir and presents the welcome prompt.
6. Continue with the Pi-specific setup: display and I38 startup choices, optional SD-card resizing, networking via `nmtui`, and the clock/timezone. Fenrir is enabled for later boots unless you choose to disable console speech when I38 starts at boot.
7. After first-boot setup, log in using the default credentials (username `stormux`, password `stormux`). Root uses `root`/`root` until you change it. If setup is interrupted, run `sudo configure-stormux` to continue.
## Testing Without Hardware ## Testing Without Hardware
You can boot the image in a container to verify services before flashing: You can boot the image in a container to verify services before flashing:
```bash ```bash
sudo systemd-nspawn -i stormux-pi4-aarch64-*.img --boot xz -dk stormux-rpi4-5-aarch64-*.img.xz
sudo systemd-nspawn -i stormux-rpi4-5-aarch64-*.img --boot
``` ```
Use `machinectl` to connect to the console and ensure critical services start. For unit files you edit, run `systemd-analyze verify path/to/unit` inside the container or the Pi. Use `machinectl` to connect to the console and ensure critical services start. For unit files you edit, run `systemd-analyze verify path/to/unit` inside the container or the Pi.
### Focused Setup Checks
From the repository root, run:
```bash
python3 pi4/tests/test-first-boot-fenrir-setup.py
bash tests/test-select-speech-module.sh
shellcheck pi4/build/build-stormux.sh pi4/files/etc/profile.d/stormux_first_boot.sh pi4/files/usr/local/bin/configure-stormux
```
For acceptance, boot a rebuilt image on a Pi. Confirm that volume calibration comes first, voice previews work with Up/Down, Enter accepts the engine, Escape keeps the previous engine, and the laptop question uses the selected voice. Test desktop (Enter or N) and laptop (Y) bindings and confirm Fenrir starts once after the choice. Exercise both connected and headless display setup, I38 boot with console Fenrir enabled and disabled, SD-card resize accepted and declined, and setup with and without networking. Reboot after completing setup to check voice/layout persistence, the selected console/I38 startup behavior, and removal of temporary autologin/passwordless sudo. Automated checks and container boots do not establish audible speech, physical keyboard behavior, or real Pi boot acceptance.
## Troubleshooting Tips ## Troubleshooting Tips
- **Locale or package errors**: Ensure your host’s pacman keyring is up to date (`sudo pacman -Sy archlinux-keyring`). - **Locale or package errors**: Ensure your host’s pacman keyring is up to date (`sudo pacman -Sy archlinux-keyring`).
- **Loop device cleanup**: After failures run `sudo losetup -a` to find stray devices, then `sudo losetup -d /dev/loopX`. - **Loop device cleanup**: After failures run `sudo losetup -a` to find stray devices, then `sudo losetup -d /dev/loopX`.
@@ -86,9 +103,8 @@ Use `machinectl` to connect to the console and ensure critical services start. F
## Sharing Your Image ## Sharing Your Image
When you are happy with your customizations: When you are happy with your customizations:
1. Rebuild so you have a clean `.img` file named clearly (for example, `stormux-pi4-a11y-v1.img`). 1. Rebuild so you have a clean `.img.xz` file named clearly.
2. Compress it (`xz -T0 -z stormux-pi4-a11y-v1.img`). 2. Publish the compressed image, its `.sha1sum`, the exact commit you built from, and any extra scripts you used. The README and `AGENTS.md` in this repo explain the layout so others can reproduce your work.
3. Publish the image along with the exact commit you built from and any extra scripts you used. The README and `AGENTS.md` in this repo explain the layout so others can reproduce your work.
## Huge Thanks to Storm ## Huge Thanks to Storm
Storm did the heavy lifting—curating packages, wiring up Fenrir/Orca defaults, scripting the first-boot assistant, and sharing the whole build process so the community can remix it. This repo exists because accessibility was treated as a first-class feature from day one, and the documentation lets anyone extend that work. If the image improves your Pi experience, consider contributing improvements or telling Storm thanks. Storm did the heavy lifting—curating packages, wiring up Fenrir/Orca defaults, scripting the first-boot assistant, and sharing the whole build process so the community can remix it. This repo exists because accessibility was treated as a first-class feature from day one, and the documentation lets anyone extend that work. If the image improves your Pi experience, consider contributing improvements or telling Storm thanks.
+167 -26
View File
@@ -24,13 +24,6 @@ mounted=1
set -e # Don't want to destroy stuff if this goes majorly wrong. set -e # Don't want to destroy stuff if this goes majorly wrong.
trap cleanup EXIT # make sure the script cleans up after itself before closing. trap cleanup EXIT # make sure the script cleans up after itself before closing.
# shellcheck disable=SC2329 # verify_image is invoked from cleanup, which is invoked via trap EXIT
verify_image() {
echo "Checking completed image filesystems..."
fsck.vfat -n "${loopdev}p1"
e2fsck -fn "${loopdev}p2"
}
# shellcheck disable=SC2329 # compress_image is invoked from finish_build # shellcheck disable=SC2329 # compress_image is invoked from finish_build
compress_image() { compress_image() {
local compressedImage="${imageName}.xz" local compressedImage="${imageName}.xz"
@@ -50,16 +43,11 @@ compress_image() {
# shellcheck disable=SC2329 # cleanup_image is invoked from cleanup and finish_build # shellcheck disable=SC2329 # cleanup_image is invoked from cleanup and finish_build
cleanup_image() { cleanup_image() {
local verifyFilesystems="${1:-false}"
local cleanupStatus=0 local cleanupStatus=0
if [[ $mounted -eq 0 ]]; then if [[ $mounted -eq 0 ]]; then
if ! umount -R /mnt; then if ! umount -R /mnt; then
cleanupStatus=1 cleanupStatus=1
elif [[ "$verifyFilesystems" == true ]]; then
if ! verify_image; then
cleanupStatus=1
fi
fi fi
fi fi
@@ -80,17 +68,25 @@ cleanup_image() {
return "$cleanupStatus" return "$cleanupStatus"
} }
# shellcheck disable=SC2329 # validate_image_filesystems is invoked from finish_build
validate_image_filesystems() {
local rootPartition="${loopdev}p2"
echo "Checking root filesystem..."
e2fsck -f -n "$rootPartition"
}
# shellcheck disable=SC2329 # cleanup is invoked via trap EXIT # shellcheck disable=SC2329 # cleanup is invoked via trap EXIT
cleanup() { cleanup() {
local status=$? # capture original exit status so failures propagate local status=$? # capture original exit status so failures propagate
local cleanupStatus=0 local cleanupStatus=0
if ! cleanup_image false; then if ! cleanup_image; then
cleanupStatus=1 cleanupStatus=1
fi fi
if [[ $status -eq 0 && $cleanupStatus -ne 0 ]]; then if [[ $status -eq 0 && $cleanupStatus -ne 0 ]]; then
echo "Image build commands completed, but cleanup or filesystem verification failed." echo "Image build commands completed, but cleanup failed."
status=1 status=1
fi fi
@@ -98,10 +94,23 @@ cleanup() {
} }
finish_build() { finish_build() {
if [[ $mounted -eq 0 ]]; then
if ! umount -R /mnt; then
echo "Image build commands completed, but unmounting failed."
exit 1
fi
mounted=1
fi
if ! validate_image_filesystems; then
echo "Image filesystem validation failed."
exit 1
fi
trap - EXIT trap - EXIT
if ! cleanup_image true; then if ! cleanup_image; then
echo "Image build commands completed, but cleanup or filesystem verification failed." echo "Image build commands completed, but cleanup failed."
exit 1 exit 1
fi fi
@@ -112,6 +121,54 @@ finish_build() {
exit 0 exit 0
} }
install_rhvoice_english_fixes() {
local rhvoiceRepo="https://git.stormux.org/storm/rhvoice-english"
local targetDir="/mnt/etc/RHVoice/dicts/English"
local tempDir
local installStatus=0
tempDir="$(mktemp -d)"
echo "Installing latest RHVoice English dictionary fixes..."
if ! git clone --depth 1 "$rhvoiceRepo" "$tempDir"; then
rm -rf "$tempDir"
return 1
fi
mkdir -p "$targetDir"
rm -f "$targetDir/namefix.txt" "$targetDir/wordfix.txt"
if ! cp -a "$tempDir/English/." "$targetDir/"; then
installStatus=1
fi
rm -rf "$tempDir"
return "$installStatus"
}
# shellcheck disable=SC2329 # install_sas is emitted into the chroot heredoc with declare -f
install_sas() {
local sasRepo="https://git.stormux.org/storm/sas"
local sasPath="/usr/local/bin/sas"
local tempDir
local installStatus=0
tempDir="$(mktemp -d)"
echo "Installing latest sas..."
if ! git clone --depth 1 "$sasRepo" "$tempDir"; then
rm -rf "$tempDir"
return 1
fi
rm -f "$sasPath"
if ! install -m 755 "$tempDir/sas.py" "$sasPath"; then
installStatus=1
fi
rm -rf "$tempDir"
return "$installStatus"
}
help() { help() {
echo -e "Usage:\n" echo -e "Usage:\n"
echo "With no arguments, build with default parameters." echo "With no arguments, build with default parameters."
@@ -125,8 +182,8 @@ help() {
declare -A command=( declare -A command=(
[h]="This help screen." [h]="This help screen."
[l:]="Language default is en_US." [l:]="Language default is en_US."
[n:]="Image name, default is stormux-pi4-aarch64-<yyyy-mm-dd>.img" [n:]="Image name, default is stormux-rpi4-5-aarch64-<yyyy-mm-dd>.img"
[s:]="image size in GB, default is 6." [s:]="image size in GB, default is 8."
) )
# Convert the keys of the associative array to a format usable by getopts # Convert the keys of the associative array to a format usable by getopts
@@ -156,8 +213,8 @@ while getopts "${args}" i ; do
done done
# make sure variables are set, or use defaults. # make sure variables are set, or use defaults.
export imageSize="${imageSize:-6G}" export imageSize="${imageSize:-8G}"
imageName="${imageName:-stormux-pi4-aarch64-$(date '+%Y-%m-%d').img}" imageName="${imageName:-stormux-rpi4-5-aarch64-$(date '+%Y-%m-%d').img}"
export imageName export imageName
export imageLanguage="${imageLanguage:-en_US.UTF-8}" export imageLanguage="${imageLanguage:-en_US.UTF-8}"
@@ -179,6 +236,38 @@ if [ "$(whoami)" != "root" ] ; then
exit 1 exit 1
fi fi
# Refuse to mount the image over an unrelated filesystem already using /mnt.
if ! command -v mountpoint > /dev/null 2>&1; then
echo "Error: mountpoint is required to verify that /mnt is available."
exit 1
fi
if [[ ! -d /mnt || ! -w /mnt ]]; then
echo "Error: /mnt is missing or not writable. Please create or fix permissions."
exit 1
fi
if mountpoint -q /mnt; then
if [[ -t 0 ]]; then
read -rp "/mnt is already mounted. Unmount it to continue? [y/N] " answerText
case "$answerText" in
y|Y|yes|YES)
if ! umount /mnt; then
echo "Error: Failed to unmount /mnt."
exit 1
fi
;;
*)
echo "Error: Refusing to proceed while /mnt is mounted."
exit 1
;;
esac
else
echo "Error: /mnt is already mounted. Refusing to proceed in non-interactive mode."
exit 1
fi
fi
# make sure the needed tools are installed # make sure the needed tools are installed
if [[ "$(uname -m)" == "x86_64" ]]; then if [[ "$(uname -m)" == "x86_64" ]]; then
if ! pacman -Q qemu-user-static &> /dev/null ; then if ! pacman -Q qemu-user-static &> /dev/null ; then
@@ -196,7 +285,7 @@ for i in arch-install-scripts dosfstools parted ; do
exit 1 exit 1
fi fi
done done
for i in e2fsck fsck.vfat sha1sum xz ; do for i in sha1sum xz ; do
if ! command -v "$i" &> /dev/null ; then if ! command -v "$i" &> /dev/null ; then
echo "Please install ${i} before continuing." echo "Please install ${i} before continuing."
exit 1 exit 1
@@ -330,6 +419,7 @@ packages=(
bluez-utils bluez-utils
brltty brltty
cronie cronie
curl
dialog dialog
espeak-ng espeak-ng
fake-hwclock fake-hwclock
@@ -339,6 +429,7 @@ packages=(
gstreamer gstreamer
gst-plugins-base gst-plugins-base
gst-plugins-good gst-plugins-good
i38
ii ii
# Keep Pi onboard firmware plus common USB/network chipset firmware without # Keep Pi onboard firmware plus common USB/network chipset firmware without
# pulling in unrelated desktop/server GPU firmware. # pulling in unrelated desktop/server GPU firmware.
@@ -350,6 +441,8 @@ packages=(
man man
man-pages man-pages
networkmanager networkmanager
nodm-dgw
openevv-git
openssh openssh
parted parted
pipewire pipewire
@@ -359,10 +452,13 @@ packages=(
poppler poppler
python-dbus python-dbus
python-gobject python-gobject
python-msgpack
python-pyenchant python-pyenchant
python-pyte python-pyte
python-pyperclip python-pyperclip
python-tornado
raspberrypi-utils raspberrypi-utils
cthulhu
socat socat
realtime-privileges realtime-privileges
rhvoice-voice-bdl rhvoice-voice-bdl
@@ -370,6 +466,7 @@ packages=(
rsync rsync
screen screen
sox sox
speech-dispatcher
w3m-git w3m-git
wget wget
wireless-regdb wireless-regdb
@@ -377,16 +474,24 @@ packages=(
vi vi
xdg-user-dirs xdg-user-dirs
xdg-utils xdg-utils
xlibre-input-libinput
xlibre-video-dummy-with-vt
xlibre-video-fbdev
xlibre-xserver
xorg-xinit
yay yay
) )
pacman -Su --needed --noconfirm "\${packages[@]}" pacman -Su --needed --noconfirm "\${packages[@]}"
$(declare -f install_sas)
install_sas
# Fix mkinitcpio preset for linux-rpi - kms hook fails on aarch64 # Fix mkinitcpio preset for linux-rpi - kms hook fails on aarch64
# See: https://archlinuxarm.org/forum/viewtopic.php?t=16672 # See: https://archlinuxarm.org/forum/viewtopic.php?t=16672
if [[ -f /etc/mkinitcpio.d/linux-rpi.preset ]]; then if [[ -f /etc/mkinitcpio.d/linux-rpi.preset ]]; then
echo "Configuring mkinitcpio preset to skip kms hook..." echo "Configuring mkinitcpio preset to skip kms hook..."
sed -i "s/^default_options=.*/default_options=\"--skiphook kms\"/" /etc/mkinitcpio.d/linux-rpi.preset sed -i "s/^default_options=.*/default_options=\"-S autodetect --skiphook kms\"/" /etc/mkinitcpio.d/linux-rpi.preset
sed -i "s/^fallback_options=.*/fallback_options=\"-S autodetect --skiphook kms\"/" /etc/mkinitcpio.d/linux-rpi.preset sed -i "s/^fallback_options=.*/fallback_options=\"-S autodetect --skiphook kms\"/" /etc/mkinitcpio.d/linux-rpi.preset
fi fi
@@ -408,8 +513,10 @@ echo 'Stormux \r (\l)' > /etc/issue
echo >> /etc/issue echo >> /etc/issue
# Create the stormux user # Create the stormux user
useradd -m -g users -G wheel,realtime,audio,video,network,brlapi -s /bin/bash stormux useradd -m -g users -G wheel,realtime,audio,video,network,brlapi -s /bin/bash stormux
# Grant sudo privileges to the stormux user for package installation. # Grant normal sudo privileges plus temporary first-boot passwordless sudo.
echo 'stormux ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/wheel echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel
echo 'stormux ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/zz-stormux-first-boot
chmod 440 /etc/sudoers.d/wheel /etc/sudoers.d/zz-stormux-first-boot
# Set the password for the root user # Set the password for the root user
echo -e "root\nroot" | passwd "root" echo -e "root\nroot" | passwd "root"
# Set the password for the stormux user # Set the password for the stormux user
@@ -422,24 +529,54 @@ git config --global init.defaultBranch master
# Create desktop, downloads, music, and other directories. # Create desktop, downloads, music, and other directories.
xdg-user-dirs-update xdg-user-dirs-update
exit exit
mkdir -p /home/stormux/git
chown stormux:users /home/stormux/git
if ! sudo -u stormux git clone --depth 1 https://git.stormux.org/storm/I38 /home/stormux/git/I38; then
echo "Failed to clone I38."
exit 1
fi
cd /home/stormux/git/I38
sudo -u stormux ./i38.sh -D
cd /
if [[ -f /etc/nodm.conf ]]; then
sed -i \
-e "s/{user}/stormux/g" \
-e "s#^NODM_USER=.*#NODM_USER='stormux'#" \
-e "s#^NODM_XSESSION=.*#NODM_XSESSION='/home/stormux/.xinitrc'#" \
/etc/nodm.conf
fi
if command -v spd-conf > /dev/null 2>&1; then
spd-conf -n -C || echo "Warning: Speech Dispatcher system configuration failed."
fi
if [[ -f /etc/speech-dispatcher/speechd.conf ]]; then
speechBackup="\$(mktemp)"
if /usr/local/lib/stormux/select-speech-module \
--apply-module rhvoice /etc/speech-dispatcher/speechd.conf "\$speechBackup"; then
rm -f "\$speechBackup"
else
echo "Warning: Could not set RHVoice as the default speech engine."
rm -f "\$speechBackup"
fi
fi
# Enable linger so that hopefully sound will start at login. # Enable linger so that hopefully sound will start at login.
mkdir -p /var/lib/systemd/linger mkdir -p /var/lib/systemd/linger
touch /var/lib/systemd/linger/stormux touch /var/lib/systemd/linger/stormux
systemctl --global enable pipewire.service pipewire-pulse.service systemctl --global enable pipewire.service pipewire-pulse.service
/usr/share/fenrirscreenreader/tools/configure_pipewire.sh /usr/share/fenrirscreenreader/tools/configure_pipewire.sh
sudo -u stormux /usr/share/fenrirscreenreader/tools/configure_pipewire.sh sudo -u stormux /usr/share/fenrirscreenreader/tools/configure_pipewire.sh
# Configure sudo for group wheel, remove nopasswd for the stormux user # Ensure normal sudo remains configured after first-boot cleanup removes NOPASSWD.
echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel
# Set the hostname # Set the hostname
echo stormux > /etc/hostname echo stormux > /etc/hostname
# Configure services # Configure services
systemctl disable systemd-networkd.service systemd-networkd.socket systemctl disable systemd-networkd.service systemd-networkd.socket
# First-login setup starts Fenrir after volume, voice, and layout selection.
systemctl disable fenrirscreenreader.service
# Enable services # Enable services
services=( services=(
brltty.path brltty.path
cronie.service cronie.service
fake-hwclock.service fake-hwclock.service
fenrirscreenreader.service
log-to-ram-setup.service log-to-ram-setup.service
log-to-ram-sync.timer log-to-ram-sync.timer
log-to-ram-shutdown.service log-to-ram-shutdown.service
@@ -464,8 +601,12 @@ sed -i '/^DisableSandbox/d' /etc/pacman.conf
EOF EOF
install_rhvoice_english_fixes
# Copy skel files to stormux user home (after user rename in chroot) # Copy skel files to stormux user home (after user rename in chroot)
find ../files/etc/skel/ -mindepth 1 -exec cp -rv "{}" /mnt/home/stormux/ \; find ../files/etc/skel/ -mindepth 1 -exec cp -rv "{}" /mnt/home/stormux/ \;
install -Dm644 ../files/etc/skel/.Xresources /mnt/etc/skel/.Xresources
arch-chroot /mnt chown stormux:users /home/stormux/.Xresources
# Copy boot files again to ensure custom config overrides any package changes # Copy boot files again to ensure custom config overrides any package changes
cp -rv ../files/boot/* /mnt/boot cp -rv ../files/boot/* /mnt/boot
@@ -1,4 +0,0 @@
bifrost=buyfraust
danestange=dainstanggey
stange=stangey
kde=kaydeee
@@ -1,19 +0,0 @@
asus=aysus
certificate=cirtifficate
douche=doosh*
espeak=easpeak*
freenginx=freeenginex
git=ghit*
github=ghittehub
gitea=ghittee
jolla=yolla
jenux=jennux
lightnin=lighttnin
nginx=enginex
rhvoice=ahraychvoice
shit=shitt
sync=sink*
timezone=timezoan
vinux=vinnux
wench=wentch*
youngin=younggin*
+15 -13
View File
@@ -12,6 +12,19 @@ if ! [[ -x /usr/local/bin/configure-stormux ]]; then
return return
fi fi
firstBootSudoersFile="/etc/sudoers.d/zz-stormux-first-boot"
firstBootAutologinFile="/etc/systemd/system/getty@tty1.service.d/stormux-first-boot-autologin.conf"
firstBootAutologinDir="${firstBootAutologinFile%/*}"
cleanup_first_boot_access() {
trap - RETURN HUP INT TERM
if [[ -e "$firstBootSudoersFile" || -e "$firstBootAutologinFile" ]]; then
sudo -n /bin/sh -c "rm -f '$firstBootSudoersFile' '$firstBootAutologinFile'; rmdir --ignore-fail-on-non-empty '$firstBootAutologinDir'; systemctl daemon-reload" 2>/dev/null || true
fi
}
trap cleanup_first_boot_access RETURN HUP INT TERM
# Volume calibration FIRST # Volume calibration FIRST
echo "Setting up audio volume..." echo "Setting up audio volume..."
volume=50 volume=50
@@ -32,7 +45,7 @@ while [[ $volume -le 130 ]]; do
clear clear
pactl set-sink-volume @DEFAULT_SINK@ "${volume}%" 2>/dev/null pactl set-sink-volume @DEFAULT_SINK@ "${volume}%" 2>/dev/null
spd-say "If this is loud enough, press enter." spd-say "If this is loud enough, press enter."
if read -t4 ; then if read -r -t4 ; then
echo "Volume set to ${volume}%" echo "Volume set to ${volume}%"
break break
else else
@@ -47,17 +60,6 @@ if [[ -x /etc/audibleprompt.sh ]]; then
export sudoFlags=("-A") export sudoFlags=("-A")
fi fi
clear /usr/local/lib/stormux/select-speech-module
cat << "EOF"
Hello, and welcome to Stormux!
Let's get you set up. After you press enter, you will be prompted for the sudo password.
When that happens, type the word stormux and press enter.
You will not receive any speech feedback for this process.
That is completely normal, and speech will return after you have typed the password.
Once again, the password is stormux in all lower case letters.
Please press enter to continue.
EOF
read -r
sudo "${sudoFlags[@]}" configure-stormux sudo "${sudoFlags[@]}" configure-stormux
+25
View File
@@ -0,0 +1,25 @@
! Start in Unicode
XTerm*utf8: 1
UXTerm*utf8: 1
! Use white-on-black colors
XTerm.vt100.reverseVideo: true
UXTerm.vt100.reverseVideo: true
! XTerm already has 256 colors support
! We ask it to set the correct $TERM XTerm.termName: xterm-256color
UXTerm.termName: xterm-256color
! Start with maximized window
xterm*maximized: true
! Make Alt key behave like in other terminals
XTerm.vt100.altIsNotMeta: true
UXTerm.vt100.altIsNotMeta: true
XTerm.vt100.metaSendsEscape: true
UXTerm.vt100.metaSendsEscape: true
URxvt.perl-ext-common: "default, -searchable-scrollback"
URxvt.font: xft:terminus:size=16
*VT100.Translations: #override \
<Key>BackSpace: string(0x7F)\n\
<Key>Delete: string("\033[3~")\n\
<Key>Home: string("\033[1~")\n\
<Key>End: string("\033[4~")\n\
Ctrl Shift <Key>V: insert-selection(CLIPBOARD)
*ttyModes: erase ^?
@@ -0,0 +1,3 @@
[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin stormux --noclear %I $TERM
+184 -26
View File
@@ -7,19 +7,20 @@ if [[ -x /etc/audibleprompt.sh ]]; then
export sudoFlags=("-A") export sudoFlags=("-A")
fi fi
trap cleanup EXIT # shellcheck disable=SC2329
cleanup() { cleanup() {
popd &> /dev/null popd &> /dev/null || true
if ! [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then if ! [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then
echo "Initial setup is not complete." echo "Initial setup is not complete."
echo "To continue setup, please run:" echo "To continue setup, please run:"
echo "sudo configure-stormux" echo "sudo configure-stormux"
fi fi
} }
trap cleanup EXIT
if [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then if [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then
pushd /opt/configure-stormux pushd /opt/configure-stormux || exit 1
./configure-stormux.sh ./configure-stormux.sh
exit 0 exit 0
fi fi
@@ -27,73 +28,220 @@ fi
# Volume calibration is now handled in stormux_first_boot.sh # Volume calibration is now handled in stormux_first_boot.sh
export DIALOGOPTS='--insecure --no-lines --visit-items' export DIALOGOPTS='--insecure --no-lines --visit-items'
i38StartAtBoot=0
firstBootSudoersFile="/etc/sudoers.d/zz-stormux-first-boot"
firstBootAutologinFile="/etc/systemd/system/getty@tty1.service.d/stormux-first-boot-autologin.conf"
firstBootAutologinDir="${firstBootAutologinFile%/*}"
read_yes_no() {
local answer
while true; do
echo "$1"
echo "Press y for yes or n for no followed by enter."
read -r answer
answer="${answer::1}"
case "${answer,,}" in
y)
return 0
;;
n)
return 1
;;
esac
echo "Please answer y or n."
done
}
cleanup_first_boot_access() {
rm -f "$firstBootSudoersFile" "$firstBootAutologinFile"
rmdir --ignore-fail-on-non-empty "$firstBootAutologinDir"
systemctl daemon-reload
}
configure_physical_screen() {
sudo "${sudoFlags[@]}" mkdir -p /etc/X11/xorg.conf.d
sudo "${sudoFlags[@]}" tee /etc/X11/xorg.conf.d/10-screendriver.conf > /dev/null << 'EOF'
Section "OutputClass"
Identifier "vc4"
MatchDriver "vc4"
Driver "modesetting"
Option "PrimaryGPU" "true"
EndSection
EOF
}
configure_headless_screen() {
sudo "${sudoFlags[@]}" mkdir -p /etc/X11/xorg.conf.d
sudo "${sudoFlags[@]}" tee /etc/X11/xorg.conf.d/10-screendriver.conf > /dev/null << 'EOF'
Section "Monitor"
Identifier "dummy_monitor"
HorizSync 28.0-80.0
VertRefresh 48.0-75.0
Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118
EndSection
Section "Device"
Identifier "dummy_card"
Driver "dummy"
VideoRam 256000
Option "UseFBDev" "false"
EndSection
Section "Screen"
Identifier "dummy_screen"
Device "dummy_card"
Monitor "dummy_monitor"
SubSection "Display"
Depth 24
Modes "1920x1080"
EndSubSection
EndSection
Section "ServerLayout"
Identifier "dummy_layout"
Screen 0 "dummy_screen"
EndSection
EOF
}
configure_fenrir() {
local keyboardLayout="desktop" answer configPath tempPath serviceAction="start"
configPath="/etc/fenrirscreenreader/settings/settings.toml"
# A manual rerun must also apply the newly selected launch-time layout.
if systemctl is-active --quiet fenrirscreenreader.service; then
serviceAction="restart"
fi
# Reload the default engine selected before this script was started.
killall speech-dispatcher 2>/dev/null || true
while true; do
echo "Would you like to switch Fenrir to laptop layout? [y/N]"
spd-say -w "Would you like to switch Fenrir to laptop layout? Press y for yes or n for no, followed by Enter. Press Enter for desktop layout."
read -r answer || return 1
case "${answer,,}" in
y|yes) keyboardLayout="laptop"; break ;;
n|no|"") break ;;
esac
done
tempPath="$(mktemp "${configPath}.stormux.XXXXXX")" || return 1
if ! cp --preserve=mode,ownership "$configPath" "$tempPath" || ! awk -v layout="$keyboardLayout" '
/^[[:space:]]*\[/ { inKeyboard = ($0 ~ /^[[:space:]]*\[keyboard\][[:space:]]*(#.*)?$/) }
inKeyboard && /^[[:space:]]*layout[[:space:]]*=/ {
if (sub(/=[[:space:]]*("[^"]*"|\047[^\047]*\047)/, "= \"" layout "\"")) {
changed++
}
}
{ print }
END { if (changed != 1) exit 1 }
' "$configPath" > "$tempPath" || ! fenrir --config "$tempPath" --check-config; then
rm -f "$tempPath"
echo "Could not configure Fenrir. The original settings were preserved."
spd-say -w "Could not configure Fenrir. The original settings were preserved."
return 1
fi
if ! mv -f "$tempPath" "$configPath"; then
rm -f "$tempPath"
return 1
fi
if ! systemctl "$serviceAction" fenrirscreenreader.service; then
echo "Fenrir could not start. Check journalctl -u fenrirscreenreader.service."
spd-say -w "Fenrir could not start. Check the screen reader service log."
return 1
fi
}
set_timezone() { set_timezone() {
# Get the list of timezones # Get the list of timezones
mapfile -t regions < <(timedatectl --no-pager list-timezones | cut -d '/' -f1 | sort -u) mapfile -t regions < <(timedatectl --no-pager list-timezones | cut -d '/' -f1 | sort -u)
# Use the same text twice here and just hide the tag field. # Use the same text twice here and just hide the tag field.
# shellcheck disable=SC2046
region=$(dialog --backtitle "Please select your Region" \ region=$(dialog --backtitle "Please select your Region" \
--no-tags \ --no-tags \
--menu "Use up and down arrows or page-up and page-down to navigate the list, and press 'Enter' to make your selection." 0 0 0 \ --menu "Use up and down arrows or page-up and page-down to navigate the list, and press 'Enter' to make your selection." 0 0 0 \
$(for i in ${regions[@]} ; do echo "$i";echo "$i";done) --stdout) $(for i in "${regions[@]}" ; do echo "$i";echo "$i";done) --stdout)
mapfile -t cities < <(timedatectl --no-pager list-timezones | grep "$region" | cut -d '/' -f2 | sort -u) mapfile -t cities < <(timedatectl --no-pager list-timezones | grep "$region" | cut -d '/' -f2 | sort -u)
# Use the same text twice here and just hide the tag field. # Use the same text twice here and just hide the tag field.
# shellcheck disable=SC2046
city=$(dialog --backtitle "Please select a city near you" \ city=$(dialog --backtitle "Please select a city near you" \
--no-tags \ --no-tags \
--menu "Use up and down arrow or page-up and page-down to navigate the list." 0 0 10 \ --menu "Use up and down arrow or page-up and page-down to navigate the list." 0 0 10 \
$(for i in ${cities[@]} ; do echo "$i";echo "$i";done) --stdout) $(for i in "${cities[@]}" ; do echo "$i";echo "$i";done) --stdout)
# Set the timezone # Set the timezone
if [[ -f /etc/localtime ]]; then if [[ -f /etc/localtime ]]; then
rm /etc/localtime rm /etc/localtime
fi fi
ln -sf /usr/share/zoneinfo/${region}/${city} /etc/localtime ln -sf /usr/share/zoneinfo/"${region}"/"${city}" /etc/localtime
timedatectl set-ntp true timedatectl set-ntp true
} }
# Offer to switch fenrir layout. configure_fenrir || exit 1
echo "Would you like to switch Fenrir to laptop layout?" # Keep console speech available on later boots unless the I38 choice disables it.
echo "Press y for yes or n for no followed by enter." systemctl --quiet enable fenrirscreenreader.service || exit 1
read -r continue
continue="${continue::1}"
if [[ "${continue,}" == "y" ]];then
sed -i 's/=desktop/=laptop/' /etc/fenrirscreenreader/settings/settings.conf
clear clear
systemctl restart fenrirscreenreader.service echo "Hello, and welcome to Stormux!"
echo "Let's get you set up. Please press enter to continue."
read -r
if command -v i3 > /dev/null 2>&1 && systemctl list-unit-files nodm.service > /dev/null 2>&1; then
if read_yes_no "Will this Pi be connected to a physical screen?"; then
configure_physical_screen
else
configure_headless_screen
fi
if read_yes_no "Should I38 start at boot?"; then
sudo "${sudoFlags[@]}" systemctl --quiet enable nodm.service
i38StartAtBoot=1
if read_yes_no "Should Fenrir run in the console at boot?"; then
sudo "${sudoFlags[@]}" systemctl --quiet enable fenrirscreenreader.service
else
sudo "${sudoFlags[@]}" systemctl --quiet disable fenrirscreenreader.service
fi
else
sudo "${sudoFlags[@]}" systemctl --quiet disable nodm.service
sudo "${sudoFlags[@]}" systemctl --quiet enable fenrirscreenreader.service
fi
fi fi
# Check for possible resize # Check for possible resize
diskSource="$(df --output='source' / | tail -1)" diskSource="$(df --output='source' / | tail -1)"
diskSize="$(df -h --output='size' / | tail -1 | tr -cd '[:digit:].')" diskSize="$(df -h --output='size' / | tail -1 | tr -cd '[:digit:].')"
diskSize=${diskSize%.*} diskSize=${diskSize%.*}
if [[ $diskSize -le 7 ]]; then resizeThreshold=9
echo "$diskSource is only $diskSize gigs, which means it probably needs to be resized. Would you like to do this now?" if [[ $diskSize -le $resizeThreshold ]]; then
echo "Press y for yes or n for no followed by enter." if read_yes_no "$diskSource is only $diskSize gigs, which means it probably needs to be resized. Would you like to do this now?"; then
read -r continue resizeLog="/tmp/stormux-resize.log"
continue="${continue::1}"
if [[ "${continue,}" == "y" ]];then
# Extract base device name (handles mmcblk0p2, nvme0n1p2, sda2, etc.) # Extract base device name (handles mmcblk0p2, nvme0n1p2, sda2, etc.)
if [[ "$diskSource" =~ (.*[0-9]+)p[0-9]+$ ]]; then if [[ "$diskSource" =~ (.*[0-9]+)p[0-9]+$ ]]; then
# Handle mmcblk0p2, nvme0n1p2 style # Handle mmcblk0p2, nvme0n1p2 style
diskDevice="${BASH_REMATCH[1]}" diskDevice="${BASH_REMATCH[1]}"
else else
# Handle sda2, sdb3 style # Handle sda2, sdb3 style
# shellcheck disable=SC2001
diskDevice="$(echo "$diskSource" | sed 's/[0-9]*$//')" diskDevice="$(echo "$diskSource" | sed 's/[0-9]*$//')"
fi fi
echo "Yes" | sudo "${sudoFlags[@]}" parted ---pretend-input-tty "$diskDevice" resizepart 2 100% echo "Resizing the filesystem. This may take a few minutes."
sudo "${sudoFlags[@]}" resize2fs -f "$diskSource" if { echo "Yes" | sudo "${sudoFlags[@]}" parted ---pretend-input-tty "$diskDevice" resizepart 2 100%; } > "$resizeLog" 2>&1 \
&& { sudo "${sudoFlags[@]}" resize2fs -f "$diskSource"; } >> "$resizeLog" 2>&1; then
echo "Resize complete."
else
echo "Resize failed. Details are in $resizeLog."
fi
fi fi
fi fi
if ! ping -c1 stormux.org &> /dev/null ; then if ! ping -c1 stormux.org &> /dev/null ; then
echo "No internet connection detected. Press enter to open NetworkManager." echo "No internet connection detected. Press enter to open NetworkManager."
read -r continue read -r _
echo "setting set focus#highlight=True" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-deamon.sock echo "setting set reading#mode=highlight" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-daemon.sock
nmtui-connect nmtui-connect
echo "setting set focus#highlight=False" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-deamon.sock echo "setting set reading#mode=cursor" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-daemon.sock
fi fi
# Check for internet connectivity # Check for internet connectivity
if ping -qc1 -W 1 stormux.org &> /dev/null; then if ping -qc1 -W 1 stormux.org &> /dev/null; then
@@ -108,7 +256,7 @@ if ping -qc1 -W 1 stormux.org &> /dev/null; then
read -rp "Would you like the time to sync as soon as the Pi connects to the internet? " answer read -rp "Would you like the time to sync as soon as the Pi connects to the internet? " answer
answer="${answer:0:1}" answer="${answer:0:1}"
if [[ "${answer,,}" == "y" ]]; then if [[ "${answer,,}" == "y" ]]; then
systemctl enable time_sync_at_boot.service systemctl --quiet enable time_sync_at_boot.service
else else
echo "Time sync at boot skipped." echo "Time sync at boot skipped."
echo "If you change your mind later, simply type:" echo "If you change your mind later, simply type:"
@@ -137,5 +285,15 @@ echo "or you may configure your system manually."
echo echo
echo "Thank you for choosing Stormux." echo "Thank you for choosing Stormux."
echo
read -rp "Press enter to continue."
cleanup_first_boot_access
if [[ $i38StartAtBoot -eq 1 ]]; then
echo
echo "Starting I38..."
sudo "${sudoFlags[@]}" systemctl --quiet start nodm.service
fi
exit 0 exit 0
-582
View File
@@ -1,582 +0,0 @@
#!/usr/bin/env python3
import os
import re
import secrets
import signal
import string
import subprocess
import sys
import tempfile
import time
import pwd
import threading
stormuxAdmin = ("storm",)
ircServer = "irc.stormux.org"
ircPort = 6667
ircChannel = "#stormux"
remoteHost = "billysballoons.com"
sasUser = "sas"
pingIntervalSeconds = 180
pingCount = 5
maxWormholeFailures = 3
sudoKeepaliveThread = None
sudoKeepaliveStop = threading.Event()
def speak_message(message):
try:
subprocess.run(["spd-say", message], check=False)
except FileNotFoundError:
print(message, flush=True)
def say_or_print(message, useSpeech):
if useSpeech:
speak_message(message)
else:
print(message, flush=True)
def run_command(command, inputText=None, check=False, env=None):
return subprocess.run(
command,
input=inputText,
text=True,
capture_output=True,
check=check,
env=env,
)
def ensure_sudo(useSpeech):
if os.geteuid() == 0:
return True
if useSpeech:
speak_message("Sudo password required. Please enter your password now.")
result = run_command(["sudo", "-v"])
if result.returncode == 0:
start_sudo_keepalive()
return True
return False
def start_sudo_keepalive():
global sudoKeepaliveThread
if sudoKeepaliveThread and sudoKeepaliveThread.is_alive():
return
def keepalive_loop():
while not sudoKeepaliveStop.wait(240):
run_command(["sudo", "-n", "-v"])
sudoKeepaliveThread = threading.Thread(target=keepalive_loop, daemon=True)
sudoKeepaliveThread.start()
def run_privileged(command, useSpeech, inputText=None, check=True):
if os.geteuid() == 0:
fullCommand = command
else:
if not ensure_sudo(useSpeech):
raise RuntimeError("sudo authentication failed")
fullCommand = ["sudo"] + command
return run_command(fullCommand, inputText=inputText, check=check)
def run_as_user(userName, command, useSpeech, check=True):
if os.geteuid() == 0:
fullCommand = ["sudo", "-u", userName, "-H"] + command
else:
if not ensure_sudo(useSpeech):
raise RuntimeError("sudo authentication failed")
fullCommand = ["sudo", "-u", userName, "-H"] + command
return run_command(fullCommand, check=check)
def user_exists(userName):
result = run_command(["getent", "passwd", userName])
return result.returncode == 0
def ensure_wheel(userName, useSpeech):
result = run_command(["id", "-nG", userName])
groups = result.stdout.strip().split()
if "wheel" not in groups:
run_privileged(["usermod", "-a", "-G", "wheel", userName], useSpeech)
def generate_password():
allowedChars = string.ascii_letters + string.digits
length = secrets.randbelow(5) + 6
return "".join(secrets.choice(allowedChars) for _ in range(length))
def get_user_home(userName):
return pwd.getpwnam(userName).pw_dir
def set_password(userName, password, useSpeech):
run_privileged(["chpasswd"], useSpeech, inputText=f"{userName}:{password}\n")
def generate_ssh_key(userName, useSpeech):
userHome = get_user_home(userName)
sshDir = os.path.join(userHome, ".ssh")
privateKeyPath = os.path.join(sshDir, "id_ed25519")
publicKeyPath = f"{privateKeyPath}.pub"
run_privileged(["mkdir", "-p", sshDir], useSpeech)
run_privileged(["chown", f"{userName}:{userName}", sshDir], useSpeech)
run_privileged(["chmod", "700", sshDir], useSpeech)
for entry in list_subdirs(sshDir):
if os.path.isfile(entry) or os.path.islink(entry):
run_privileged(["rm", "-f", entry], useSpeech, check=False)
run_as_user(
userName,
["ssh-keygen", "-t", "ed25519", "-N", "", "-f", privateKeyPath],
useSpeech,
)
run_privileged(["chmod", "600", privateKeyPath], useSpeech)
run_privileged(["chmod", "644", publicKeyPath], useSpeech)
run_privileged(["chown", f"{userName}:{userName}", privateKeyPath, publicKeyPath], useSpeech)
return privateKeyPath, publicKeyPath
def path_exists_for_user(path, userName, useSpeech):
result = run_as_user(userName, ["stat", path], useSpeech, check=False)
return result.returncode == 0
def extract_message_text(line):
if "> " in line:
return line.split("> ", 1)[1].strip()
if ": " in line:
return line.split(": ", 1)[1].strip()
return line.strip()
def parse_sender(line):
match = re.search(r"<([^>]+)>", line)
if match:
return match.group(1)
return None
def find_wormhole_code(message):
lowered = message.strip().lower()
if lowered in ("yes", "accept"):
return None
match = re.search(r"\b\d+-[A-Za-z0-9-]+\b", message)
if match:
return match.group(0)
return None
class IrcSession:
def __init__(self, server, port, nick, channel, baseDir):
self.server = server
self.port = port
self.nick = nick
self.channel = channel
self.baseDir = baseDir
self.serverDir = None
self.serverInPath = None
self.channelInPath = None
self.iiProcess = None
self.pmOffsets = {}
def start(self):
if not shutil_which("ii"):
raise RuntimeError("ii is not installed")
supportsI = ii_supports_i()
processEnv = os.environ.copy()
iiCommand = ["ii", "-s", self.server, "-p", str(self.port), "-n", self.nick]
if supportsI:
iiCommand += ["-i", self.baseDir]
else:
processEnv["HOME"] = self.baseDir
self.iiProcess = subprocess.Popen(
iiCommand,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
env=processEnv,
)
self.serverDir = self.wait_for_server_dir()
self.serverInPath = os.path.join(self.serverDir, "in")
def stop(self):
if self.channelInPath and os.path.exists(self.channelInPath):
try:
self.write_line(self.channelInPath, f"/part {self.channel}")
except OSError:
pass
if self.serverInPath and os.path.exists(self.serverInPath):
try:
self.write_line(self.serverInPath, "/quit")
except OSError:
pass
if self.iiProcess and self.iiProcess.poll() is None:
self.iiProcess.terminate()
try:
self.iiProcess.wait(timeout=5)
except subprocess.TimeoutExpired:
self.iiProcess.kill()
def join_channel(self):
joinMessage = f"/join {self.channel}"
channelDir = os.path.join(self.serverDir, self.channel)
channelAltDir = os.path.join(self.serverDir, self.channel.lstrip("#"))
startTime = time.monotonic()
nextJoinTime = startTime
while time.monotonic() - startTime < 60:
if time.monotonic() >= nextJoinTime:
self.write_line(self.serverInPath, joinMessage)
nextJoinTime = time.monotonic() + 5
for candidate in (channelDir, channelAltDir):
inPath = os.path.join(candidate, "in")
if os.path.exists(inPath):
self.channelInPath = inPath
return
time.sleep(0.5)
self.channelInPath = None
def send_channel_message(self, message):
if not self.channelInPath:
self.refresh_channel_in_path()
if self.channelInPath and os.path.exists(self.channelInPath):
self.write_line(self.channelInPath, message)
else:
self.write_line(self.serverInPath, f"/msg {self.channel} {message}")
def send_private_message(self, nick, message):
nickDir = os.path.join(self.serverDir, nick)
inPath = os.path.join(nickDir, "in")
if os.path.exists(inPath):
self.write_line(inPath, message)
else:
self.write_line(self.serverInPath, f"/msg {nick} {message}")
def get_private_messages(self, allowedUsers):
messages = []
for nick in allowedUsers:
nickDir = os.path.join(self.serverDir, nick)
outPath = os.path.join(nickDir, "out")
if not os.path.exists(outPath):
continue
lastPos = self.pmOffsets.get(outPath, 0)
with open(outPath, "r", encoding="utf-8", errors="ignore") as fileHandle:
fileHandle.seek(lastPos)
for line in fileHandle:
sender = parse_sender(line)
if sender and sender == self.nick:
continue
if sender and sender != nick:
continue
messageText = extract_message_text(line)
if messageText:
messages.append((nick, messageText))
self.pmOffsets[outPath] = fileHandle.tell()
return messages
def refresh_channel_in_path(self):
channelDir = os.path.join(self.serverDir, self.channel)
channelAltDir = os.path.join(self.serverDir, self.channel.lstrip("#"))
for candidate in (channelDir, channelAltDir):
inPath = os.path.join(candidate, "in")
if os.path.exists(inPath):
self.channelInPath = inPath
return
def wait_for_server_dir(self):
for _ in range(120):
for rootDir in [self.baseDir] + list_subdirs(self.baseDir):
if not os.path.isdir(rootDir):
continue
for entry in os.listdir(rootDir):
path = os.path.join(rootDir, entry)
if os.path.isdir(path) and self.server in entry:
inPath = os.path.join(path, "in")
if os.path.exists(inPath):
return path
time.sleep(0.5)
raise RuntimeError("ii server directory not found")
@staticmethod
def write_line(path, message):
with open(path, "w", encoding="utf-8", errors="ignore") as fileHandle:
fileHandle.write(message + "\n")
fileHandle.flush()
def ii_supports_i():
result = run_command(["ii", "-h"])
output = (result.stdout or "") + (result.stderr or "")
return "-i" in output
def list_subdirs(path):
try:
return [os.path.join(path, entry) for entry in os.listdir(path)]
except OSError:
return []
def shutil_which(command):
for path in os.environ.get("PATH", "").split(os.pathsep):
candidate = os.path.join(path, command)
if os.path.isfile(candidate) and os.access(candidate, os.X_OK):
return candidate
return None
def build_nick():
baseUser = os.environ.get("SUDO_USER") or os.environ.get("USER") or "sas"
return f"{baseUser}-{int(time.time())}"
def main():
say_or_print("Checking accessibility. Is your screen reader working? (y/n)", True)
answer = input().strip().lower()
useSpeech = answer in ("n", "no")
shouldRemoveUser = False
cleanupDone = False
tempDir = tempfile.mkdtemp(prefix="sas-ii-")
ircSession = None
sshProcess = None
def cleanup(exitMessage=None):
nonlocal cleanupDone
if cleanupDone:
return
cleanupDone = True
nonlocal sshProcess
if exitMessage:
say_or_print(exitMessage, useSpeech)
if sshProcess and sshProcess.poll() is None:
sshProcess.terminate()
try:
sshProcess.wait(timeout=5)
except subprocess.TimeoutExpired:
sshProcess.kill()
if ircSession:
ircSession.stop()
if shouldRemoveUser:
try:
run_privileged(["pkill", "-u", sasUser], useSpeech, check=False)
time.sleep(1)
result = run_privileged(["userdel", "-r", sasUser], useSpeech, check=False)
run_privileged(["rm", "-rf", f"/home/{sasUser}"], useSpeech, check=False)
if result.returncode != 0 and user_exists(sasUser):
say_or_print(
"Cleanup warning: failed to remove sas user. Please remove it manually.",
useSpeech,
)
except Exception:
pass
sudoKeepaliveStop.set()
if sudoKeepaliveThread:
sudoKeepaliveThread.join(timeout=2)
try:
remove_tree(tempDir)
except Exception:
pass
def handle_signal(signum, frame):
cleanup("Interrupted. Cleaning up.")
sys.exit(1)
signal.signal(signal.SIGINT, handle_signal)
signal.signal(signal.SIGTERM, handle_signal)
try:
if not user_exists(sasUser):
run_privileged(
["useradd", "-m", "-d", f"/home/{sasUser}", "-s", "/bin/bash", "-G", "wheel", sasUser],
useSpeech,
)
shouldRemoveUser = True
else:
say_or_print(
"User 'sas' exists. Remove and recreate it? This will delete /home/sas. (y/n)",
useSpeech,
)
response = input().strip().lower()
if response not in ("y", "yes"):
cleanup("The sas user is unavailable. Remove it manually and try again.")
return 1
run_privileged(["pkill", "-u", sasUser], useSpeech, check=False)
run_privileged(["userdel", "-r", sasUser], useSpeech, check=False)
run_privileged(["rm", "-rf", f"/home/{sasUser}"], useSpeech, check=False)
run_privileged(
["useradd", "-m", "-d", f"/home/{sasUser}", "-s", "/bin/bash", "-G", "wheel", sasUser],
useSpeech,
)
shouldRemoveUser = True
ensure_wheel(sasUser, useSpeech)
password = generate_password()
set_password(sasUser, password, useSpeech)
privateKeyPath, publicKeyPath = generate_ssh_key(sasUser, useSpeech)
sasHome = get_user_home(sasUser)
knownHostsPath = os.path.join(sasHome, ".ssh", "known_hosts_sas")
run_privileged(["touch", knownHostsPath], useSpeech)
run_privileged(["chmod", "600", knownHostsPath], useSpeech)
run_privileged(["chown", f"{sasUser}:{sasUser}", knownHostsPath], useSpeech)
nick = build_nick()
ircSession = IrcSession(ircServer, ircPort, nick, ircChannel, tempDir)
ircSession.start()
ircSession.join_channel()
say_or_print("Waiting for assistance on IRC.", useSpeech)
startTime = time.monotonic()
nextPingTime = startTime
pingsSent = 0
confirmedAdmin = None
while time.monotonic() - startTime < pingIntervalSeconds * pingCount:
now = time.monotonic()
if pingsSent < pingCount and now >= nextPingTime:
ircSession.send_channel_message(f"{nick} is requesting assistance.")
pingsSent += 1
nextPingTime = startTime + (pingsSent * pingIntervalSeconds)
for adminNick, messageText in ircSession.get_private_messages(stormuxAdmin):
if messageText.strip().lower() in ("yes", "accept"):
confirmedAdmin = adminNick
break
if confirmedAdmin:
break
time.sleep(1)
if not confirmedAdmin:
cleanup("No one was available to help, please try again later.")
return 1
ircSession.send_private_message(
confirmedAdmin,
f'password: "{password}" please send wormhole ssh invite code',
)
failures = 0
while failures < maxWormholeFailures:
inviteCode = None
while inviteCode is None:
for adminNick, messageText in ircSession.get_private_messages(stormuxAdmin):
inviteCode = find_wormhole_code(messageText)
if inviteCode:
break
if inviteCode:
break
time.sleep(1)
if not path_exists_for_user(publicKeyPath, sasUser, useSpeech):
raise RuntimeError(f"Public key missing: {publicKeyPath}")
wormholeCommand = [
"wormhole",
"ssh",
"accept",
"--yes",
inviteCode,
]
result = run_as_user(sasUser, wormholeCommand, useSpeech, check=False)
if result.returncode == 0:
say_or_print("Wormhole key transfer succeeded.", useSpeech)
break
failures += 1
errorTextFull = (result.stderr or result.stdout or "").strip()
if errorTextFull and not useSpeech:
print("Wormhole ssh accept error:", flush=True)
print(errorTextFull, flush=True)
errorText = errorTextFull
if errorText:
errorText = " ".join(errorText.split())
if len(errorText) > 400:
errorText = errorText[:400] + "..."
ircSession.send_private_message(
confirmedAdmin,
f"Wormhole ssh accept failed: {errorText}",
)
ircSession.send_private_message(
confirmedAdmin,
"Wormhole ssh accept failed. Please send a new invite code.",
)
if failures >= maxWormholeFailures:
cleanup("Wormhole failed too many times. Exiting.")
return 1
say_or_print("Starting reverse SSH tunnel. Press Ctrl+C to stop.", useSpeech)
sshCommand = [
"ssh",
"-N",
"-R",
"localhost:2232:localhost:22",
"-o",
"ExitOnForwardFailure=yes",
"-o",
"BatchMode=yes",
"-o",
"ServerAliveInterval=30",
"-o",
"ServerAliveCountMax=3",
"-o",
"StrictHostKeyChecking=accept-new",
"-o",
f"UserKnownHostsFile={knownHostsPath}",
"-i",
privateKeyPath,
f"{sasUser}@{remoteHost}",
]
sshCommand = ["sudo", "-u", sasUser, "-H"] + sshCommand
sshProcess = subprocess.Popen(sshCommand)
sshProcess.wait()
except Exception as exc:
cleanup(f"Error: {exc}")
return 1
finally:
cleanup()
return 0
def remove_tree(path):
if not os.path.exists(path):
return
for rootDir, dirNames, fileNames in os.walk(path, topdown=False):
for fileName in fileNames:
try:
os.unlink(os.path.join(rootDir, fileName))
except OSError:
pass
for dirName in dirNames:
try:
os.rmdir(os.path.join(rootDir, dirName))
except OSError:
pass
try:
os.rmdir(path)
except OSError:
pass
if __name__ == "__main__":
sys.exit(main())
+334
View File
@@ -0,0 +1,334 @@
#!/usr/bin/env bash
set -u
speechConfig="${STORMUX_SPEECH_CONFIG:-/etc/speech-dispatcher/speechd.conf}"
selectionFile=""
spdSayCommand="${STORMUX_SPD_SAY:-spd-say}"
systemctlCommand="${STORMUX_SYSTEMCTL:-systemctl}"
socatCommand="${STORMUX_SOCAT:-socat}"
fenrirSocket="${STORMUX_FENRIR_SOCKET:-/tmp/fenrirscreenreader-daemon.sock}"
scriptPath="$(readlink -f "$0")"
runtimeDir="${STORMUX_RUNTIME_DIR:-/run/stormux}"
fenrirSpeechMuted=false
is_safe_module() {
[[ "$1" =~ ^[A-Za-z0-9][A-Za-z0-9_.-]*$ ]]
}
apply_module() {
local moduleName="$1"
local configPath="$2"
local backupPath="$3"
local tempPath
is_safe_module "$moduleName" || return 1
[[ -f "$configPath" ]] || return 1
mkdir -p "${backupPath%/*}" || return 1
cp --preserve=mode,ownership,timestamps "$configPath" "$backupPath" || return 1
tempPath="$(mktemp "${configPath}.stormux.XXXXXX")" || return 1
if ! awk -v moduleName="$moduleName" '
BEGIN { wroteDefault = 0 }
/^[[:space:]]*#?[[:space:]]*DefaultModule[[:space:]]+/ {
if (!wroteDefault) {
print "DefaultModule " moduleName
wroteDefault = 1
}
next
}
{ print }
END {
if (!wroteDefault) {
print ""
print "DefaultModule " moduleName
}
}
' "$configPath" > "$tempPath"; then
rm -f "$tempPath"
return 1
fi
chown --reference="$configPath" "$tempPath" || {
rm -f "$tempPath"
return 1
}
chmod --reference="$configPath" "$tempPath" || {
rm -f "$tempPath"
return 1
}
mv -f "$tempPath" "$configPath"
}
restore_config() {
local configPath="$1"
local backupPath="$2"
local tempPath
[[ -f "$backupPath" ]] || return 1
tempPath="$(mktemp "${configPath}.stormux.XXXXXX")" || return 1
if ! cp --preserve=mode,ownership,timestamps "$backupPath" "$tempPath"; then
rm -f "$tempPath"
return 1
fi
mv -f "$tempPath" "$configPath" || return 1
rm -f "$backupPath"
}
write_selection() {
local moduleName="$1"
local targetPath="$2"
local tempPath
is_safe_module "$moduleName" || return 1
mkdir -p "${targetPath%/*}" || return 1
tempPath="$(mktemp "${targetPath}.stormux.XXXXXX")" || return 1
printf '%s\n' "$moduleName" > "$tempPath" || {
rm -f "$tempPath"
return 1
}
chmod 644 "$tempPath" || {
rm -f "$tempPath"
return 1
}
mv -f "$tempPath" "$targetPath"
}
case "${1:-}" in
--apply-module)
[[ $# -eq 4 ]] || exit 2
apply_module "$2" "$3" "$4"
exit $?
;;
--restore-config)
[[ $# -eq 3 ]] || exit 2
restore_config "$2" "$3"
exit $?
;;
--write-selection)
[[ $# -eq 3 ]] || exit 2
write_selection "$2" "$3"
exit $?
;;
esac
while [[ $# -gt 0 ]]; do
case "$1" in
--config)
[[ $# -ge 2 ]] || exit 2
speechConfig="$2"
shift 2
;;
--selection-file)
[[ $# -ge 2 ]] || exit 2
selectionFile="$2"
shift 2
;;
*)
printf 'Unknown option: %s\n' "$1" >&2
exit 2
;;
esac
done
sudoCommand=(sudo)
if [[ -n "${SUDO_ASKPASS:-}" ]]; then
sudoCommand+=(-A)
fi
announce_failure() {
local previousModule="$1"
local message="Speech engine selection failed. Your previous speech engine is still selected."
"$spdSayCommand" -C >/dev/null 2>&1 || true
if is_safe_module "$previousModule"; then
"$spdSayCommand" -o "$previousModule" "$message" >/dev/null 2>&1 || \
"$spdSayCommand" "$message" >/dev/null 2>&1 || true
else
"$spdSayCommand" "$message" >/dev/null 2>&1 || true
fi
printf '%s\n' "$message" >&2
}
set_fenrir_speech() {
local enabled="$1"
printf 'setting set speech#enabled=%s\n' "$enabled" | \
"$socatCommand" - UNIX-CLIENT:"$fenrirSocket" >/dev/null 2>&1
}
mute_fenrir_speech() {
if "$systemctlCommand" is-active --quiet fenrirscreenreader.service 2>/dev/null && \
set_fenrir_speech False; then
fenrirSpeechMuted=true
fi
}
restore_fenrir_speech() {
if [[ "$fenrirSpeechMuted" == true ]]; then
set_fenrir_speech True || true
fenrirSpeechMuted=false
fi
}
trap restore_fenrir_speech EXIT
trap 'exit 130' HUP INT TERM
discover_modules() {
local output line candidate
local skippedHeading=false
if ! output="$("$spdSayCommand" -O 2>/dev/null)"; then
return 1
fi
modules=()
while IFS= read -r line; do
candidate="${line%$'\r'}"
candidate="${candidate#"${candidate%%[![:space:]]*}"}"
candidate="${candidate%"${candidate##*[![:space:]]}"}"
[[ -n "$candidate" ]] || continue
if [[ "$skippedHeading" == false ]]; then
skippedHeading=true
continue
fi
is_safe_module "$candidate" || continue
modules+=("$candidate")
done <<< "$output"
[[ ${#modules[@]} -gt 0 ]]
}
configured_module() {
local configured=""
if [[ -r "$speechConfig" ]]; then
configured="$(awk '$1 == "DefaultModule" { print $2; exit }' "$speechConfig")"
fi
if ! is_safe_module "$configured"; then
configured="rhvoice"
fi
printf '%s\n' "$configured"
}
module_index() {
local wanted="$1"
local index
for index in "${!modules[@]}"; do
if [[ "${modules[$index]}" == "$wanted" ]]; then
printf '%s\n' "$index"
return 0
fi
done
return 1
}
draw_menu() {
local index
printf '\033[H\033[2J'
printf 'Select the default speech engine. Use Up and Down, Enter to select, or Escape to keep the current engine.\n\n'
for index in "${!modules[@]}"; do
if [[ $index -eq $selectedIndex ]]; then
printf '> %s\n' "${modules[$index]}"
else
printf ' %s\n' "${modules[$index]}"
fi
done
}
read_menu_key() {
local first rest=""
IFS= read -rsn1 first || return 1
if [[ -z "$first" ]]; then
printf 'enter\n'
return 0
fi
if [[ "$first" == $'\033' ]]; then
IFS= read -rsn2 -t 0.1 rest || true
case "$rest" in
'[A') printf 'up\n' ;;
'[B') printf 'down\n' ;;
'') printf 'escape\n' ;;
*) printf 'other\n' ;;
esac
return 0
fi
printf 'other\n'
}
declare -a modules=()
previousModule="$(configured_module)"
mute_fenrir_speech
if ! discover_modules; then
announce_failure "$previousModule"
exit 0
fi
if ! selectedIndex="$(module_index "$previousModule")"; then
if selectedIndex="$(module_index rhvoice)"; then
:
else
selectedIndex=0
fi
fi
draw_menu
"$spdSayCommand" "Use up and down arrows to select the default voice for this computer. ${modules[$selectedIndex]} is highlighted. Press Enter to select, or Escape to keep the current voice." >/dev/null 2>&1 || true
while true; do
if ! keyName="$(read_menu_key)"; then
announce_failure "$previousModule"
exit 0
fi
case "$keyName" in
up)
selectedIndex=$(( (selectedIndex - 1 + ${#modules[@]}) % ${#modules[@]} ))
;;
down)
selectedIndex=$(( (selectedIndex + 1) % ${#modules[@]} ))
;;
enter)
break
;;
escape)
"$spdSayCommand" -C >/dev/null 2>&1 || true
"$spdSayCommand" -o "$previousModule" "Keeping ${previousModule} as the default speech engine." >/dev/null 2>&1 || true
exit 0
;;
*)
continue
;;
esac
draw_menu
moduleName="${modules[$selectedIndex]}"
"$spdSayCommand" -C >/dev/null 2>&1 || true
"$spdSayCommand" -o "$moduleName" "This is ${moduleName}. If selected, I will be your default text-to-speech voice." >/dev/null 2>&1 || true
done
selectedModule="${modules[$selectedIndex]}"
backupFile="${runtimeDir}/speechd.conf.$$.backup"
"$spdSayCommand" -C >/dev/null 2>&1 || true
if ! "${sudoCommand[@]}" "$scriptPath" --apply-module "$selectedModule" "$speechConfig" "$backupFile"; then
"${sudoCommand[@]}" "$scriptPath" --restore-config "$speechConfig" "$backupFile" >/dev/null 2>&1 || true
announce_failure "$previousModule"
exit 0
fi
if [[ -n "$selectionFile" ]]; then
if ! "${sudoCommand[@]}" "$scriptPath" --write-selection "$selectedModule" "$selectionFile"; then
"${sudoCommand[@]}" "$scriptPath" --restore-config "$speechConfig" "$backupFile" >/dev/null 2>&1 || true
announce_failure "$previousModule"
exit 0
fi
fi
rm -f "$backupFile" 2>/dev/null || "${sudoCommand[@]}" rm -f "$backupFile" 2>/dev/null || true
"$spdSayCommand" -o "$selectedModule" "${selectedModule} is now the default speech engine." >/dev/null 2>&1 || true
printf 'Default speech engine set to %s.\n' "$selectedModule"
@@ -4,7 +4,7 @@
# Monitors SSH logins and announces them via Fenrir's speech system # Monitors SSH logins and announces them via Fenrir's speech system
# Configuration # Configuration
fenrirSocket="/tmp/fenrirscreenreader-deamon.sock" fenrirSocket="/tmp/fenrirscreenreader-daemon.sock"
logFile="/var/log/auth.log" logFile="/var/log/auth.log"
stateFile="/tmp/fenrir-ssh-monitor.state" stateFile="/tmp/fenrir-ssh-monitor.state"
checkInterval=2 # seconds between checks checkInterval=2 # seconds between checks
+26
View File
@@ -0,0 +1,26 @@
# Ship I38 By Default On Pi Stormux
## Planned
- [ ] Build and boot-test a Pi image with the new GUI defaults.
- [ ] Port the proven Pi behavior to the x86_64 installer/profile after the Pi image is verified.
## In Progress
- No active implementation items.
## Done
- [x] Bump the default Pi image size from 6 GB to 8 GB.
- [x] Raise the first-boot resize prompt threshold to 9 GB.
- [x] Configure Speech Dispatcher during image creation when `spd-conf` is available.
- [x] Add I38, Cthulhu, XLibre, nodm, Speech Dispatcher, and startx support to the Pi image.
- [x] Generate the default user's I38 config during image creation with `i38.sh -D`.
- [x] Ask during first boot whether I38 should start at boot, and whether Fenrir should stay enabled for the console.
- [x] Convert the external `configure-stormux` I38 action into a removal/purge action.
## Deferred x86_64 Follow-up
- [ ] Replace interactive I38 setup in the x86_64 installer with the same non-interactive `i38.sh -D` path where appropriate.
- [ ] Review x86_64 package lists against the Pi package set after the Pi build is proven.
- [ ] Re-check nodm and Fenrir service policy for installed x86_64 systems.
+141
View File
@@ -0,0 +1,141 @@
#!/usr/bin/env bash
set -euo pipefail
readonly repoName="stormux"
readonly repoKeyUrl="https://packages.stormux.org/stormux_repo.pub"
readonly repoKeyId="52ADA49000F1FF0456F8AEEFB4CDE1CD56EF8E82"
readonly pacmanConf="${STORMUX_PACMAN_CONF:-/etc/pacman.conf}"
readonly osRelease="${STORMUX_OS_RELEASE:-/etc/os-release}"
readonly effectiveUid="${STORMUX_TEST_EUID:-${EUID}}"
keyFile=""
cleanup() {
if [[ -n "$keyFile" && -f "$keyFile" ]]; then
rm -f "$keyFile"
fi
}
die() {
printf 'Error: %s\n' "$1" >&2
exit 1
}
require_root() {
[[ "$effectiveUid" == "0" ]] || die "This script must be run as root."
}
require_command() {
local commandName="$1"
command -v "$commandName" >/dev/null 2>&1 || die "Required command not found: ${commandName}"
}
is_arch_based_system() {
local osId=""
local osIdLike=""
[[ -f "$osRelease" ]] || return 1
while IFS='=' read -r keyName keyValue; do
keyValue="${keyValue%\"}"
keyValue="${keyValue#\"}"
case "$keyName" in
ID)
osId="$keyValue"
;;
ID_LIKE)
osIdLike="$keyValue"
;;
esac
done < "$osRelease"
[[ "$osId" == "arch" || "$osId" == "archarm" || " ${osIdLike} " == *" arch "* ]]
}
check_prerequisites() {
require_root
require_command curl
require_command pacman
require_command pacman-key
is_arch_based_system || die "This script supports Arch-based pacman systems only."
[[ -f "$pacmanConf" ]] || die "pacman.conf not found: ${pacmanConf}"
}
download_and_trust_key() {
keyFile="$(mktemp)"
trap cleanup EXIT
printf 'Downloading Stormux repository key...\n'
curl -fsSL "$repoKeyUrl" > "$keyFile"
printf 'Adding Stormux repository key to pacman keyring...\n'
pacman-key --add "$keyFile"
printf 'Locally signing Stormux repository key...\n'
pacman-key --lsign-key "$repoKeyId"
}
update_pacman_conf() {
local tempConf
tempConf="$(mktemp)"
awk -v repoName="$repoName" '
function print_repo_block() {
print "[" repoName "]"
print "SigLevel = Required DatabaseOptional"
print "Server = https://packages.stormux.org/$arch"
}
/^\[stormux\][[:space:]]*$/ {
inStormux = 1
next
}
inStormux && /^\[[^]]+\][[:space:]]*$/ {
inStormux = 0
}
inStormux {
next
}
!inserted && /^\[core\][[:space:]]*$/ {
print_repo_block()
print ""
inserted = 1
}
{
print
}
END {
if (!inserted) {
print ""
print_repo_block()
}
}
' "$pacmanConf" > "$tempConf"
cat "$tempConf" > "$pacmanConf"
rm -f "$tempConf"
}
refresh_databases() {
printf 'Refreshing package databases...\n'
pacman -Sy
}
main() {
check_prerequisites
download_and_trust_key
update_pacman_conf
refresh_databases
printf 'Stormux repository is configured.\n'
}
main "$@"
+325
View File
@@ -0,0 +1,325 @@
#!/usr/bin/env bash
set -euo pipefail
repoUrl="https://github.com/X11Libre/pkgbuilds-arch-based.git"
rootfsUrl="http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz"
aarch64Packages=(
xlibre-xserver
xlibre-input-libinput
xlibre-video-fbdev
xlibre-video-amdgpu
xlibre-video-ati
xlibre-video-nouveau
)
outputDir=$(pwd -P)
workDir=""
chrootDir=""
binfmtMounted=false
binfmtRegistered=false
log() {
printf '%s %s\n' "$*" "$(date '+%Y-%m-%d %H:%M:%S')"
}
die() {
printf 'Error: %s\n' "$*" >&2
exit 1
}
cleanup() {
local exitStatus=$?
local cleanupFailed=false
local mountTarget
local chrootMounts=()
trap - EXIT INT TERM
if [[ -n "$workDir" && -d "$workDir" ]]; then
log "Removing temporary chroot"
if [[ -n "$chrootDir" ]]; then
mapfile -t chrootMounts < <(
findmnt -rn -o TARGET |
awk -v root="$chrootDir" '$0 == root || index($0, root "/") == 1' |
sort -r
)
fi
for mountTarget in "${chrootMounts[@]}"; do
if ! mountpoint -q "$mountTarget"; then
continue
fi
if ! umount --recursive "$mountTarget"; then
printf 'Warning: normal chroot unmount failed; detaching it lazily\n' >&2
umount --recursive --lazy "$mountTarget" || cleanupFailed=true
fi
done
rm -rf --one-file-system "$workDir" || cleanupFailed=true
if [[ -e "$workDir" ]]; then
printf 'Error: failed to remove temporary chroot: %s\n' "$workDir" >&2
cleanupFailed=true
fi
fi
if [[ "$binfmtRegistered" == true && -e /proc/sys/fs/binfmt_misc/qemu-aarch64 ]]; then
printf '%s' -1 > /proc/sys/fs/binfmt_misc/qemu-aarch64 || cleanupFailed=true
fi
if [[ "$binfmtMounted" == true ]]; then
umount /proc/sys/fs/binfmt_misc || cleanupFailed=true
fi
if [[ "$cleanupFailed" == true && "$exitStatus" -eq 0 ]]; then
exitStatus=1
fi
exit "$exitStatus"
}
require_commands() {
local commandName
local missingCommands=()
for commandName in arch-chroot awk bsdtar chown cp curl date findmnt grep install mkdir mktemp mount mountpoint rm sort tr umount; do
if ! command -v "$commandName" >/dev/null 2>&1; then
missingCommands+=("$commandName")
fi
done
if ((${#missingCommands[@]})); then
die "Missing required commands: ${missingCommands[*]}"
fi
[[ -x /usr/bin/qemu-aarch64-static ]] || die "/usr/bin/qemu-aarch64-static is required"
[[ -r /usr/lib/binfmt.d/qemu-aarch64-static.conf ]] || die "The qemu-user-static-binfmt package is required"
}
configure_binfmt() {
if ! mountpoint -q /proc/sys/fs/binfmt_misc; then
mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc
binfmtMounted=true
fi
if [[ ! -e /proc/sys/fs/binfmt_misc/qemu-aarch64 ]]; then
tr -d '\n' < /usr/lib/binfmt.d/qemu-aarch64-static.conf > /proc/sys/fs/binfmt_misc/register
binfmtRegistered=true
fi
grep -qx 'enabled' /proc/sys/fs/binfmt_misc/qemu-aarch64 || die "aarch64 binfmt registration is not enabled"
}
create_build_script() {
local buildScript=$1
install -m 0755 /dev/stdin "$buildScript" <<'CHROOT_SCRIPT'
#!/usr/bin/env bash
set -euo pipefail
repoUrl=$1
shift
packages=("$@")
repoDir=/build/pkgbuilds
log() {
printf '%s %s\n' "$*" "$(date '+%Y-%m-%d %H:%M:%S')"
}
install_dependencies() {
local packageDir=$1
local dependency
local outputPackage
local srcInfo
local dependencies=()
local filteredDependencies=()
local missingDependencies=()
local outputPackages=()
local -A internalPackages=()
# $1 is expanded by the nested builder shell, not this root shell.
# shellcheck disable=SC2016
srcInfo=$(runuser -u builder -- bash -c \
'cd "$1" && makepkg --printsrcinfo' _ "$packageDir")
mapfile -t outputPackages < <(
printf '%s\n' "$srcInfo" |
awk -F ' = ' '/^[[:space:]]*pkgname = / { print $2 }'
)
for outputPackage in "${outputPackages[@]}"; do
internalPackages["$outputPackage"]=1
done
mapfile -t dependencies < <(
printf '%s\n' "$srcInfo" |
awk -F ' = ' '
/^[[:space:]]*(depends|makedepends|checkdepends)(_aarch64)? = / {
dependency=$2
sub(/[<>=].*/, "", dependency)
print dependency
}
' |
sort -u
)
for dependency in "${dependencies[@]}"; do
if [[ -z ${internalPackages[$dependency]+present} ]]; then
filteredDependencies+=("$dependency")
fi
done
((${#filteredDependencies[@]})) || return 0
mapfile -t missingDependencies < <(pacman -T "${filteredDependencies[@]}" || true)
((${#missingDependencies[@]})) || return 0
log "Installing dependencies for ${packageDir##*/}"
pacman -S --asdeps --needed --noconfirm "${missingDependencies[@]}"
}
remove_installed_packages() {
local packageName
local installedPackages=()
for packageName in "$@"; do
if pacman -Q "$packageName" >/dev/null 2>&1; then
installedPackages+=("$packageName")
fi
done
((${#installedPackages[@]})) || return 0
log "Removing conflicting packages: ${installedPackages[*]}"
pacman -Rdd --noconfirm "${installedPackages[@]}"
}
build_package() {
local packageName=$1
local installAfterBuild=${2:-false}
local packageDir="$repoDir/$packageName"
local builtPackages=()
[[ -f "$packageDir/PKGBUILD" ]] || {
printf 'Missing PKGBUILD for %s\n' "$packageName" >&2
return 1
}
log "Building $packageName"
install_dependencies "$packageDir"
# $1 is expanded by the nested builder shell, not this root shell.
# shellcheck disable=SC2016
runuser -u builder -- bash -c \
'cd "$1" && makepkg --noconfirm --clean --cleanbuild' _ "$packageDir"
mapfile -d '' builtPackages < <(
find "$packageDir" -maxdepth 1 -type f -name '*.pkg.tar.*' ! -name '*.sig' -print0
)
((${#builtPackages[@]})) || {
printf 'No package artifacts were produced for %s\n' "$packageName" >&2
return 1
}
if [[ "$installAfterBuild" == true ]]; then
case "$packageName" in
xlibre-input-libinput)
remove_installed_packages xf86-input-libinput
;;
xlibre-xserver)
remove_installed_packages \
xorg-server \
xorg-server-common \
xorg-server-devel \
xorg-server-xephyr \
xorg-server-xnest \
xorg-server-xvfb \
glamor-egl \
xf86-video-modesetting
;;
esac
log "Installing $packageName for subsequent builds"
pacman -U --noconfirm "${builtPackages[@]}"
fi
}
log "Initializing Arch Linux ARM"
# Pacman's Landlock sandbox is unavailable through qemu-user emulation.
sed -i \
-e '/^[[:space:]]*DisableSandbox[[:space:]]*$/d' \
-e '/^\[options\][[:space:]]*$/a DisableSandbox' \
/etc/pacman.conf
pacman-key --init
pacman-key --populate archlinuxarm
pacman -Syu --noconfirm
pacman -S --needed --noconfirm base-devel git
useradd --create-home --shell /bin/bash builder
install -d -o builder -g builder /build
log "Cloning XLibre PKGBUILDs"
runuser -u builder -- git clone --depth 1 "$repoUrl" "$repoDir"
# The input driver must first be built against the stock xorg-server-devel.
build_package xlibre-input-libinput true
# Installing all server split packages replaces the stock Xorg server/devel
# packages and provides the ABI dependencies needed by the video drivers.
build_package xlibre-xserver true
for packageName in "${packages[@]}"; do
case "$packageName" in
xlibre-input-libinput|xlibre-xserver)
continue
;;
esac
build_package "$packageName"
done
install -d /output
find "$repoDir" -type f -name '*.pkg.tar.*' ! -name '*.sig' -exec cp -t /output -- {} +
log "All requested aarch64 packages built"
CHROOT_SCRIPT
}
main() {
local rootfsArchive
local packageFile
local copiedPackageCount=0
((EUID == 0)) || die "Run this script as root: sudo $0"
require_commands
trap cleanup EXIT
trap 'exit 130' INT
trap 'exit 143' TERM
configure_binfmt
workDir=$(mktemp -d /tmp/xlibre-aarch64.XXXXXX)
chrootDir="$workDir/root"
rootfsArchive="$workDir/ArchLinuxARM-aarch64-latest.tar.gz"
mkdir -p "$chrootDir"
log "Downloading a fresh Arch Linux ARM aarch64 root filesystem"
curl --fail --location --retry 3 --output "$rootfsArchive" "$rootfsUrl"
log "Creating aarch64 chroot"
bsdtar -xpf "$rootfsArchive" -C "$chrootDir"
install -m 0755 /usr/bin/qemu-aarch64-static "$chrootDir/usr/bin/qemu-aarch64-static"
cp --remove-destination /etc/resolv.conf "$chrootDir/etc/resolv.conf"
create_build_script "$chrootDir/root/build-xlibre"
# arch-chroot expects the chroot root to be a mountpoint.
mount --bind "$chrootDir" "$chrootDir"
log "Starting aarch64 package build"
arch-chroot "$chrootDir" /root/build-xlibre "$repoUrl" "${aarch64Packages[@]}"
shopt -s nullglob
for packageFile in "$chrootDir"/output/*.pkg.tar.*; do
[[ ${packageFile##*/} == *-aarch64.pkg.tar.* ]] || die "Unexpected non-aarch64 artifact: ${packageFile##*/}"
install -m 0644 "$packageFile" "$outputDir/"
((copiedPackageCount += 1))
if [[ -n ${SUDO_UID:-} && -n ${SUDO_GID:-} ]]; then
chown "$SUDO_UID:$SUDO_GID" "$outputDir/${packageFile##*/}"
fi
done
shopt -u nullglob
((copiedPackageCount > 0)) || die "No package artifacts were copied to $outputDir"
log "Copied $copiedPackageCount completed packages to $outputDir"
}
main "$@"
+230
View File
@@ -0,0 +1,230 @@
#!/usr/bin/env bash
set -euo pipefail
shopt -s nullglob
repoDir="/var/www/packages.stormux.org"
aurRpcUrl="https://aur.archlinux.org/rpc/v5/info"
exclude=("gzdoom")
require_cmd() {
local cmd="$1"
if ! command -v "$cmd" >/dev/null 2>&1; then
printf 'Required command not found: %s\n' "$cmd" >&2
exit 1
fi
}
is_excluded() {
local packageName="$1"
local excludedPackage
for excludedPackage in "${exclude[@]}"; do
if [[ "$excludedPackage" == "$packageName" ]]; then
return 0
fi
done
return 1
}
record_local_package_version() {
local packageName="$1"
local packageVersion="$2"
local packageMapName="$3"
local -n packageMapRef="$packageMapName"
local existingVersion="${packageMapRef[$packageName]:-}"
if [[ -z "$existingVersion" ]] || (( $(vercmp "$packageVersion" "$existingVersion") > 0 )); then
packageMapRef["$packageName"]="$packageVersion"
fi
}
read_package_metadata() {
local packageFile="$1"
pacman -Qip "$packageFile" | parse_pacman_info
}
parse_pacman_info() {
awk '
/^Name[[:space:]]*:/ {
packageName=$0
sub(/^Name[[:space:]]*:[[:space:]]*/, "", packageName)
}
/^Version[[:space:]]*:/ {
packageVersion=$0
sub(/^Version[[:space:]]*:[[:space:]]*/, "", packageVersion)
}
END {
if (packageName == "" || packageVersion == "") {
exit 1
}
printf "%s\t%s\n", packageName, packageVersion
}
'
}
collect_local_packages() {
local packageMapName="$1"
# shellcheck disable=SC2178
local -n packageMapRef="$packageMapName"
local archDir packageFile metadata packageName packageVersion
local -a archDirs=("$repoDir/x86_64" "$repoDir/aarch64")
for archDir in "${archDirs[@]}"; do
if [[ ! -d "$archDir" ]]; then
continue
fi
for packageFile in "$archDir"/*.pkg.tar.zst "$archDir"/*.pkg.tar.xz; do
metadata="$(read_package_metadata "$packageFile")" || {
printf 'Unable to read package metadata: %s\n' "$packageFile" >&2
exit 1
}
packageName="${metadata%%$'\t'*}"
packageVersion="${metadata#*$'\t'}"
record_local_package_version "$packageName" "$packageVersion" "$packageMapName"
done
done
}
extract_aur_version_from_json() {
local packageName="$1"
jq -r --arg packageName "$packageName" '
.results[]
| select(.Name == $packageName)
| .Version
' | head -n1
}
fetch_aur_version() {
local packageName="$1"
curl -fsS --get \
--data-urlencode "arg[]=${packageName}" \
"$aurRpcUrl" |
extract_aur_version_from_json "$packageName"
}
print_outdated_packages() {
local packageMapName="$1"
# shellcheck disable=SC2178
local -n packageMapRef="$packageMapName"
local packageName localVersion aurVersion
local -a packageNames=()
mapfile -t packageNames < <(printf '%s\n' "${!packageMapRef[@]}" | sort)
for packageName in "${packageNames[@]}"; do
if is_excluded "$packageName"; then
continue
fi
localVersion="${packageMapRef[$packageName]}"
aurVersion="$(fetch_aur_version "$packageName" || true)"
if [[ -z "$aurVersion" ]]; then
continue
fi
if (( $(vercmp "$localVersion" "$aurVersion") < 0 )); then
printf '%s %s\n' "$packageName" "$aurVersion"
fi
done
}
assert_equals() {
local expected="$1"
local actual="$2"
local message="$3"
if [[ "$expected" != "$actual" ]]; then
printf 'FAIL: %s\nExpected: %s\nActual: %s\n' "$message" "$expected" "$actual" >&2
exit 1
fi
}
assert_success() {
local message="$1"
shift
if ! "$@"; then
printf 'FAIL: %s\n' "$message" >&2
exit 1
fi
}
assert_failure() {
local message="$1"
shift
if "$@"; then
printf 'FAIL: %s\n' "$message" >&2
exit 1
fi
}
main() {
if [[ "${1:-}" == "--self-test" ]]; then
run_self_tests
return
fi
require_cmd "curl"
require_cmd "jq"
require_cmd "pacman"
require_cmd "vercmp"
if [[ ! -d "$repoDir" ]]; then
printf 'Repo dir does not exist: %s\n' "$repoDir" >&2
exit 1
fi
# shellcheck disable=SC2034
declare -A localPackages=()
collect_local_packages localPackages
print_outdated_packages localPackages
}
run_self_tests() {
declare -A packageMap=()
local exactMatchJson noMatchJson
local extractedVersion=""
local pacmanInfo=""
assert_success "excluded package should match" is_excluded "gzdoom"
assert_failure "non-excluded package should not match" is_excluded "fenrir"
record_local_package_version "fenrir" "1:2026.01.20-1" packageMap
record_local_package_version "fenrir" "1:2026.01.28-1" packageMap
record_local_package_version "fenrir" "1:2026.01.10-1" packageMap
assert_equals "1:2026.01.28-1" "${packageMap[fenrir]}" "newest local version should win"
exactMatchJson='{"results":[{"Name":"fenrir-git","Version":"1:r3322.4672592d-1"},{"Name":"fenrir","Version":"1:2026.01.28-1"}]}'
extractedVersion="$(printf '%s\n' "$exactMatchJson" | extract_aur_version_from_json "fenrir")"
assert_equals "1:2026.01.28-1" "$extractedVersion" "exact package name should be selected from AUR JSON"
noMatchJson='{"results":[{"Name":"fenrir-git","Version":"1:r3322.4672592d-1"}]}'
extractedVersion="$(printf '%s\n' "$noMatchJson" | extract_aur_version_from_json "fenrir")"
assert_equals "" "$extractedVersion" "missing exact AUR match should stay empty"
pacmanInfo='Name : fenrir
Version : 1:2026.01.28-1
Description : A user space console screen reader written in python3'
extractedVersion="$(printf '%s\n' "$pacmanInfo" | parse_pacman_info)"
assert_equals $'fenrir\t1:2026.01.28-1' "$extractedVersion" "pacman metadata parsing should return name and version"
if (( $(vercmp "1:2026.01.20-1" "1:2026.01.28-1") >= 0 )); then
printf 'FAIL: older local version should compare lower than AUR version\n' >&2
exit 1
fi
printf 'Self-test passed\n'
}
main "$@"
-28
View File
@@ -1,28 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
startDir="$(pwd)"
buildDir="${startDir}/xlibre-build"
packageList=(
xlibre-input-libinput
xlibre-xserver
xlibre-video-amdgpu
xlibre-video-ati
xlibre-video-fbdev
xlibre-video-intel
xlibre-video-nouveau
xlibre-video-vesa
xlibre-video-dummy-with-vt
)
mkdir -p "${buildDir}"
for i in "${packageList[@]}" ; do
yay -Ga "$i"
pushd "$i"
makepkg -Acrsf
cp -v ./*.pkg.tar.* "${buildDir}/"
popd
done
@@ -1,23 +0,0 @@
pkgbase = xlibre-video-dummy-with-vt
pkgdesc = XLibre dummy video driver with an allocated vt
pkgver = 25.0.0
pkgrel = 5
url = https://github.com/X11Libre/xf86-video-dummy
arch = x86_64
arch = aarch64
groups = xlibre-drivers
license = MIT
license = X11
makedepends = xlibre-xserver-devel>=25.0
makedepends = xorgproto
depends = xlibre-xserver>=25.0
depends = glibc
provides = xf86-video-dummy
provides = x11win-video-dummy
conflicts = xf86-video-dummy
source = https://github.com/X11Libre/xf86-video-dummy/archive/refs/tags/xlibre-xf86-video-dummy-25.0.0.tar.gz
source = dummy_driver.patch
sha256sums = b56e610705cd3d4d86422a11c6b0d93357e4d4749a05178a85fd250301d357b9
sha256sums = 68cdcf21e9b54a7fdb8e968292e1ef9ad154ddb1361b141a0a635c2a13c92bfa
pkgname = xlibre-video-dummy-with-vt
@@ -1,5 +0,0 @@
*
!PKGBUILD
!.SRCINFO
!.gitignore
!.nvchecker.toml
@@ -1,5 +0,0 @@
[xlibre-video-dummy]
source = "git"
git = "https://github.com/x11libre/xf86-video-dummy.git"
include_regex = "xlibre-xf86-video-dummy-.*"
prefix = "xlibre-xf86-video-dummy-"
@@ -1,59 +0,0 @@
# Maintainer: Storm Dragon <storm_dragon@linux-a11y.org>
pkgname=xlibre-video-dummy-with-vt
pkgver=25.0.0
pkgrel=5
pkgdesc="XLibre dummy video driver with an allocated vt"
arch=(x86_64 aarch64)
_pkgname=xf86-video-dummy
url="https://github.com/X11Libre/${_pkgname}"
license=('MIT' 'X11')
depends=("xlibre-xserver>=${pkgver%.*}" 'glibc')
makedepends=("xlibre-xserver-devel>=${pkgver%.*}" 'xorgproto')
conflicts=("${_pkgname}")
provides=("${_pkgname}" 'x11win-video-dummy')
source=("${url}/archive/refs/tags/xlibre-${_pkgname}-${pkgver}.tar.gz"
"dummy_driver.patch")
groups=('xlibre-drivers')
sha256sums=('b56e610705cd3d4d86422a11c6b0d93357e4d4749a05178a85fd250301d357b9'
'68cdcf21e9b54a7fdb8e968292e1ef9ad154ddb1361b141a0a635c2a13c92bfa')
prepare() {
cd "${srcdir}/${_pkgname}-xlibre-${_pkgname}-${pkgver}/src"
patch -i "${srcdir}/dummy_driver.patch"
}
build() {
case "$CARCH" in
"x86_64")
CFLAGS=" -march=x86-64"
;;
"aarch64")
CFLAGS=" -march=armv8-a"
;;
*)
CFLAGS=" -march=native"
;;
esac
CFLAGS+=" -mtune=generic -O2 -pipe -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security"
CFLAGS+=" -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"
LDFLAGS=" -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,lazy -Wl,-z,relro -Wl,-z,pack-relative-relocs"
if [[ $CARCH != 'aarch64' ]]; then
CFLAGS+=" -fcf-protection"
fi
CXXFLAGS="${CFLAGS} -Wp,-D_GLIBCXX_ASSERTIONS"
export CFLAGS="${CFLAGS}"
export CXXFLAGS="${CXXFLAGS}"
export LDFLAGS="${LDFLAGS}"
cd "${srcdir}/${_pkgname}-xlibre-${_pkgname}-${pkgver}"
./autogen.sh
./configure --prefix=/usr
make
}
package() {
cd "${srcdir}/${_pkgname}-xlibre-${_pkgname}-${pkgver}"
make DESTDIR="${pkgdir}" install
install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
@@ -1,17 +0,0 @@
--- a/src/dummy_driver.c
+++ b/src/dummy_driver.c
@@ -1016,10 +1016,10 @@ dummyDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr)
CARD32 *flag;
switch (op) {
- case GET_REQUIRED_HW_INTERFACES:
- flag = (CARD32*)ptr;
- (*flag) = HW_SKIP_CONSOLE;
- return TRUE;
+ case GET_REQUIRED_HW_INTERFACES:
+ flag = (CARD32*)ptr;
+ /* Allow the driver to allocate a VT instead of skipping the console. */
+ return TRUE;
default:
return FALSE;
}
+180
View File
@@ -0,0 +1,180 @@
#!/usr/bin/env bash
set -euo pipefail
repoRoot="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
selector="$repoRoot/pi4/files/usr/local/lib/stormux/select-speech-module"
tempDir="$(mktemp -d)"
mockBin="$tempDir/bin"
testCount=0
cleanup() {
rm -rf "$tempDir"
}
trap cleanup EXIT
mkdir -p "$mockBin" "$tempDir/runtime"
cat > "$mockBin/sudo" <<'EOF'
#!/usr/bin/env bash
if [[ "${1:-}" == "-A" ]]; then
shift
fi
if [[ "${MOCK_SUDO_FAIL_WRITE:-no}" == "yes" && "$*" == *"--write-selection"* ]]; then
exit 1
fi
exec "$@"
EOF
cat > "$mockBin/spd-say" <<'EOF'
#!/usr/bin/env bash
printf '%s\n' "$*" >> "$MOCK_LOG"
if [[ "${1:-}" == "-O" ]]; then
cat "$MOCK_MODULES"
exit "${MOCK_DISCOVERY_STATUS:-0}"
fi
exit 0
EOF
cat > "$mockBin/socat" <<'EOF'
#!/usr/bin/env bash
read -r command
printf 'socat %s: %s\n' "$*" "$command" >> "$MOCK_LOG"
EOF
cat > "$mockBin/systemctl" <<'EOF'
#!/usr/bin/env bash
printf 'systemctl %s\n' "$*" >> "$MOCK_LOG"
if [[ "${1:-}" == "is-active" ]]; then
[[ "${MOCK_FENRIR_ACTIVE:-no}" == "yes" ]]
exit
fi
exit 0
EOF
chmod 755 "$mockBin"/*
fail() {
printf 'FAIL: %s\n' "$1" >&2
exit 1
}
assert_equals() {
local expected="$1"
local actual="$2"
local description="$3"
[[ "$actual" == "$expected" ]] || fail "$description (expected '$expected', got '$actual')"
}
assert_file_contains() {
local filePath="$1"
local pattern="$2"
local description="$3"
grep -qE -- "$pattern" "$filePath" || fail "$description"
}
assert_file_absent() {
local filePath="$1"
local description="$2"
[[ ! -e "$filePath" ]] || fail "$description"
}
reset_case() {
caseDir="$tempDir/case-$testCount"
testCount=$((testCount + 1))
mkdir -p "$caseDir/runtime"
configFile="$caseDir/speechd.conf"
selectionFile="$caseDir/selected"
modulesFile="$caseDir/modules"
mockLog="$caseDir/mock.log"
: > "$mockLog"
printf 'OUTPUT MODULES\nrhvoice\nopenevv\nespeak-ng\n' > "$modulesFile"
printf '# Speech Dispatcher\nDefaultModule rhvoice\n' > "$configFile"
}
run_selector() {
local input="$1"
printf '%b' "$input" | env \
PATH="$mockBin:$PATH" \
MOCK_LOG="$mockLog" \
MOCK_MODULES="$modulesFile" \
MOCK_DISCOVERY_STATUS="${MOCK_DISCOVERY_STATUS:-0}" \
MOCK_FENRIR_ACTIVE="${MOCK_FENRIR_ACTIVE:-no}" \
MOCK_SUDO_FAIL_WRITE="${MOCK_SUDO_FAIL_WRITE:-no}" \
STORMUX_SPEECH_CONFIG="$configFile" \
STORMUX_RUNTIME_DIR="$caseDir/runtime" \
STORMUX_SPD_SAY=spd-say \
STORMUX_SOCAT=socat \
STORMUX_SYSTEMCTL=systemctl \
"$selector" --selection-file "$selectionFile" >/dev/null
}
# Enter accepts the configured initial module and collapses duplicate directives.
reset_case
printf 'DefaultModule rhvoice\n# DefaultModule espeak-ng\nDefaultModule openevv\n' > "$configFile"
MOCK_FENRIR_ACTIVE=yes run_selector '\n'
assert_equals 1 "$(grep -c '^DefaultModule ' "$configFile")" "initial selection should leave one active default"
assert_file_contains "$configFile" '^DefaultModule rhvoice$' "initial selection should retain rhvoice"
assert_equals rhvoice "$(< "$selectionFile")" "initial selection should be recorded"
assert_file_contains "$mockLog" 'speech#enabled=False' "active Fenrir speech should be muted"
assert_file_contains "$mockLog" 'speech#enabled=True' "active Fenrir speech should be restored"
assert_file_contains "$mockLog" 'Use up and down arrows to select the default voice for this computer\.' "the selector should voice its own instructions"
if grep -q '^systemctl restart ' "$mockLog"; then
fail "the selector should defer the Fenrir restart until after layout selection"
fi
# Down previews and selects the next module.
reset_case
run_selector 'x\033[B\n'
assert_file_contains "$mockLog" '^-o openevv This is openevv\.' "Down should preview OpenEVV"
assert_file_contains "$configFile" '^DefaultModule openevv$' "Down then Enter should select OpenEVV"
# Up wraps from the first module to the last.
reset_case
run_selector '\033[A\n'
assert_file_contains "$mockLog" '^-o espeak-ng This is espeak-ng\.' "Up should wrap and preview eSpeak NG"
assert_file_contains "$configFile" '^DefaultModule espeak-ng$' "wrapped module should persist"
# Escape retains the prior file and does not create an installer selection.
reset_case
cp "$configFile" "$caseDir/original.conf"
run_selector '\033'
cmp -s "$configFile" "$caseDir/original.conf" || fail "Escape should retain the configuration"
assert_file_absent "$selectionFile" "Escape should not record an installer selection"
# Empty discovery fails safely.
reset_case
printf 'OUTPUT MODULES\n' > "$modulesFile"
cp "$configFile" "$caseDir/original.conf"
run_selector '\n'
cmp -s "$configFile" "$caseDir/original.conf" || fail "empty discovery should retain the configuration"
assert_file_absent "$selectionFile" "empty discovery should not record a selection"
# Unsafe names are rejected rather than passed to spd-say or configuration.
reset_case
printf 'OUTPUT MODULES\nbad name\n;command\nopenevv\n' > "$modulesFile"
run_selector '\n'
assert_file_contains "$configFile" '^DefaultModule openevv$' "the remaining safe module should be selected"
if grep -qE 'bad name|;command' "$mockLog"; then
fail "unsafe module names should not reach spd-say"
fi
# A missing configuration simulates failed persistence and remains nonfatal.
reset_case
rm -f "$configFile"
MOCK_FENRIR_ACTIVE=yes run_selector '\n'
assert_file_absent "$selectionFile" "failed persistence should not record a selection"
assert_file_contains "$mockLog" 'selection failed' "failed persistence should be announced"
assert_file_contains "$mockLog" 'speech#enabled=True' "failed persistence should restore Fenrir speech"
# Failure to record the live choice also rolls the system configuration back.
reset_case
cp "$configFile" "$caseDir/original.conf"
MOCK_SUDO_FAIL_WRITE=yes run_selector '\033[B\n'
cmp -s "$configFile" "$caseDir/original.conf" || fail "selection-file failure should roll back the configuration"
assert_file_absent "$selectionFile" "selection-file failure should leave no selection"
printf 'PASS: %s speech selector cases\n' "$testCount"
+237
View File
@@ -0,0 +1,237 @@
# Stormux x86_64 ISO Build
This directory contains the archiso profile for building a Stormux x86_64 live/install ISO image.
## Overview
The x86_64 build uses archiso (Arch Linux ISO build system) and is configured for accessibility with the Fenrir screen reader. The `airootfs/` tree is maintained as the x86_64 live-system overlay; shared behavior may mirror the Pi image, but files are not copied from `pi4/files/` during the build.
## Directory Structure
```
x86_64/
├── build.sh # Main build script
├── profiledef.sh # Archiso profile definition
├── pacman.conf # Pacman config with Stormux repository
├── packages.x86_64 # Package list for installation
├── grub/ # UEFI boot configuration
│ ├── grub.cfg
│ └── loopback.cfg
├── syslinux/ # BIOS boot configuration
│ ├── archiso_head.cfg
│ ├── archiso_pxe.cfg
│ ├── archiso_pxe-linux.cfg
│ ├── archiso_sys.cfg
│ ├── archiso_sys-linux.cfg
│ ├── archiso_tail.cfg
│ ├── splash.png
│ └── syslinux.cfg
└── airootfs/ # Live system overlay files
├── etc/ # Live-system configuration
├── root/ # x86_64-specific scripts
├── usr/ # Live-system utilities and installer
└── var/ # Live-system variable data
```
## Overlay Maintenance
Edit files directly under `airootfs/` using the final filesystem path they should have in the live ISO. For example, live-system scripts belong under `airootfs/usr/local/bin/`, and systemd units belong under `airootfs/etc/systemd/system/`.
Some files intentionally match the Pi overlay, such as shell defaults, Fenrir support scripts, and shared Stormux helper behavior. Keep both trees in sync when a change is meant to affect both image families.
Pi hardware files remain Pi-only and should not be added to the x86_64 profile unless there is a specific PC use for them:
- `boot/cmdline.txt` - Pi boot command line
- `boot/config.txt` - Pi hardware configuration
- `etc/modprobe.d/brcmfmac.conf` - Pi wireless driver config
## Prerequisites
Building requires an Arch Linux host system with:
- `archiso` package installed
- Root privileges
- Internet connection for package downloads and build-time helper installs
## Building the ISO
```bash
cd x86_64
sudo ./build.sh
```
### Build Options
- `-o <dir>` - Output directory (default: `./out`)
- `-w <dir>` - Work directory (default: `./work`)
- `-h` - Show help
### Build Process
1. Uses the maintained `airootfs/` overlay as-is
2. Adds Stormux repository GPG key to the build host's keyring
- Uses the included `stormux_repo.pub` file
- Key fingerprint: 52ADA49000F1FF0456F8AEEFB4CDE1CD56EF8E82
3. Runs `mkarchiso` to build the ISO
- Packages from Stormux repo can be installed during build
- The latest `sas` helper is installed into the live environment during image creation
4. Renames the ISO to `stormux-x86_64-YYYY-MM-DD.iso` when possible and writes a matching `.sha1sum`
The Stormux repository key is also embedded in the ISO at `/usr/share/stormux/stormux_repo.pub` and automatically imported on first boot via the `stormux-repo-init.service`, ensuring the live environment can install additional packages from the Stormux repository.
## Key Features
### Accessibility
- **Fenrir screen reader** starts automatically (not speakup)
- **Pipewire audio** properly initialized before Fenrir starts
- **Speech-dispatcher** integration for speech synthesis
- The UEFI systemd-boot menu enables its audible beep
- Boot menu defaults to accessible entry
- Service startup order ensures audio is ready before screen reader
- First-login setup calibrates volume, selects the default speech engine and Fenrir keyboard layout, starts Fenrir, then checks networking and time before offering the installer
### Package Management
- Stormux repository configured with priority over Arch repos
- Custom packages from Stormux repo: fenrir, w3m-git, yay, etc.
### Default Configuration
- Default user: `stormux` / Password: `stormux`
- Root password: `root`
- NetworkManager for network configuration
- Braille terminal support (brltty)
- Multiple speech synthesizers (espeak-ng, rhvoice)
## Audio and Speech Initialization
The live environment uses a carefully orchestrated startup sequence to ensure Fenrir has working audio:
1. **stormux-audio-setup.service** - Runs after sound hardware is detected
- Enables systemd user linger for the stormux user
- Starts pipewire user services
- Unmutes audio and sets volume to 70%
2. **First-login setup on tty1**
- Calibrates volume using Speech Dispatcher
- Offers the default speech-engine selector
- Speaks the laptop-layout question using the selected engine
- Sets `[keyboard] layout` in `/etc/fenrirscreenreader/settings/settings.toml`, preserving comments, and validates the configuration
- Starts `fenrirscreenreader.service` with the selected settings
3. **fenrirscreenreader.service** - Screen reader with dependencies
- Configured to wait for user audio initialization and sound.target
- Uses speech-dispatcher for TTS output
- Disabled at boot in the live ISO; started by first-login setup
The old `stormux-speech.service` boot launcher is also disabled in the live ISO. The installed system still enables Fenrir at boot.
## Live Setup and Installer Flow
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. 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
1. **No ARM-specific packages** - Uses x86_64 standard Linux kernel
2. **Fenrir instead of speakup** - More feature-rich screen reader
3. **UEFI and BIOS support** - Boots on both modern and legacy systems
4. **ISO format** - Live/install medium instead of disk image
5. **No Pi hardware configs** - Standard x86_64 PC configuration
6. **Different audio startup** - Pipewire user services instead of system-wide
## Testing
After building, test the ISO with:
- QEMU/KVM virtual machine
- VirtualBox
- Physical hardware (USB/CD)
Before building, run the focused checks from this directory:
```bash
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
```
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 VM testing with audio:
```bash
./qemu-boot.sh
```
After installing to the test disk, boot the installed system with:
```bash
./qemu-boot.sh -i
```
## Customization
### Adding Packages
Edit `packages.x86_64` and add package names (one per line).
### Modifying Boot Configuration
- BIOS: Edit `syslinux/archiso_sys-linux.cfg`
- UEFI: Edit `efiboot/loader/loader.conf` and entries under `efiboot/loader/entries/`
### Adding Overlay Files
Place files in `airootfs/` following the target filesystem structure.
The x86_64 build uses this overlay directly.
### Default X Resources
Keep `airootfs/etc/skel.stormux/.Xresources` and
`airootfs/home/stormux/.Xresources` identical. The home copy supplies the live
user's defaults. During ISO creation, the skeleton copy is placed in
`/etc/skel`; `install-stormux` copies it into the target's `/etc/skel` after
package installation and before creating users. All users created with new
home directories by the installer inherit `~/.Xresources`, regardless of the
selected desktop or partition layout. Users created later with `useradd -m`
inherit it as well. Reused home directories keep their existing files.
## Troubleshooting
### Build fails with GPG errors
The build script should automatically add the Stormux repository key. If it fails:
1. Check that `x86_64/stormux_repo.pub` exists
2. Manually add the key to your build host:
```bash
sudo pacman-key --add x86_64/stormux_repo.pub
sudo pacman-key --lsign-key 52ADA49000F1FF0456F8AEEFB4CDE1CD56EF8E82
```
### Missing packages
Ensure the Stormux repository is accessible:
```bash
curl -I https://packages.stormux.org/x86_64/
```
### Disk space issues
The build requires significant space:
- Work directory: ~3-4 GB
- Output ISO: ~1-2 GB
Ensure adequate free space in work and output directories.
@@ -1,4 +0,0 @@
bifrost=buyfraust
danestange=dainstanggey
stange=stangey
kde=kaydeee
@@ -1,19 +0,0 @@
asus=aysus
certificate=cirtifficate
douche=doosh*
espeak=easpeak*
freenginx=freeenginex
git=ghit*
github=ghittehub
gitea=ghittee
jolla=yolla
jenux=jennux
lightnin=lighttnin
nginx=enginex
rhvoice=ahraychvoice
shit=shitt
sync=sink*
timezone=timezoan
vinux=vinnux
wench=wentch*
youngin=younggin*
+4
View File
@@ -76,6 +76,10 @@ LocalFileSigLevel = Optional
#[core-testing] #[core-testing]
#Include = /etc/pacman.d/mirrorlist #Include = /etc/pacman.d/mirrorlist
[xlibre-stable]
SigLevel = Required DatabaseOptional
Server = https://packages.xlibre.net/arch/stable/$arch
[stormux] [stormux]
SigLevel = Required DatabaseOptional SigLevel = Required DatabaseOptional
Server = https://packages.stormux.org/$arch Server = https://packages.stormux.org/$arch
@@ -32,7 +32,7 @@ while [[ $volume -le 130 ]]; do
clear clear
pactl set-sink-volume @DEFAULT_SINK@ "${volume}%" 2>/dev/null pactl set-sink-volume @DEFAULT_SINK@ "${volume}%" 2>/dev/null
spd-say "If this is loud enough, press enter." spd-say "If this is loud enough, press enter."
if read -t4 ; then if read -r -t4 ; then
echo "Volume set to ${volume}%" echo "Volume set to ${volume}%"
break break
else else
@@ -47,13 +47,7 @@ if [[ -x /etc/audibleprompt.sh ]]; then
export sudoFlags=("-A") export sudoFlags=("-A")
fi fi
clear /usr/local/lib/stormux/select-speech-module \
cat << "EOF" --selection-file /run/stormux/selected-speech-module
Hello, and welcome to Stormux!
Let's get you set up.
Please press enter to continue.
EOF
read -r
sudo "${sudoFlags[@]}" configure-stormux sudo "${sudoFlags[@]}" configure-stormux
@@ -0,0 +1,25 @@
! Start in Unicode
XTerm*utf8: 1
UXTerm*utf8: 1
! Use white-on-black colors
XTerm.vt100.reverseVideo: true
UXTerm.vt100.reverseVideo: true
! XTerm already has 256 colors support
! We ask it to set the correct $TERM XTerm.termName: xterm-256color
UXTerm.termName: xterm-256color
! Start with maximized window
xterm*maximized: true
! Make Alt key behave like in other terminals
XTerm.vt100.altIsNotMeta: true
UXTerm.vt100.altIsNotMeta: true
XTerm.vt100.metaSendsEscape: true
UXTerm.vt100.metaSendsEscape: true
URxvt.perl-ext-common: "default, -searchable-scrollback"
URxvt.font: xft:terminus:size=16
*VT100.Translations: #override \
<Key>BackSpace: string(0x7F)\n\
<Key>Delete: string("\033[3~")\n\
<Key>Home: string("\033[1~")\n\
<Key>End: string("\033[4~")\n\
Ctrl Shift <Key>V: insert-selection(CLIPBOARD)
*ttyModes: erase ^?
@@ -1,5 +1,5 @@
[Unit] [Unit]
# Ensure audio and speech-dispatcher are available before starting Fenrir # Ensure audio is available before starting Fenrir.
# Wait for user audio initialization to complete # Wait for user audio initialization to complete
After=sound.target stormux-audio-setup.service speech-dispatcherd.service user@1000.service After=sound.target stormux-audio-setup.service user@1000.service
Wants=stormux-audio-setup.service speech-dispatcherd.service user@1000.service Wants=stormux-audio-setup.service user@1000.service
+25
View File
@@ -0,0 +1,25 @@
! Start in Unicode
XTerm*utf8: 1
UXTerm*utf8: 1
! Use white-on-black colors
XTerm.vt100.reverseVideo: true
UXTerm.vt100.reverseVideo: true
! XTerm already has 256 colors support
! We ask it to set the correct $TERM XTerm.termName: xterm-256color
UXTerm.termName: xterm-256color
! Start with maximized window
xterm*maximized: true
! Make Alt key behave like in other terminals
XTerm.vt100.altIsNotMeta: true
UXTerm.vt100.altIsNotMeta: true
XTerm.vt100.metaSendsEscape: true
UXTerm.vt100.metaSendsEscape: true
URxvt.perl-ext-common: "default, -searchable-scrollback"
URxvt.font: xft:terminus:size=16
*VT100.Translations: #override \
<Key>BackSpace: string(0x7F)\n\
<Key>Delete: string("\033[3~")\n\
<Key>Home: string("\033[1~")\n\
<Key>End: string("\033[4~")\n\
Ctrl Shift <Key>V: insert-selection(CLIPBOARD)
*ttyModes: erase ^?
+85 -1
View File
@@ -5,10 +5,76 @@
set -e -u set -e -u
install_sas() {
local sasRepo="https://git.stormux.org/storm/sas"
local sasPath="/usr/local/bin/sas"
local tempDir
local installStatus=0
tempDir="$(mktemp -d)"
echo "Installing latest sas..."
if ! git clone --depth 1 "$sasRepo" "$tempDir"; then
rm -rf "$tempDir"
return 1
fi
rm -f "$sasPath"
if ! install -m 755 "$tempDir/sas.py" "$sasPath"; then
installStatus=1
fi
rm -rf "$tempDir"
return "$installStatus"
}
install_rhvoice_english_fixes() {
local rhvoiceRepo="https://git.stormux.org/storm/rhvoice-english"
local targetDir="/etc/RHVoice/dicts/English"
local tempDir
local installStatus=0
tempDir="$(mktemp -d)"
echo "Installing latest RHVoice English dictionary fixes..."
if ! git clone --depth 1 "$rhvoiceRepo" "$tempDir"; then
rm -rf "$tempDir"
return 1
fi
mkdir -p "$targetDir"
rm -f "$targetDir/namefix.txt" "$targetDir/wordfix.txt"
if ! cp -a "$tempDir/English/." "$targetDir/"; then
installStatus=1
fi
rm -rf "$tempDir"
return "$installStatus"
}
install_xlibre_key() {
local keyUrl="https://xlibre-arch.github.io/xlibre-archlinux.asc"
local keyId="B97F7C613F359424"
local keyFile
keyFile="$(mktemp)"
echo "Adding XLibre repository key..."
if ! curl -fsSL "$keyUrl" -o "$keyFile"; then
rm -f "$keyFile"
return 1
fi
pacman-key --add "$keyFile"
pacman-key --lsign-key "$keyId"
rm -f "$keyFile"
}
# Initialize pacman keyring # Initialize pacman keyring
echo "Initializing pacman keyring..." echo "Initializing pacman keyring..."
pacman-key --init pacman-key --init
pacman-key --populate archlinux pacman-key --populate archlinux
install_xlibre_key
# Add Stormux repository key # Add Stormux repository key
echo "Adding Stormux repository key..." echo "Adding Stormux repository key..."
@@ -25,9 +91,27 @@ fi
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
locale-gen locale-gen
install_sas
install_rhvoice_english_fixes
if command -v spd-conf > /dev/null 2>&1; then
spd-conf -n -C || echo "Warning: Speech Dispatcher system configuration failed."
fi
if [[ -f /etc/speech-dispatcher/speechd.conf ]]; then
speechBackup="$(mktemp)"
if /usr/local/lib/stormux/select-speech-module \
--apply-module rhvoice /etc/speech-dispatcher/speechd.conf "$speechBackup"; then
rm -f "$speechBackup"
else
echo "Warning: Could not set RHVoice as the default speech engine."
rm -f "$speechBackup"
fi
fi
# Enable system services # Enable system services
systemctl enable NetworkManager.service systemctl enable NetworkManager.service
systemctl enable fenrirscreenreader.service # The first-login setup starts Fenrir after volume, voice, and layout selection.
systemctl disable fenrirscreenreader.service stormux-speech.service
systemctl enable brltty.path systemctl enable brltty.path
# Enable user services globally for all users # Enable user services globally for all users
+58 -12
View File
@@ -14,6 +14,7 @@ set_timezone() {
mapfile -t regions < <(timedatectl --no-pager list-timezones | cut -d '/' -f1 | sort -u) mapfile -t regions < <(timedatectl --no-pager list-timezones | cut -d '/' -f1 | sort -u)
# Use the same text twice here and just hide the tag field. # Use the same text twice here and just hide the tag field.
# shellcheck disable=SC2046
region=$(dialog --backtitle "Please select your Region" \ region=$(dialog --backtitle "Please select your Region" \
--no-tags \ --no-tags \
--menu "Use up and down arrows or page-up and page-down to navigate the list, and press 'Enter' to make your selection." 0 0 0 \ --menu "Use up and down arrows or page-up and page-down to navigate the list, and press 'Enter' to make your selection." 0 0 0 \
@@ -23,6 +24,7 @@ set_timezone() {
mapfile -t cities < <(timedatectl --no-pager list-timezones | grep "$region" | cut -d '/' -f2 | sort -u) mapfile -t cities < <(timedatectl --no-pager list-timezones | grep "$region" | cut -d '/' -f2 | sort -u)
# Use the same text twice here and just hide the tag field. # Use the same text twice here and just hide the tag field.
# shellcheck disable=SC2046
city=$(dialog --backtitle "Please select a city near you" \ city=$(dialog --backtitle "Please select a city near you" \
--no-tags \ --no-tags \
--menu "Use up and down arrow or page-up and page-down to navigate the list." 0 0 10 \ --menu "Use up and down arrow or page-up and page-down to navigate the list." 0 0 10 \
@@ -35,23 +37,67 @@ set_timezone() {
ln -sf /usr/share/zoneinfo/"${region}"/"${city}" /etc/localtime ln -sf /usr/share/zoneinfo/"${region}"/"${city}" /etc/localtime
timedatectl set-ntp true timedatectl set-ntp true
} }
# Offer to switch fenrir layout.
echo "Would you like to switch Fenrir to laptop layout?" configure_fenrir() {
echo "Press y for yes or n for no followed by enter." local keyboardLayout="desktop" answer configPath tempPath serviceAction="start"
read -r continue configPath="/etc/fenrirscreenreader/settings/settings.toml"
continue="${continue::1}" # A manual rerun must also apply the newly selected launch-time layout.
if [[ "${continue,}" == "y" ]];then if systemctl is-active --quiet fenrirscreenreader.service; then
sed -i 's/=desktop/=laptop/' /etc/fenrirscreenreader/settings/settings.conf serviceAction="restart"
clear
systemctl restart fenrirscreenreader.service
fi fi
# Reload the default engine selected before this script was started.
killall speech-dispatcher 2>/dev/null || true
while true; do
echo "Would you like to switch Fenrir to laptop layout? [y/N]"
spd-say -w "Would you like to switch Fenrir to laptop layout? Press y for yes or n for no, followed by Enter. Press Enter for desktop layout."
read -r answer || return 1
case "${answer,,}" in
y|yes) keyboardLayout="laptop"; break ;;
n|no|"") break ;;
esac
done
tempPath="$(mktemp "${configPath}.stormux.XXXXXX")" || return 1
if ! cp --preserve=mode,ownership "$configPath" "$tempPath" || ! awk -v layout="$keyboardLayout" '
/^[[:space:]]*\[/ { inKeyboard = ($0 ~ /^[[:space:]]*\[keyboard\][[:space:]]*(#.*)?$/) }
inKeyboard && /^[[:space:]]*layout[[:space:]]*=/ {
if (sub(/=[[:space:]]*("[^"]*"|\047[^\047]*\047)/, "= \"" layout "\"")) {
changed++
}
}
{ print }
END { if (changed != 1) exit 1 }
' "$configPath" > "$tempPath" || ! fenrir --config "$tempPath" --check-config; then
rm -f "$tempPath"
echo "Could not configure Fenrir. The original settings were preserved."
spd-say -w "Could not configure Fenrir. The original settings were preserved."
return 1
fi
if ! mv -f "$tempPath" "$configPath"; then
rm -f "$tempPath"
return 1
fi
if ! systemctl "$serviceAction" fenrirscreenreader.service; then
echo "Fenrir could not start. Check journalctl -u fenrirscreenreader.service."
spd-say -w "Fenrir could not start. Check the screen reader service log."
return 1
fi
}
configure_fenrir || exit 1
clear
echo "Hello, and welcome to Stormux!"
echo "Let's get you set up. Please press enter to continue."
read -r
if ! ping -c1 stormux.org &> /dev/null ; then if ! ping -c1 stormux.org &> /dev/null ; then
echo "No internet connection detected. Press enter to open NetworkManager." echo "No internet connection detected. Press enter to open NetworkManager."
read -r continue read -r
echo "setting set focus#highlight=True" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-deamon.sock echo "setting set reading#mode=highlight" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-daemon.sock
nmtui-connect nmtui-connect
echo "setting set focus#highlight=False" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-deamon.sock echo "setting set reading#mode=cursor" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-daemon.sock
fi fi
# Check for internet connectivity # Check for internet connectivity
if ping -qc1 -W 1 stormux.org &> /dev/null; then if ping -qc1 -W 1 stormux.org &> /dev/null; then
+293 -119
View File
@@ -18,18 +18,27 @@ rootPassword=""
declare -a userNames=() declare -a userNames=()
declare -a userPasswords=() declare -a userPasswords=()
declare -a userIsAdmin=() declare -a userIsAdmin=()
desktopEnvironment="" # "none", "i3", "mate" desktopEnvironment="" # "none", "i3"
hasDesktop=false # true if a desktop environment is selected hasDesktop=false # true if a desktop environment is selected
timezone="" timezone=""
enableSsh="no" # "yes" or "no" enableSsh="no" # "yes" or "no"
installLinuxGameManager="no" # "yes" or "no" installLinuxGameManager="no" # "yes" or "no"
installAudiogameManager="no" # "yes" or "no" installAudiogameManager="no" # "yes" or "no"
installSteam="no" # "yes" or "no"
autoLoginUser="" # User to auto-login for desktop environments autoLoginUser="" # User to auto-login for desktop environments
minHomePartitionMiB=1024 minHomePartitionMiB=1024
errorCount=0 errorCount=0
warningCount=0 warningCount=0
currentStep="initialization" currentStep="initialization"
cleanupOnError=false cleanupOnError=false
selectedSpeechModule="rhvoice"
if [[ -r /run/stormux/selected-speech-module ]]; then
mapfile -t selectedSpeechLines < /run/stormux/selected-speech-module
if [[ ${#selectedSpeechLines[@]} -eq 1 && "${selectedSpeechLines[0]}" =~ ^[A-Za-z0-9][A-Za-z0-9_.-]*$ ]]; then
selectedSpeechModule="${selectedSpeechLines[0]}"
fi
fi
# #
@@ -54,6 +63,7 @@ log_info() {
echo "$*" | tee -a "$logFile" echo "$*" | tee -a "$logFile"
} }
# shellcheck disable=SC2329 # Invoked by the ERR trap after pre-install prompts finish.
handle_unexpected_failure() { handle_unexpected_failure() {
local exitCode="$1" local exitCode="$1"
@@ -192,6 +202,7 @@ select_disk() {
lsblk -dno NAME,SIZE,TYPE,MODEL | grep -E "^($(IFS='|'; echo "${disks[*]}")).*disk" || true lsblk -dno NAME,SIZE,TYPE,MODEL | grep -E "^($(IFS='|'; echo "${disks[*]}")).*disk" || true
PS3="Enter disk number: " PS3="Enter disk number: "
COLUMNS=1
select diskChoice in "${disks[@]}" "Cancel"; do select diskChoice in "${disks[@]}" "Cancel"; do
if [[ "$diskChoice" == "Cancel" ]]; then if [[ "$diskChoice" == "Cancel" ]]; then
log_info "Disk selection cancelled by user" log_info "Disk selection cancelled by user"
@@ -268,6 +279,7 @@ select_install_target() {
local manualOption="Use existing /mnt (already mounted root/home/boot)" local manualOption="Use existing /mnt (already mounted root/home/boot)"
PS3="Enter target number: " PS3="Enter target number: "
COLUMNS=1
select targetChoice in "${disks[@]}" "$manualOption" "Cancel"; do select targetChoice in "${disks[@]}" "$manualOption" "Cancel"; do
if [[ "$targetChoice" == "Cancel" ]]; then if [[ "$targetChoice" == "Cancel" ]]; then
log_info "Target selection cancelled by user" log_info "Target selection cancelled by user"
@@ -326,6 +338,7 @@ select_partition_layout() {
) )
PS3="Enter layout number: " PS3="Enter layout number: "
COLUMNS=1
select layout in "${layouts[@]}"; do select layout in "${layouts[@]}"; do
case "$layout" in case "$layout" in
"Single partition"*) "Single partition"*)
@@ -1085,9 +1098,10 @@ gather_system_info() {
# Desktop environment # Desktop environment
echo "Select desktop environment:" echo "Select desktop environment:"
local desktops=("Console only (Fenrir screen reader)" "i3 (tiling window manager)" "MATE (traditional desktop)") local desktops=("Console only (Fenrir screen reader)" "I38 (accessible i3 desktop)")
PS3="Enter desktop number: " PS3="Enter desktop number: "
COLUMNS=1
select desktop in "${desktops[@]}"; do select desktop in "${desktops[@]}"; do
case "$desktop" in case "$desktop" in
"Console only"*) "Console only"*)
@@ -1096,16 +1110,10 @@ gather_system_info() {
log_info "Desktop environment: none" log_info "Desktop environment: none"
break break
;; ;;
"i3"*) "I38"*)
desktopEnvironment="i3" desktopEnvironment="i3"
hasDesktop=true hasDesktop=true
log_info "Desktop environment: i3" log_info "Desktop environment: I38"
break
;;
"MATE"*)
desktopEnvironment="mate"
hasDesktop=true
log_info "Desktop environment: mate"
break break
;; ;;
esac esac
@@ -1122,6 +1130,7 @@ gather_system_info() {
else else
echo "Select which user should automatically login to the graphical session:" echo "Select which user should automatically login to the graphical session:"
PS3="Enter user number: " PS3="Enter user number: "
COLUMNS=1
select selectedUser in "${userNames[@]}"; do select selectedUser in "${userNames[@]}"; do
if [[ -n "$selectedUser" ]]; then if [[ -n "$selectedUser" ]]; then
autoLoginUser="$selectedUser" autoLoginUser="$selectedUser"
@@ -1158,6 +1167,17 @@ gather_system_info() {
installAudiogameManager="no" installAudiogameManager="no"
log_info "Audiogame Manager will not be installed" log_info "Audiogame Manager will not be installed"
fi fi
echo ""
echo "Install Steam? [y/N]:"
read -r steamChoice
if [[ "$steamChoice" =~ ^[Yy]$ ]]; then
installSteam="yes"
log_info "Steam will be installed"
else
installSteam="no"
log_info "Steam will not be installed"
fi
fi fi
# SSH configuration # SSH configuration
@@ -1204,8 +1224,17 @@ gather_system_info() {
echo "Configuration summary:" echo "Configuration summary:"
echo " Hostname: $hostname" echo " Hostname: $hostname"
echo " Users: ${userNames[*]}" echo " Users: ${userNames[*]}"
if [[ "$desktopEnvironment" == "i3" ]]; then
echo " Desktop: I38"
else
echo " Desktop: $desktopEnvironment" echo " Desktop: $desktopEnvironment"
fi
echo " SSH enabled: $enableSsh" echo " SSH enabled: $enableSsh"
if [[ "$hasDesktop" == true ]]; then
echo " linux-game-manager: $installLinuxGameManager"
echo " audiogame-manager: $installAudiogameManager"
echo " Steam: $installSteam"
fi
echo " Timezone: $timezone" echo " Timezone: $timezone"
echo "" echo ""
echo "Press Enter to continue with installation..." echo "Press Enter to continue with installation..."
@@ -1250,11 +1279,68 @@ refresh_package_sources() {
return 0 return 0
} }
enable_multilib_repo() {
local pacmanConf="$1"
if [[ ! -f "$pacmanConf" ]]; then
log_error "Pacman config not found: $pacmanConf"
return 1
fi
log_info "Enabling multilib repository in $pacmanConf"
sed -i \
-e 's/^#\[multilib\]$/[multilib]/' \
-e '/^\[multilib\]$/,/^\[/ s/^#Include = \/etc\/pacman.d\/mirrorlist$/Include = \/etc\/pacman.d\/mirrorlist/' \
"$pacmanConf"
}
install_xlibre_key() {
local keyUrl="https://xlibre-arch.github.io/xlibre-archlinux.asc"
local keyId="B97F7C613F359424"
local keyFile
keyFile="$(mktemp)"
log_info "Adding XLibre repository key"
if ! curl -fsSL "$keyUrl" -o "$keyFile"; then
rm -f "$keyFile"
log_error "Could not download XLibre repository key"
return 1
fi
if ! pacman-key --add "$keyFile"; then
rm -f "$keyFile"
log_error "Could not add XLibre repository key"
return 1
fi
if ! pacman-key --lsign-key "$keyId"; then
rm -f "$keyFile"
log_error "Could not locally sign XLibre repository key"
return 1
fi
rm -f "$keyFile"
}
copy_rhvoice_english_fixes() {
local sourceDir="/etc/RHVoice/dicts/English"
local targetDir="$mountPoint/etc/RHVoice/dicts/English"
if [[ -d "$sourceDir" ]]; then
log_info "Installing RHVoice English dictionary fixes"
mkdir -p "$targetDir"
cp -a "$sourceDir/." "$targetDir/"
else
log_warning "RHVoice English dictionary fixes not found at $sourceDir"
fi
}
install_base_system() { install_base_system() {
log_info "=== Installing Base System ===" log_info "=== Installing Base System ==="
# Copy pacman config with Stormux repo # Copy pacman config with XLibre and Stormux repositories
log_info "Configuring pacman with Stormux repository" log_info "Configuring pacman with XLibre and Stormux repositories"
log_info "Configuring package manager" log_info "Configuring package manager"
local copyItems=( local copyItems=(
@@ -1291,37 +1377,64 @@ install_base_system() {
shopt -u nullglob shopt -u nullglob
fi fi
if [[ "$installSteam" == "yes" ]]; then
enable_multilib_repo /etc/pacman.conf
enable_multilib_repo "$mountPoint/etc/pacman.conf"
fi
if ! install_xlibre_key; then
return 1
fi
# Define package groups # Define package groups
local basePackages=( local basePackages=(
base base-devel linux linux-firmware base base-devel linux linux-firmware
networkmanager sudo dialog git ii rsync wget networkmanager sudo dialog git ii rsync wget curl
bash-completion cronie openssh 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 wireplumber alsa-utils sox gstreamer
gst-plugins-base gst-plugins-good
alsa-firmware sof-firmware alsa-firmware sof-firmware
bluez bluez-utils bluez bluez-utils
) )
local accessibilityPackages=( local accessibilityPackages=(
espeak-ng rhvoice-voice-bdl speech-dispatcher espeak-ng rhvoice-voice-bdl speech-dispatcher
fenrir brltty fenrir brltty cthulhu
) )
local utilityPackages=( local utilityPackages=(
vi vim nano screen magic-wormhole vi vim nano screen magic-wormhole
man man-pages man-db man-pages
xdg-user-dirs xdg-utils xdg-user-dirs xdg-utils
poppler socat parted poppler socat parted
realtime-privileges realtime-privileges wireless-regdb
python-dbus python-gobject python-msgpack
python-pyenchant python-pyte python-pyperclip
python-tornado
) )
# Stormux-specific packages (installed later in chroot after keyring setup) # Stormux-specific packages (installed later in chroot after keyring setup)
# Note: NOT local so it's available in configure_system() # Note: NOT local so it's available in configure_system()
stormuxPackages=( stormuxPackages=(
yay w3m-git openevv-git yay w3m-git
) )
# Combine all packages # Combine all packages
@@ -1331,18 +1444,17 @@ install_base_system() {
if [[ "$hasDesktop" == true ]]; then if [[ "$hasDesktop" == true ]]; then
case "$desktopEnvironment" in case "$desktopEnvironment" in
*) *)
allPackages+=(xlibre-xserver xlibre-input-libinput nodm-dgw brave-bin) allPackages+=(
i38 nodm-dgw xorg-xinit
xlibre-xserver xlibre-input-libinput
xlibre-video-dummy-with-vt xlibre-video-fbdev
)
if [[ "$installSteam" == "yes" ]]; then
allPackages+=(steam)
fi
;;& ;;&
i3) i3)
allPackages+=(i3-wm orca python-psutil lxterminal pluma) allPackages+=(xdotool)
allPackages+=(discount jq libnotify xfce4-notifyd pamixer playerctl)
allPackages+=(python-i3ipc python-wxpython sox yad)
allPackages+=(lxsession magic-wormhole pcmanfm)
allPackages+=(python-gobject python-pillow python-pytesseract scrot tesseract)
allPackages+=(tesseract-data-eng udiskie xorg-setxkbmap xdotool)
;;
mate)
allPackages+=(mate mate-extra orca python-psutil)
;; ;;
esac esac
fi fi
@@ -1367,12 +1479,18 @@ install_base_system() {
return 1 return 1
fi fi
copy_rhvoice_english_fixes
# Populate the target skeleton before configure_system creates users.
log_info "Installing default X resources"
install -Dm644 /etc/skel/.Xresources "$mountPoint/etc/skel/.Xresources"
# Generate or preserve fstab # Generate or preserve fstab
if [[ "$useExistingMount" == true ]]; then if [[ "$useExistingMount" == true ]]; then
if [[ -s "$mountPoint/etc/fstab" ]]; then if grep -Eq '^[[:space:]]*[^#[:space:]]' "$mountPoint/etc/fstab" 2>/dev/null; then
log_info "Manual mount mode: preserving existing /etc/fstab" log_info "Manual mount mode: preserving existing /etc/fstab"
else else
log_warning "Manual mount mode: /etc/fstab not found, generating one" log_warning "Manual mount mode: /etc/fstab has no filesystem entries, generating one"
genfstab -U "$mountPoint" > "$mountPoint/etc/fstab" genfstab -U "$mountPoint" > "$mountPoint/etc/fstab"
fi fi
else else
@@ -1511,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)
# #
@@ -1604,10 +1776,10 @@ fi
gameManagerPackagesCmd+=" gameManagerPackagesCmd+="
# Install packages for audiogame-manager # Install packages for audiogame-manager
echo \"Installing packages for audiogame-manager...\" echo \"Installing packages for audiogame-manager...\"
# Critical packages: wine, p7zip, curl, dialog, sox, cabextract, unzip, xz # Critical packages: wine, wine-access, p7zip, curl, dialog, sox, cabextract, unzip, xz
# Optional packages: winetricks, wine_gecko, wine-mono, translate-shell, gawk, perl, xclip, xdotool # Optional packages: winetricks, wine_gecko, wine-mono, translate-shell, gawk, perl, xclip, xdotool
# Audio packages: gst-plugins for multimedia support # Audio packages: gst-plugins for multimedia support
if ! pacman -S --noconfirm --needed wine winetricks wine_gecko wine-mono p7zip curl dialog sox cabextract unzip xz translate-shell gawk perl xclip xdotool gst-plugins-bad gst-plugins-good gst-plugins-ugly gst-libav; then if ! pacman -S --noconfirm --needed wine wine-access winetricks wine_gecko wine-mono p7zip curl dialog sox cabextract unzip xz translate-shell gawk perl xclip xdotool gst-plugins-bad gst-plugins-good gst-plugins-ugly gst-libav; then
echo \"WARNING: Failed to install one or more audiogame-manager dependencies\" echo \"WARNING: Failed to install one or more audiogame-manager dependencies\"
fi fi
" "
@@ -1694,7 +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 ssh-login-monitor.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
@@ -1703,114 +1875,65 @@ fi
# Enable SSH if requested # Enable SSH if requested
if [[ "${enableSsh}" == "yes" ]]; then if [[ "${enableSsh}" == "yes" ]]; then
systemctl enable sshd.service systemctl enable sshd.service ssh-login-monitor.service
echo "SSH server enabled" echo "SSH server enabled"
else
systemctl disable sshd.service ssh-login-monitor.service
systemctl disable sshd.socket 2> /dev/null || true
echo "SSH server disabled"
fi fi
# Setup desktop environment configurations # Setup desktop environment configurations
if [[ "${desktopEnvironment}" == "i3" ]]; then if [[ "${desktopEnvironment}" == "i3" ]]; then
firstUser="${userNames[0]}" desktopUser="${autoLoginUser}"
# Create git directory for better organization # Create git directory for better organization
mkdir -p /home/\$firstUser/git mkdir -p /home/\$desktopUser/git
chown \$firstUser:users /home/\$firstUser/git chown \$desktopUser:users /home/\$desktopUser/git
# Clone I38 to ~/git/I38 # Clone I38 to ~/git/I38
echo "Cloning I38 accessibility configuration..." echo "Cloning I38 accessibility configuration..."
if ! sudo -u \$firstUser git clone https://git.stormux.org/storm/I38 /home/\$firstUser/git/I38; then if ! sudo -u \$desktopUser git clone https://git.stormux.org/storm/I38 /home/\$desktopUser/git/I38; then
echo "WARNING: Failed to clone I38 repository" echo "WARNING: Failed to clone I38 repository"
fi fi
# Run I38 setup to generate accessible i3 configuration # Run I38 setup to generate accessible i3 configuration
if [[ -d /home/\$firstUser/git/I38 ]]; then if [[ -d /home/\$desktopUser/git/I38 ]]; then
echo "Configuring I38 for accessibility..." echo "Configuring I38 for accessibility..."
cd /home/\$firstUser/git/I38 || exit 1 cd /home/\$desktopUser/git/I38 || exit 1
# Ensure xdotool is available for I38 setup if ! sudo -u \$desktopUser ./i38.sh -D; then
if ! command -v xdotool >/dev/null 2>&1; then echo "WARNING: I38 default setup reported an error"
echo "Installing xdotool for I38..."
if ! pacman -Sy --noconfirm --needed xdotool; then
echo "WARNING: Failed to install xdotool for I38 setup"
fi
fi
# Run I38 setup scripts as the user
# -x generates xinitrc and xprofile
# Main script generates i3 config with accessibility features
if ! sudo -u \$firstUser ./i38.sh -x; then
echo "WARNING: I38 xinit/xprofile setup reported an error"
fi
if ! sudo -u \$firstUser ./i38.sh; then
echo "WARNING: I38 main setup reported an error"
fi fi
cd - > /dev/null || exit 1 cd - > /dev/null || exit 1
fi fi
elif [[ "${desktopEnvironment}" == "mate" ]]; then
firstUser="${userNames[0]}"
# Create .xinitrc for MATE
cat > /home/\$firstUser/.xinitrc <<'XINITRC_MATE_EOF'
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
[[ -f ~/.Xresources ]] && xrdb -merge -I\$HOME ~/.Xresources
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "\$f" ] && . "\$f"
done
unset f
fi
[ -f /etc/xprofile ] && . /etc/xprofile
[ -f ~/.xprofile ] && . ~/.xprofile
exec dbus-run-session -- mate-session
XINITRC_MATE_EOF
chmod 755 /home/\$firstUser/.xinitrc
chown \$firstUser:users /home/\$firstUser/.xinitrc
# Create .xprofile for MATE with accessibility variables
cat > /home/\$firstUser/.xprofile <<'XPROFILE_MATE_EOF'
# Accessibility variables
export ACCESSIBILITY_ENABLED=1
export CHROME_FLAGS="--force-renderer-accessibility"
export GTK_MODULES=gail:atk-bridge
export GNOME_ACCESSIBILITY=1
export QT_ACCESSIBILITY=1
export QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
export SAL_USE_VCLPLUGIN=gtk3
# Enable Orca screen reader
if ! gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled true; then
echo "WARNING: Could not set GNOME screen-reader-enabled flag"
fi
if ! gsettings set org.mate.interface accessibility true; then
echo "WARNING: Could not set MATE accessibility flag"
fi
if ! gsettings set org.mate.applications-at-visual startup true; then
echo "WARNING: Could not set MATE startup applications accessibility flag"
fi
XPROFILE_MATE_EOF
chmod 755 /home/\$firstUser/.xprofile
chown \$firstUser:users /home/\$firstUser/.xprofile
# Configure speech-dispatcher for MATE
if [[ ! -d /home/\$firstUser/.config/speech-dispatcher ]]; then
if ! sudo -u \$firstUser spd-conf -n; then
echo "WARNING: Failed to initialize speech-dispatcher configuration for \$firstUser"
fi
fi
fi fi
# Initialize pacman keyring # Initialize pacman keyring
pacman-key --init pacman-key --init
pacman-key --populate archlinux pacman-key --populate archlinux
# Import XLibre key so installed systems keep using the official XLibre repository.
keyFile="\$(mktemp)"
if curl -fsSL https://xlibre-arch.github.io/xlibre-archlinux.asc -o "\$keyFile"; then
if ! pacman-key --add "\$keyFile"; then
echo "ERROR: Could not add XLibre signing key to pacman keyring"
rm -f "\$keyFile"
exit 1
fi
if ! pacman-key --lsign-key B97F7C613F359424; then
echo "ERROR: Could not locally sign XLibre pacman key"
rm -f "\$keyFile"
exit 1
fi
else
echo "ERROR: Could not download XLibre signing key"
rm -f "\$keyFile"
exit 1
fi
rm -f "\$keyFile"
# Import Stormux key if present # Import Stormux key if present
if [[ -f /usr/share/pacman/keyrings/stormux.gpg ]]; then if [[ -f /usr/share/pacman/keyrings/stormux.gpg ]]; then
if ! pacman-key --add /usr/share/pacman/keyrings/stormux.gpg; then if ! pacman-key --add /usr/share/pacman/keyrings/stormux.gpg; then
@@ -1841,9 +1964,13 @@ fi
$pipewireConfigCmd $pipewireConfigCmd
# Configure nodm for automatic login (only after nodm package is installed) # Configure nodm for automatic login (only after nodm package is installed)
if [[ "${desktopEnvironment}" == "i3" ]] || [[ "${desktopEnvironment}" == "mate" ]]; then if [[ "${desktopEnvironment}" == "i3" ]]; then
if [[ -f /etc/nodm.conf ]]; then if [[ -f /etc/nodm.conf ]]; then
sed -i "s/{user}/${autoLoginUser}/g" /etc/nodm.conf sed -i \
-e "s/{user}/${autoLoginUser}/g" \
-e "s#^NODM_USER=.*#NODM_USER='${autoLoginUser}'#" \
-e "s#^NODM_XSESSION=.*#NODM_XSESSION='/home/${autoLoginUser}/.xinitrc'#" \
/etc/nodm.conf
systemctl enable nodm.service systemctl enable nodm.service
echo "Display manager (nodm) configured for ${autoLoginUser}" echo "Display manager (nodm) configured for ${autoLoginUser}"
else else
@@ -1851,6 +1978,35 @@ if [[ "${desktopEnvironment}" == "i3" ]] || [[ "${desktopEnvironment}" == "mate"
fi fi
fi fi
if command -v spd-conf > /dev/null 2>&1; then
spd-conf -n -C || echo "WARNING: Speech Dispatcher system configuration failed"
fi
if [[ -f /etc/speech-dispatcher/speechd.conf ]]; then
speechConfig=/etc/speech-dispatcher/speechd.conf
speechConfigTemp="\$(mktemp "\${speechConfig}.stormux.XXXXXX")"
awk -v moduleName="${selectedSpeechModule}" '
BEGIN { wroteDefault = 0 }
/^[[:space:]]*#?[[:space:]]*DefaultModule[[:space:]]+/ {
if (!wroteDefault) {
print "DefaultModule " moduleName
wroteDefault = 1
}
next
}
{ print }
END {
if (!wroteDefault) {
print ""
print "DefaultModule " moduleName
}
}
' "\$speechConfig" > "\$speechConfigTemp"
chown --reference="\$speechConfig" "\$speechConfigTemp"
chmod --reference="\$speechConfig" "\$speechConfigTemp"
mv -f "\$speechConfigTemp" "\$speechConfig"
fi
# Create system-wide accessibility configuration # Create system-wide accessibility configuration
cat > /etc/profile.d/stormux-accessibility.sh <<'PROFILE_EOF' cat > /etc/profile.d/stormux-accessibility.sh <<'PROFILE_EOF'
#!/bin/sh #!/bin/sh
@@ -2190,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
@@ -2233,7 +2394,6 @@ else
if [[ "$desktopEnvironment" == "i3" ]]; then if [[ "$desktopEnvironment" == "i3" ]]; then
log " 4. Your i3 desktop is configured with I38 for accessibility" log " 4. Your i3 desktop is configured with I38 for accessibility"
log " - I38 source is available in ~/git/I38 for customization" log " - I38 source is available in ~/git/I38 for customization"
log " - Press Alt+Shift+F1 for I38 help after login"
fi fi
log "" log ""
@@ -2243,7 +2403,21 @@ else
# Play success sound # Play success sound
play_success_sound play_success_sound
finalExitCode=0 finalExitCode=0
promptPoweroff=true
fi fi
if [[ "${promptPoweroff:-false}" == true ]]; then
echo ""
read -rp "Power off this installation media now? [y/N]: " poweroffChoice
if [[ "$poweroffChoice" =~ ^[Yy]$ ]]; then
log_info "Powering off the installation media"
poweroff
log_warning "Poweroff command failed. To power off later, type: poweroff"
else
log "Leaving the installer. To power off later, type: poweroff"
fi
else
read -rp "Press Enter to exit..." read -rp "Press Enter to exit..."
fi
exit "$finalExitCode" exit "$finalExitCode"
-1
View File
@@ -1 +0,0 @@
sas.sh
-582
View File
@@ -1,582 +0,0 @@
#!/usr/bin/env python3
import os
import re
import secrets
import signal
import string
import subprocess
import sys
import tempfile
import time
import pwd
import threading
stormuxAdmin = ("storm",)
ircServer = "irc.stormux.org"
ircPort = 6667
ircChannel = "#stormux"
remoteHost = "billysballoons.com"
sasUser = "sas"
pingIntervalSeconds = 180
pingCount = 5
maxWormholeFailures = 3
sudoKeepaliveThread = None
sudoKeepaliveStop = threading.Event()
def speak_message(message):
try:
subprocess.run(["spd-say", message], check=False)
except FileNotFoundError:
print(message, flush=True)
def say_or_print(message, useSpeech):
if useSpeech:
speak_message(message)
else:
print(message, flush=True)
def run_command(command, inputText=None, check=False, env=None):
return subprocess.run(
command,
input=inputText,
text=True,
capture_output=True,
check=check,
env=env,
)
def ensure_sudo(useSpeech):
if os.geteuid() == 0:
return True
if useSpeech:
speak_message("Sudo password required. Please enter your password now.")
result = run_command(["sudo", "-v"])
if result.returncode == 0:
start_sudo_keepalive()
return True
return False
def start_sudo_keepalive():
global sudoKeepaliveThread
if sudoKeepaliveThread and sudoKeepaliveThread.is_alive():
return
def keepalive_loop():
while not sudoKeepaliveStop.wait(240):
run_command(["sudo", "-n", "-v"])
sudoKeepaliveThread = threading.Thread(target=keepalive_loop, daemon=True)
sudoKeepaliveThread.start()
def run_privileged(command, useSpeech, inputText=None, check=True):
if os.geteuid() == 0:
fullCommand = command
else:
if not ensure_sudo(useSpeech):
raise RuntimeError("sudo authentication failed")
fullCommand = ["sudo"] + command
return run_command(fullCommand, inputText=inputText, check=check)
def run_as_user(userName, command, useSpeech, check=True):
if os.geteuid() == 0:
fullCommand = ["sudo", "-u", userName, "-H"] + command
else:
if not ensure_sudo(useSpeech):
raise RuntimeError("sudo authentication failed")
fullCommand = ["sudo", "-u", userName, "-H"] + command
return run_command(fullCommand, check=check)
def user_exists(userName):
result = run_command(["getent", "passwd", userName])
return result.returncode == 0
def ensure_wheel(userName, useSpeech):
result = run_command(["id", "-nG", userName])
groups = result.stdout.strip().split()
if "wheel" not in groups:
run_privileged(["usermod", "-a", "-G", "wheel", userName], useSpeech)
def generate_password():
allowedChars = string.ascii_letters + string.digits
length = secrets.randbelow(5) + 6
return "".join(secrets.choice(allowedChars) for _ in range(length))
def get_user_home(userName):
return pwd.getpwnam(userName).pw_dir
def set_password(userName, password, useSpeech):
run_privileged(["chpasswd"], useSpeech, inputText=f"{userName}:{password}\n")
def generate_ssh_key(userName, useSpeech):
userHome = get_user_home(userName)
sshDir = os.path.join(userHome, ".ssh")
privateKeyPath = os.path.join(sshDir, "id_ed25519")
publicKeyPath = f"{privateKeyPath}.pub"
run_privileged(["mkdir", "-p", sshDir], useSpeech)
run_privileged(["chown", f"{userName}:{userName}", sshDir], useSpeech)
run_privileged(["chmod", "700", sshDir], useSpeech)
for entry in list_subdirs(sshDir):
if os.path.isfile(entry) or os.path.islink(entry):
run_privileged(["rm", "-f", entry], useSpeech, check=False)
run_as_user(
userName,
["ssh-keygen", "-t", "ed25519", "-N", "", "-f", privateKeyPath],
useSpeech,
)
run_privileged(["chmod", "600", privateKeyPath], useSpeech)
run_privileged(["chmod", "644", publicKeyPath], useSpeech)
run_privileged(["chown", f"{userName}:{userName}", privateKeyPath, publicKeyPath], useSpeech)
return privateKeyPath, publicKeyPath
def path_exists_for_user(path, userName, useSpeech):
result = run_as_user(userName, ["stat", path], useSpeech, check=False)
return result.returncode == 0
def extract_message_text(line):
if "> " in line:
return line.split("> ", 1)[1].strip()
if ": " in line:
return line.split(": ", 1)[1].strip()
return line.strip()
def parse_sender(line):
match = re.search(r"<([^>]+)>", line)
if match:
return match.group(1)
return None
def find_wormhole_code(message):
lowered = message.strip().lower()
if lowered in ("yes", "accept"):
return None
match = re.search(r"\b\d+-[A-Za-z0-9-]+\b", message)
if match:
return match.group(0)
return None
class IrcSession:
def __init__(self, server, port, nick, channel, baseDir):
self.server = server
self.port = port
self.nick = nick
self.channel = channel
self.baseDir = baseDir
self.serverDir = None
self.serverInPath = None
self.channelInPath = None
self.iiProcess = None
self.pmOffsets = {}
def start(self):
if not shutil_which("ii"):
raise RuntimeError("ii is not installed")
supportsI = ii_supports_i()
processEnv = os.environ.copy()
iiCommand = ["ii", "-s", self.server, "-p", str(self.port), "-n", self.nick]
if supportsI:
iiCommand += ["-i", self.baseDir]
else:
processEnv["HOME"] = self.baseDir
self.iiProcess = subprocess.Popen(
iiCommand,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
env=processEnv,
)
self.serverDir = self.wait_for_server_dir()
self.serverInPath = os.path.join(self.serverDir, "in")
def stop(self):
if self.channelInPath and os.path.exists(self.channelInPath):
try:
self.write_line(self.channelInPath, f"/part {self.channel}")
except OSError:
pass
if self.serverInPath and os.path.exists(self.serverInPath):
try:
self.write_line(self.serverInPath, "/quit")
except OSError:
pass
if self.iiProcess and self.iiProcess.poll() is None:
self.iiProcess.terminate()
try:
self.iiProcess.wait(timeout=5)
except subprocess.TimeoutExpired:
self.iiProcess.kill()
def join_channel(self):
joinMessage = f"/join {self.channel}"
channelDir = os.path.join(self.serverDir, self.channel)
channelAltDir = os.path.join(self.serverDir, self.channel.lstrip("#"))
startTime = time.monotonic()
nextJoinTime = startTime
while time.monotonic() - startTime < 60:
if time.monotonic() >= nextJoinTime:
self.write_line(self.serverInPath, joinMessage)
nextJoinTime = time.monotonic() + 5
for candidate in (channelDir, channelAltDir):
inPath = os.path.join(candidate, "in")
if os.path.exists(inPath):
self.channelInPath = inPath
return
time.sleep(0.5)
self.channelInPath = None
def send_channel_message(self, message):
if not self.channelInPath:
self.refresh_channel_in_path()
if self.channelInPath and os.path.exists(self.channelInPath):
self.write_line(self.channelInPath, message)
else:
self.write_line(self.serverInPath, f"/msg {self.channel} {message}")
def send_private_message(self, nick, message):
nickDir = os.path.join(self.serverDir, nick)
inPath = os.path.join(nickDir, "in")
if os.path.exists(inPath):
self.write_line(inPath, message)
else:
self.write_line(self.serverInPath, f"/msg {nick} {message}")
def get_private_messages(self, allowedUsers):
messages = []
for nick in allowedUsers:
nickDir = os.path.join(self.serverDir, nick)
outPath = os.path.join(nickDir, "out")
if not os.path.exists(outPath):
continue
lastPos = self.pmOffsets.get(outPath, 0)
with open(outPath, "r", encoding="utf-8", errors="ignore") as fileHandle:
fileHandle.seek(lastPos)
for line in fileHandle:
sender = parse_sender(line)
if sender and sender == self.nick:
continue
if sender and sender != nick:
continue
messageText = extract_message_text(line)
if messageText:
messages.append((nick, messageText))
self.pmOffsets[outPath] = fileHandle.tell()
return messages
def refresh_channel_in_path(self):
channelDir = os.path.join(self.serverDir, self.channel)
channelAltDir = os.path.join(self.serverDir, self.channel.lstrip("#"))
for candidate in (channelDir, channelAltDir):
inPath = os.path.join(candidate, "in")
if os.path.exists(inPath):
self.channelInPath = inPath
return
def wait_for_server_dir(self):
for _ in range(120):
for rootDir in [self.baseDir] + list_subdirs(self.baseDir):
if not os.path.isdir(rootDir):
continue
for entry in os.listdir(rootDir):
path = os.path.join(rootDir, entry)
if os.path.isdir(path) and self.server in entry:
inPath = os.path.join(path, "in")
if os.path.exists(inPath):
return path
time.sleep(0.5)
raise RuntimeError("ii server directory not found")
@staticmethod
def write_line(path, message):
with open(path, "w", encoding="utf-8", errors="ignore") as fileHandle:
fileHandle.write(message + "\n")
fileHandle.flush()
def ii_supports_i():
result = run_command(["ii", "-h"])
output = (result.stdout or "") + (result.stderr or "")
return "-i" in output
def list_subdirs(path):
try:
return [os.path.join(path, entry) for entry in os.listdir(path)]
except OSError:
return []
def shutil_which(command):
for path in os.environ.get("PATH", "").split(os.pathsep):
candidate = os.path.join(path, command)
if os.path.isfile(candidate) and os.access(candidate, os.X_OK):
return candidate
return None
def build_nick():
baseUser = os.environ.get("SUDO_USER") or os.environ.get("USER") or "sas"
return f"{baseUser}-{int(time.time())}"
def main():
say_or_print("Checking accessibility. Is your screen reader working? (y/n)", True)
answer = input().strip().lower()
useSpeech = answer in ("n", "no")
shouldRemoveUser = False
cleanupDone = False
tempDir = tempfile.mkdtemp(prefix="sas-ii-")
ircSession = None
sshProcess = None
def cleanup(exitMessage=None):
nonlocal cleanupDone
if cleanupDone:
return
cleanupDone = True
nonlocal sshProcess
if exitMessage:
say_or_print(exitMessage, useSpeech)
if sshProcess and sshProcess.poll() is None:
sshProcess.terminate()
try:
sshProcess.wait(timeout=5)
except subprocess.TimeoutExpired:
sshProcess.kill()
if ircSession:
ircSession.stop()
if shouldRemoveUser:
try:
run_privileged(["pkill", "-u", sasUser], useSpeech, check=False)
time.sleep(1)
result = run_privileged(["userdel", "-r", sasUser], useSpeech, check=False)
run_privileged(["rm", "-rf", f"/home/{sasUser}"], useSpeech, check=False)
if result.returncode != 0 and user_exists(sasUser):
say_or_print(
"Cleanup warning: failed to remove sas user. Please remove it manually.",
useSpeech,
)
except Exception:
pass
sudoKeepaliveStop.set()
if sudoKeepaliveThread:
sudoKeepaliveThread.join(timeout=2)
try:
remove_tree(tempDir)
except Exception:
pass
def handle_signal(signum, frame):
cleanup("Interrupted. Cleaning up.")
sys.exit(1)
signal.signal(signal.SIGINT, handle_signal)
signal.signal(signal.SIGTERM, handle_signal)
try:
if not user_exists(sasUser):
run_privileged(
["useradd", "-m", "-d", f"/home/{sasUser}", "-s", "/bin/bash", "-G", "wheel", sasUser],
useSpeech,
)
shouldRemoveUser = True
else:
say_or_print(
"User 'sas' exists. Remove and recreate it? This will delete /home/sas. (y/n)",
useSpeech,
)
response = input().strip().lower()
if response not in ("y", "yes"):
cleanup("The sas user is unavailable. Remove it manually and try again.")
return 1
run_privileged(["pkill", "-u", sasUser], useSpeech, check=False)
run_privileged(["userdel", "-r", sasUser], useSpeech, check=False)
run_privileged(["rm", "-rf", f"/home/{sasUser}"], useSpeech, check=False)
run_privileged(
["useradd", "-m", "-d", f"/home/{sasUser}", "-s", "/bin/bash", "-G", "wheel", sasUser],
useSpeech,
)
shouldRemoveUser = True
ensure_wheel(sasUser, useSpeech)
password = generate_password()
set_password(sasUser, password, useSpeech)
privateKeyPath, publicKeyPath = generate_ssh_key(sasUser, useSpeech)
sasHome = get_user_home(sasUser)
knownHostsPath = os.path.join(sasHome, ".ssh", "known_hosts_sas")
run_privileged(["touch", knownHostsPath], useSpeech)
run_privileged(["chmod", "600", knownHostsPath], useSpeech)
run_privileged(["chown", f"{sasUser}:{sasUser}", knownHostsPath], useSpeech)
nick = build_nick()
ircSession = IrcSession(ircServer, ircPort, nick, ircChannel, tempDir)
ircSession.start()
ircSession.join_channel()
say_or_print("Waiting for assistance on IRC.", useSpeech)
startTime = time.monotonic()
nextPingTime = startTime
pingsSent = 0
confirmedAdmin = None
while time.monotonic() - startTime < pingIntervalSeconds * pingCount:
now = time.monotonic()
if pingsSent < pingCount and now >= nextPingTime:
ircSession.send_channel_message(f"{nick} is requesting assistance.")
pingsSent += 1
nextPingTime = startTime + (pingsSent * pingIntervalSeconds)
for adminNick, messageText in ircSession.get_private_messages(stormuxAdmin):
if messageText.strip().lower() in ("yes", "accept"):
confirmedAdmin = adminNick
break
if confirmedAdmin:
break
time.sleep(1)
if not confirmedAdmin:
cleanup("No one was available to help, please try again later.")
return 1
ircSession.send_private_message(
confirmedAdmin,
f'password: "{password}" please send wormhole ssh invite code',
)
failures = 0
while failures < maxWormholeFailures:
inviteCode = None
while inviteCode is None:
for adminNick, messageText in ircSession.get_private_messages(stormuxAdmin):
inviteCode = find_wormhole_code(messageText)
if inviteCode:
break
if inviteCode:
break
time.sleep(1)
if not path_exists_for_user(publicKeyPath, sasUser, useSpeech):
raise RuntimeError(f"Public key missing: {publicKeyPath}")
wormholeCommand = [
"wormhole",
"ssh",
"accept",
"--yes",
inviteCode,
]
result = run_as_user(sasUser, wormholeCommand, useSpeech, check=False)
if result.returncode == 0:
say_or_print("Wormhole key transfer succeeded.", useSpeech)
break
failures += 1
errorTextFull = (result.stderr or result.stdout or "").strip()
if errorTextFull and not useSpeech:
print("Wormhole ssh accept error:", flush=True)
print(errorTextFull, flush=True)
errorText = errorTextFull
if errorText:
errorText = " ".join(errorText.split())
if len(errorText) > 400:
errorText = errorText[:400] + "..."
ircSession.send_private_message(
confirmedAdmin,
f"Wormhole ssh accept failed: {errorText}",
)
ircSession.send_private_message(
confirmedAdmin,
"Wormhole ssh accept failed. Please send a new invite code.",
)
if failures >= maxWormholeFailures:
cleanup("Wormhole failed too many times. Exiting.")
return 1
say_or_print("Starting reverse SSH tunnel. Press Ctrl+C to stop.", useSpeech)
sshCommand = [
"ssh",
"-N",
"-R",
"localhost:2232:localhost:22",
"-o",
"ExitOnForwardFailure=yes",
"-o",
"BatchMode=yes",
"-o",
"ServerAliveInterval=30",
"-o",
"ServerAliveCountMax=3",
"-o",
"StrictHostKeyChecking=accept-new",
"-o",
f"UserKnownHostsFile={knownHostsPath}",
"-i",
privateKeyPath,
f"{sasUser}@{remoteHost}",
]
sshCommand = ["sudo", "-u", sasUser, "-H"] + sshCommand
sshProcess = subprocess.Popen(sshCommand)
sshProcess.wait()
except Exception as exc:
cleanup(f"Error: {exc}")
return 1
finally:
cleanup()
return 0
def remove_tree(path):
if not os.path.exists(path):
return
for rootDir, dirNames, fileNames in os.walk(path, topdown=False):
for fileName in fileNames:
try:
os.unlink(os.path.join(rootDir, fileName))
except OSError:
pass
for dirName in dirNames:
try:
os.rmdir(os.path.join(rootDir, dirName))
except OSError:
pass
try:
os.rmdir(path)
except OSError:
pass
if __name__ == "__main__":
sys.exit(main())
@@ -13,6 +13,8 @@ if [ -d /etc/skel.custom ]; then
fi fi
# Set the distribution name # Set the distribution name
# /etc/issue interprets these escapes when getty displays it.
# shellcheck disable=SC2028
echo 'Stormux \r (\l)' > /etc/issue echo 'Stormux \r (\l)' > /etc/issue
echo >> /etc/issue echo >> /etc/issue
@@ -54,9 +56,10 @@ echo stormux > /etc/hostname
systemctl disable systemd-networkd.service systemd-networkd.socket 2>/dev/null || true systemctl disable systemd-networkd.service systemd-networkd.socket 2>/dev/null || true
# Enable services # Enable services
# The first-login setup starts Fenrir after volume, voice, and layout selection.
systemctl disable fenrirscreenreader.service stormux-speech.service
services=( services=(
brltty.path brltty.path
fenrirscreenreader.service
NetworkManager.service NetworkManager.service
stormux-audio-setup.service stormux-audio-setup.service
) )
+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())
+334
View File
@@ -0,0 +1,334 @@
#!/usr/bin/env bash
set -u
speechConfig="${STORMUX_SPEECH_CONFIG:-/etc/speech-dispatcher/speechd.conf}"
selectionFile=""
spdSayCommand="${STORMUX_SPD_SAY:-spd-say}"
systemctlCommand="${STORMUX_SYSTEMCTL:-systemctl}"
socatCommand="${STORMUX_SOCAT:-socat}"
fenrirSocket="${STORMUX_FENRIR_SOCKET:-/tmp/fenrirscreenreader-daemon.sock}"
scriptPath="$(readlink -f "$0")"
runtimeDir="${STORMUX_RUNTIME_DIR:-/run/stormux}"
fenrirSpeechMuted=false
is_safe_module() {
[[ "$1" =~ ^[A-Za-z0-9][A-Za-z0-9_.-]*$ ]]
}
apply_module() {
local moduleName="$1"
local configPath="$2"
local backupPath="$3"
local tempPath
is_safe_module "$moduleName" || return 1
[[ -f "$configPath" ]] || return 1
mkdir -p "${backupPath%/*}" || return 1
cp --preserve=mode,ownership,timestamps "$configPath" "$backupPath" || return 1
tempPath="$(mktemp "${configPath}.stormux.XXXXXX")" || return 1
if ! awk -v moduleName="$moduleName" '
BEGIN { wroteDefault = 0 }
/^[[:space:]]*#?[[:space:]]*DefaultModule[[:space:]]+/ {
if (!wroteDefault) {
print "DefaultModule " moduleName
wroteDefault = 1
}
next
}
{ print }
END {
if (!wroteDefault) {
print ""
print "DefaultModule " moduleName
}
}
' "$configPath" > "$tempPath"; then
rm -f "$tempPath"
return 1
fi
chown --reference="$configPath" "$tempPath" || {
rm -f "$tempPath"
return 1
}
chmod --reference="$configPath" "$tempPath" || {
rm -f "$tempPath"
return 1
}
mv -f "$tempPath" "$configPath"
}
restore_config() {
local configPath="$1"
local backupPath="$2"
local tempPath
[[ -f "$backupPath" ]] || return 1
tempPath="$(mktemp "${configPath}.stormux.XXXXXX")" || return 1
if ! cp --preserve=mode,ownership,timestamps "$backupPath" "$tempPath"; then
rm -f "$tempPath"
return 1
fi
mv -f "$tempPath" "$configPath" || return 1
rm -f "$backupPath"
}
write_selection() {
local moduleName="$1"
local targetPath="$2"
local tempPath
is_safe_module "$moduleName" || return 1
mkdir -p "${targetPath%/*}" || return 1
tempPath="$(mktemp "${targetPath}.stormux.XXXXXX")" || return 1
printf '%s\n' "$moduleName" > "$tempPath" || {
rm -f "$tempPath"
return 1
}
chmod 644 "$tempPath" || {
rm -f "$tempPath"
return 1
}
mv -f "$tempPath" "$targetPath"
}
case "${1:-}" in
--apply-module)
[[ $# -eq 4 ]] || exit 2
apply_module "$2" "$3" "$4"
exit $?
;;
--restore-config)
[[ $# -eq 3 ]] || exit 2
restore_config "$2" "$3"
exit $?
;;
--write-selection)
[[ $# -eq 3 ]] || exit 2
write_selection "$2" "$3"
exit $?
;;
esac
while [[ $# -gt 0 ]]; do
case "$1" in
--config)
[[ $# -ge 2 ]] || exit 2
speechConfig="$2"
shift 2
;;
--selection-file)
[[ $# -ge 2 ]] || exit 2
selectionFile="$2"
shift 2
;;
*)
printf 'Unknown option: %s\n' "$1" >&2
exit 2
;;
esac
done
sudoCommand=(sudo)
if [[ -n "${SUDO_ASKPASS:-}" ]]; then
sudoCommand+=(-A)
fi
announce_failure() {
local previousModule="$1"
local message="Speech engine selection failed. Your previous speech engine is still selected."
"$spdSayCommand" -C >/dev/null 2>&1 || true
if is_safe_module "$previousModule"; then
"$spdSayCommand" -o "$previousModule" "$message" >/dev/null 2>&1 || \
"$spdSayCommand" "$message" >/dev/null 2>&1 || true
else
"$spdSayCommand" "$message" >/dev/null 2>&1 || true
fi
printf '%s\n' "$message" >&2
}
set_fenrir_speech() {
local enabled="$1"
printf 'setting set speech#enabled=%s\n' "$enabled" | \
"$socatCommand" - UNIX-CLIENT:"$fenrirSocket" >/dev/null 2>&1
}
mute_fenrir_speech() {
if "$systemctlCommand" is-active --quiet fenrirscreenreader.service 2>/dev/null && \
set_fenrir_speech False; then
fenrirSpeechMuted=true
fi
}
restore_fenrir_speech() {
if [[ "$fenrirSpeechMuted" == true ]]; then
set_fenrir_speech True || true
fenrirSpeechMuted=false
fi
}
trap restore_fenrir_speech EXIT
trap 'exit 130' HUP INT TERM
discover_modules() {
local output line candidate
local skippedHeading=false
if ! output="$("$spdSayCommand" -O 2>/dev/null)"; then
return 1
fi
modules=()
while IFS= read -r line; do
candidate="${line%$'\r'}"
candidate="${candidate#"${candidate%%[![:space:]]*}"}"
candidate="${candidate%"${candidate##*[![:space:]]}"}"
[[ -n "$candidate" ]] || continue
if [[ "$skippedHeading" == false ]]; then
skippedHeading=true
continue
fi
is_safe_module "$candidate" || continue
modules+=("$candidate")
done <<< "$output"
[[ ${#modules[@]} -gt 0 ]]
}
configured_module() {
local configured=""
if [[ -r "$speechConfig" ]]; then
configured="$(awk '$1 == "DefaultModule" { print $2; exit }' "$speechConfig")"
fi
if ! is_safe_module "$configured"; then
configured="rhvoice"
fi
printf '%s\n' "$configured"
}
module_index() {
local wanted="$1"
local index
for index in "${!modules[@]}"; do
if [[ "${modules[$index]}" == "$wanted" ]]; then
printf '%s\n' "$index"
return 0
fi
done
return 1
}
draw_menu() {
local index
printf '\033[H\033[2J'
printf 'Select the default speech engine. Use Up and Down, Enter to select, or Escape to keep the current engine.\n\n'
for index in "${!modules[@]}"; do
if [[ $index -eq $selectedIndex ]]; then
printf '> %s\n' "${modules[$index]}"
else
printf ' %s\n' "${modules[$index]}"
fi
done
}
read_menu_key() {
local first rest=""
IFS= read -rsn1 first || return 1
if [[ -z "$first" ]]; then
printf 'enter\n'
return 0
fi
if [[ "$first" == $'\033' ]]; then
IFS= read -rsn2 -t 0.1 rest || true
case "$rest" in
'[A') printf 'up\n' ;;
'[B') printf 'down\n' ;;
'') printf 'escape\n' ;;
*) printf 'other\n' ;;
esac
return 0
fi
printf 'other\n'
}
declare -a modules=()
previousModule="$(configured_module)"
mute_fenrir_speech
if ! discover_modules; then
announce_failure "$previousModule"
exit 0
fi
if ! selectedIndex="$(module_index "$previousModule")"; then
if selectedIndex="$(module_index rhvoice)"; then
:
else
selectedIndex=0
fi
fi
draw_menu
"$spdSayCommand" "Use up and down arrows to select the default voice for this computer. ${modules[$selectedIndex]} is highlighted. Press Enter to select, or Escape to keep the current voice." >/dev/null 2>&1 || true
while true; do
if ! keyName="$(read_menu_key)"; then
announce_failure "$previousModule"
exit 0
fi
case "$keyName" in
up)
selectedIndex=$(( (selectedIndex - 1 + ${#modules[@]}) % ${#modules[@]} ))
;;
down)
selectedIndex=$(( (selectedIndex + 1) % ${#modules[@]} ))
;;
enter)
break
;;
escape)
"$spdSayCommand" -C >/dev/null 2>&1 || true
"$spdSayCommand" -o "$previousModule" "Keeping ${previousModule} as the default speech engine." >/dev/null 2>&1 || true
exit 0
;;
*)
continue
;;
esac
draw_menu
moduleName="${modules[$selectedIndex]}"
"$spdSayCommand" -C >/dev/null 2>&1 || true
"$spdSayCommand" -o "$moduleName" "This is ${moduleName}. If selected, I will be your default text-to-speech voice." >/dev/null 2>&1 || true
done
selectedModule="${modules[$selectedIndex]}"
backupFile="${runtimeDir}/speechd.conf.$$.backup"
"$spdSayCommand" -C >/dev/null 2>&1 || true
if ! "${sudoCommand[@]}" "$scriptPath" --apply-module "$selectedModule" "$speechConfig" "$backupFile"; then
"${sudoCommand[@]}" "$scriptPath" --restore-config "$speechConfig" "$backupFile" >/dev/null 2>&1 || true
announce_failure "$previousModule"
exit 0
fi
if [[ -n "$selectionFile" ]]; then
if ! "${sudoCommand[@]}" "$scriptPath" --write-selection "$selectedModule" "$selectionFile"; then
"${sudoCommand[@]}" "$scriptPath" --restore-config "$speechConfig" "$backupFile" >/dev/null 2>&1 || true
announce_failure "$previousModule"
exit 0
fi
fi
rm -f "$backupFile" 2>/dev/null || "${sudoCommand[@]}" rm -f "$backupFile" 2>/dev/null || true
"$spdSayCommand" -o "$selectedModule" "${selectedModule} is now the default speech engine." >/dev/null 2>&1 || true
printf 'Default speech engine set to %s.\n' "$selectedModule"
@@ -4,7 +4,7 @@
# Monitors SSH logins and announces them via Fenrir's speech system # Monitors SSH logins and announces them via Fenrir's speech system
# Configuration # Configuration
fenrirSocket="/tmp/fenrirscreenreader-deamon.sock" fenrirSocket="/tmp/fenrirscreenreader-daemon.sock"
logFile="/var/log/auth.log" logFile="/var/log/auth.log"
stateFile="/tmp/fenrir-ssh-monitor.state" stateFile="/tmp/fenrir-ssh-monitor.state"
checkInterval=2 # seconds between checks checkInterval=2 # seconds between checks
-33
View File
@@ -1,33 +0,0 @@
#!/usr/bin/env bash
# Fix live ISO services for x86_64
set -e
cd "$(dirname "$0")"
echo "=== Fixing Live ISO Services for x86_64 ==="
echo
# 1. Remove Pi-specific first boot script
if [ -f airootfs/etc/profile.d/stormux_first_boot.sh ]; then
echo "Removing Pi-specific first boot script..."
sudo rm airootfs/etc/profile.d/stormux_first_boot.sh
fi
# 2. Mask systemd-firstboot (blocks boot with interactive prompts)
echo "Masking systemd-firstboot.service..."
sudo ln -sf /dev/null airootfs/etc/systemd/system/systemd-firstboot.service
# 3. Install Fenrir audio configurations
echo "Installing Fenrir audio configurations..."
sudo ./setup-fenrir-audio-configs.sh
# 4. Check/verify enabled services
echo
echo "=== Enabled Services ==="
ls -la airootfs/etc/systemd/system/multi-user.target.wants/ | grep -E "fenrir|speech|audio" || echo "No speech/audio services in multi-user.target.wants"
ls -la airootfs/etc/systemd/system/sound.target.wants/ | grep -E "audio|sound" || echo "No services in sound.target.wants"
echo
echo "=== Configuration Complete ==="
echo "Next step: sudo ./build.sh -v"
-10
View File
@@ -1,10 +0,0 @@
#!/usr/bin/env bash
# Mask systemd-firstboot for live ISO (it blocks boot)
cd airootfs/etc/systemd/system
# Create mask symlink
ln -sf /dev/null systemd-firstboot.service
echo "Masked systemd-firstboot.service"
ls -la systemd-firstboot.service
+5 -1
View File
@@ -13,11 +13,12 @@ bluez
bluez-utils bluez-utils
bolt bolt
brltty brltty
broadcom-wl broadcom-wl-dkms
btrfs-progs btrfs-progs
clonezilla clonezilla
cloud-init cloud-init
cryptsetup cryptsetup
curl
darkhttpd darkhttpd
ddrescue ddrescue
dhcpcd dhcpcd
@@ -58,6 +59,7 @@ lftp
libfido2 libfido2
libusb-compat libusb-compat
linux linux
linux-headers
linux-atm linux-atm
linux-firmware linux-firmware
linux-firmware-marvell linux-firmware-marvell
@@ -89,6 +91,7 @@ nvme-cli
open-iscsi open-iscsi
open-vm-tools open-vm-tools
openconnect openconnect
openevv-git
openpgp-card-tools openpgp-card-tools
openssh openssh
openvpn openvpn
@@ -105,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
+4
View File
@@ -76,6 +76,10 @@ LocalFileSigLevel = Optional
#[core-testing] #[core-testing]
#Include = /etc/pacman.d/mirrorlist #Include = /etc/pacman.d/mirrorlist
[xlibre-stable]
SigLevel = Required DatabaseOptional
Server = https://packages.xlibre.net/arch/stable/$arch
[stormux] [stormux]
SigLevel = Required DatabaseOptional SigLevel = Required DatabaseOptional
Server = https://packages.stormux.org/$arch Server = https://packages.stormux.org/$arch
+2 -6
View File
@@ -18,20 +18,16 @@ bootstrap_tarball_compression=('zstd' '-c' '-T0' '--auto-threads=logical' '--lon
file_permissions=( file_permissions=(
["/etc/shadow"]="0:0:400" ["/etc/shadow"]="0:0:400"
["/root"]="0:0:750" ["/root"]="0:0:750"
["/root/.automated_script.sh"]="0:0:755"
["/usr/local/bin/sas"]="0:0:755"
["/root/customize_airootfs.sh"]="0:0:755" ["/root/customize_airootfs.sh"]="0:0:755"
["/root/.gnupg"]="0:0:700" ["/root/.gnupg"]="0:0:700"
["/root/.config"]="0:0:700" ["/root/.config"]="0:0:700"
["/usr/local/bin/choose-mirror"]="0:0:755"
["/usr/local/bin/Installation_guide"]="0:0:755"
["/usr/local/bin/livecd-sound"]="0:0:755" ["/usr/local/bin/livecd-sound"]="0:0:755"
["/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/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/local/bin/sas.sh"]="0:0:755"
["/usr/local/bin/sas"]="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"
["/etc/stormux-assist"]="0:0:755" ["/etc/stormux-assist"]="0:0:755"
["/etc/stormux-assist/client.conf"]="0:0:644" ["/etc/stormux-assist/client.conf"]="0:0:644"
+25
View File
@@ -21,6 +21,29 @@
set -e set -e
checkDependencies() {
local missingCommands=()
local command
for command in qemu-system-x86_64 qemu-img date dirname find sort head cut mkdir; do
if ! command -v "$command" &> /dev/null; then
missingCommands+=("$command")
fi
done
if (( ${#missingCommands[@]} > 0 )); then
echo "Error: Missing required commands:"
printf ' %s\n' "${missingCommands[@]}"
echo
echo "On Arch Linux, install the required packages with:"
echo " sudo pacman -S qemu-system-x86 qemu-img qemu-ui-gtk qemu-audio-pa coreutils findutils"
exit 1
fi
}
# make sure we are in a GUI
DISPLAY="${DISPLAY:-:0}"
# Parse command line arguments # Parse command line arguments
bootInstalled=false bootInstalled=false
while getopts "ih" opt; do while getopts "ih" opt; do
@@ -44,6 +67,8 @@ while getopts "ih" opt; do
esac esac
done done
checkDependencies
# Get the directory where this script is located # Get the directory where this script is located
scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
outDir="${scriptDir}/out" outDir="${scriptDir}/out"