Files
os/image/mkosi.postinst.chroot
Tamas Csikel 9c710bedb9 Fennec OS 0.3.2: one app at a time, Raspberry Pi shell packages
- sf-core: only one app runs. Home, another app or a cast closes the app
  on screen (after the switch animation) instead of freezing it in the
  background. A frozen app that held a sound stream stalled PipeWire, so
  the next app could not play at all ("Failed to connect stream: No such
  entity" in Netflex after YouTube was sent home mid-video). The
  background limit and the low-memory watcher go with the freezing.
- Raspberry Pi: image/pi (installer on Raspberry Pi OS), aarch64 shell
  packages (sf-shell-<v>-aarch64, arch in pkg.toml, sf-update installs only
  its own architecture), CI builds the aarch64 shell too.
- sf-compositor: volume OSD, screencopy for remote view, blank cursor.
- SDK v0.1.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 19:38:09 +01:00

75 lines
3.4 KiB
Bash

#!/bin/sh
# Runs inside the image after packages and extra trees are installed.
set -e
# Homes live on the writable data partition (/var); root is read-only.
if [ ! -L /home ]; then
mkdir -p /var/home
cp -a /home/. /var/home/ 2>/dev/null || true
rm -rf /home
ln -s var/home /home
fi
# The TV user (uid 1000): auto-login on tty1 starts the Fennec OS session.
if ! id tv >/dev/null 2>&1; then
useradd -m -d /var/home/tv -u 1000 -s /bin/bash -G video,render,input,audio,bluetooth tv
fi
# Wi-Fi settings: iwd's D-Bus policy lets the netdev group manage networks.
getent group netdev >/dev/null || groupadd -r netdev
usermod -aG netdev tv
# Steam support (the Steam app is a store app: fennec/steam). The client is
# 32-bit: Valve's metapackages pull in the i386 graphics and system libraries
# it needs. The controller udev rules (uinput, Steam Controller, DualSense...)
# come from Valve's steam-launcher package, without installing the launcher.
if [ -f /usr/share/keyrings/valve-archive-keyring.gpg ]; then
dpkg --add-architecture i386
cat >/etc/apt/sources.list.d/steam.sources <<'EOF'
Types: deb
URIs: https://repo.steampowered.com/steam/
Suites: stable
Components: steam
Architectures: amd64 i386
Signed-By: /usr/share/keyrings/valve-archive-keyring.gpg
EOF
apt-get update -q
DEBIAN_FRONTEND=noninteractive apt-get install -y -q --no-install-recommends steam-libs-amd64 steam-libs-i386:i386 mesa-vulkan-drivers:i386 libvulkan1:i386
t=$(mktemp -d)
(cd "$t" && apt-get download -q steam-launcher && dpkg-deb -x steam-launcher_*.deb x)
install -m644 "$t"/x/lib/udev/rules.d/*.rules /usr/lib/udev/rules.d/
rm -rf "$t"
apt-get clean
fi
systemctl enable systemd-networkd systemd-resolved iwd bluetooth sf-remote.service sf-data-init.service sf-remote-debug-boot.service sf-remote-debug.path sf-update-apply.service sf-update-requests.path sf-update-auto.timer
# sshd only runs when remote debugging is on (Settings > System, sf-remote-debug).
systemctl disable ssh.service ssh.socket 2>/dev/null || true
systemctl set-default multi-user.target
# No interactive first-boot questions on a TV (locale, timezone, etc. come from mkosi.conf).
systemctl mask systemd-firstboot.service
# Root is read-only and stays its built size; the data partition takes the rest.
systemctl mask systemd-growfs-root.service
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf || true
# Invisible mouse cursor (the TV has no mouse).
python3 /usr/lib/smartfox/blank-cursor.py
chmod +x /usr/bin/sf-session /usr/bin/sf-pair /usr/bin/sf-remote-debug /usr/bin/sf-diag /usr/bin/sf-shell-exec 2>/dev/null || true
# Factory store apps (docs/store.md): the Fennec catalog's apps, installed now
# so a new TV has them offline. Needs the catalog repos to be public.
install -d -o tv -g tv /var/lib/smartfox
install -o tv -g tv -m644 /usr/share/smartfox/factory-store.toml /var/lib/smartfox/store.toml
if ! sf-update store; then
echo "warning: the factory store apps could not be installed; the TV installs them once online" >&2
fi
rm -rf /var/lib/sf-pkg/.download
# Factory copy of /var: sf-data-init.service fills the empty data partition from it.
rm -rf /usr/share/factory/var
mkdir -p /usr/share/factory
cp -a /var /usr/share/factory/var
rm -rf /usr/share/factory/var/cache/apt/* /usr/share/factory/var/lib/apt/lists/* /usr/share/factory/var/log/*
mkdir -p /usr/share/factory/var/lib/bluetooth
chmod 700 /usr/share/factory/var/lib/bluetooth