Add Store support and unsigned app releases

This commit is contained in:
Tamas Csikel
2026-10-25 14:11:49 +01:00
parent 4975784491
commit d7e9fe4568
157 changed files with 22985 additions and 944 deletions

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Builds the SmartFox installer ISO (UEFI, x86-64) for a USB stick.
# Builds the Fennec OS installer ISO (UEFI, x86-64) for a USB stick.
# Run as root inside WSL Debian:
# sudo bash /mnt/g/source/smartfox/image/build-iso.sh
# Writes image/out/smartfox-installer.iso (in the source tree, so Rufus on
@@ -7,7 +7,7 @@
# Raw writers (Etcher, dd) work too: the ISO carries a GPT with an ESP holding
# the UKI, so UEFI firmware sees the stick as bootable.
#
# SKIP_BUILD=1 reuses the last SmartFox image instead of running build.sh.
# SKIP_BUILD=1 reuses the last Fennec OS image instead of running build.sh.
# Don't do that after booting it in run-qemu.sh: the VM writes into that file.
set -euo pipefail
@@ -43,7 +43,7 @@ rm -rf "$STAGE"
mkdir -p "$STAGE/tree/EFI/BOOT" "$STAGE/tree/smartfox"
cp "$UKI" "$STAGE/tree/EFI/BOOT/BOOTX64.EFI"
stat -c %s "$RAW" >"$STAGE/tree/smartfox/smartfox.size"
echo "SmartFox $(grep -m1 '^version' "$WORK/Cargo.toml" | cut -d'"' -f2) · $(date +%Y-%m-%d)" >"$STAGE/tree/smartfox/version"
echo "Fennec OS $(grep -m1 '^version' "$WORK/Cargo.toml" | cut -d'"' -f2) · $(date +%Y-%m-%d)" >"$STAGE/tree/smartfox/version"
zstd -T0 -10 -q "$RAW" -o "$STAGE/tree/smartfox/smartfox.raw.zst"
# Rufus puts the files on FAT32: no single file may reach 4 GiB.
[ "$(stat -c %s "$STAGE/tree/smartfox/smartfox.raw.zst")" -lt 4294967296 ] || { echo "payload too big for FAT32"; exit 1; }
@@ -59,7 +59,7 @@ echo "== iso"
ISO="$STAGE/smartfox-installer.iso"
xorriso -as mkisofs \
-iso-level 3 -full-iso9660-filenames -joliet -joliet-long -rational-rock \
-volid SMARTFOX -appid "SmartFox installer" \
-volid FENNEC_OS -appid "Fennec OS installer" \
-partition_offset 16 \
-append_partition 2 C12A7328-F81F-11D2-BA4B-00A0C93EC93B "$EFI_IMG" -appended_part_as_gpt \
-e --interval:appended_partition_2:all:: -no-emul-boot \

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Builds the SmartFox binaries and the OS disk image.
# Builds the Fennec OS binaries and the OS disk image.
# Run as root inside WSL Debian (or any Debian/Ubuntu host):
# sudo bash /mnt/g/source/smartfox/image/build.sh
set -euo pipefail
@@ -11,7 +11,7 @@ echo "== sync $SRC -> $WORK"
mkdir -p "$WORK"
# Files on NTFS show up as 0777; normalize, the image must not get world-writable files.
rsync -a --delete --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r \
--exclude /target --exclude /image/mkosi.output --exclude /image/mkosi.cache --exclude /image/stage --exclude /image/ovmf-vars.fd \
--exclude /target --exclude '*/target' --exclude /image/mkosi.output --exclude /image/mkosi.cache --exclude /image/stage --exclude /image/ovmf-vars.fd \
--exclude /image/installer/mkosi.output --exclude /image/installer/mkosi.cache --exclude /image/iso --exclude /image/out \
"$SRC/" "$WORK/"
cd "$WORK"
@@ -21,7 +21,7 @@ if ! command -v cargo >/dev/null; then
[ -x "$HOME/.cargo/bin/cargo" ] || curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
export PATH="$HOME/.cargo/bin:$PATH"
fi
cargo build --release -p sf-launcher -p sf-remote -p sf-update
cargo build --release -p sf-launcher -p sf-remote -p sf-update -p sf-core -p sf-miracast -p sf-compositor
echo "== stage"
STAGE="$WORK/image/stage"
@@ -30,6 +30,9 @@ install -Dm755 target/release/sf-launcher "$STAGE/usr/bin/sf-launcher"
install -Dm755 target/release/sf-remote "$STAGE/usr/bin/sf-remote"
install -Dm755 tools/siri-remote/fastpair.py "$STAGE/usr/bin/sf-pair"
install -Dm755 target/release/sf-update "$STAGE/usr/bin/sf-update"
for b in sf-core sf-miracast sf-compositor; do
install -Dm755 "target/release/$b" "$STAGE/usr/bin/$b"
done
# Registry login for sf-update (read:package only). Kept out of git; without it
# the TV can only update if the registry allows anonymous downloads.
if [ -f image/secrets/update-token ]; then
@@ -38,17 +41,37 @@ else
echo "warning: image/secrets/update-token is missing, sf-update will log in anonymously"
fi
mkdir -p "$STAGE/usr/share/smartfox"
cp -r apps "$STAGE/usr/share/smartfox/apps"
# Official apps only: a folder with its own .git is a store app developed in
# place (docs/store-app-guide.md), not part of the image.
mkdir -p "$STAGE/usr/share/smartfox/apps"
for d in apps/*/; do
[ -e "$d/.git" ] && continue
cp -r "$d" "$STAGE/usr/share/smartfox/apps/"
done
# Apps with a packaging hook (Steam: the official steam-launcher from Valve).
for hook in tools/pkg/*/package.sh; do
id=$(basename "$(dirname "$hook")")
[ -d "$STAGE/usr/share/smartfox/apps/$id" ] || continue
echo "== $id $(bash "$hook" "$STAGE/usr/share/smartfox/apps/$id" | tail -1)"
done
chmod -R a+x "$STAGE"/usr/share/smartfox/apps/*/bin 2>/dev/null || true
# Steam's controller rules (uinput, Steam Controller, DualSense...) and the
# key of Valve's repository (mkosi.postinst.chroot: the 32-bit libraries).
if [ -d "$STAGE/usr/share/smartfox/apps/steam/udev" ]; then
mkdir -p "$STAGE/usr/lib/udev/rules.d"
cp "$STAGE"/usr/share/smartfox/apps/steam/udev/*.rules "$STAGE/usr/lib/udev/rules.d/"
install -Dm644 tools/pkg/steam/valve-archive-keyring.gpg "$STAGE/usr/share/keyrings/valve-archive-keyring.gpg"
fi
# Versions of the factory copies: sf-update only installs newer packages.
{
echo "sf-shell = \"$(sed -n '/^\[workspace.package\]/,/^\[/ s/^version *= *"\(.*\)"/\1/p' Cargo.toml)\""
for d in apps/*/; do
for d in "$STAGE"/usr/share/smartfox/apps/*/; do
v=$(sed -n 's/^version *= *"\(.*\)".*/\1/p' "$d/app.toml" | head -1)
[ -n "$v" ] && echo "sf-app-$(basename "$d") = \"$v\""
done
} >"$STAGE/usr/share/smartfox/factory-versions.toml"
mkdir -p "$STAGE/usr/share/doc/smartfox"
cp docs/updates.md "$STAGE/usr/share/doc/smartfox/updates.md"
cp docs/updates.md docs/store.md "$STAGE/usr/share/doc/smartfox/"
chmod +x image/mkosi.postinst.chroot image/mkosi.extra/usr/bin/sf-session image/mkosi.extra/usr/bin/sf-launcher-start image/mkosi.extra/usr/bin/sf-remote-debug image/mkosi.extra/usr/bin/sf-diag image/mkosi.extra/usr/bin/sf-shell-exec image/*.sh tools/vm/*.sh tools/siri-remote/*.sh tools/siri-remote/*.py
echo "== mkosi"

View File

@@ -1,5 +1,5 @@
# SmartFox installer: a tiny Debian that runs entirely from RAM (packed as a
# UKI) and writes the SmartFox disk image from the install stick to a disk.
# Fennec OS installer: a tiny Debian that runs entirely from RAM (packed as a
# UKI) and writes the Fennec OS disk image from the install stick to a disk.
# Built by ../build-iso.sh; not meant to be built on its own.
[Distribution]

View File

@@ -1,5 +1,5 @@
#!/bin/bash
# SmartFox installer: writes the SmartFox disk image from the install stick
# Fennec OS installer: writes the Fennec OS disk image from the install stick
# onto an internal disk. The disk is wiped completely.
#
# The stick (written by Rufus in ISO mode, or dd) carries:
@@ -19,7 +19,7 @@ say() { printf '%s\n' "$*"; }
banner() {
clear
say ""
say " SmartFox telepítő"
say " Fennec OS telepítő"
say " ================="
say ""
}
@@ -101,7 +101,7 @@ banner
[ -n "$VERSION" ] && say " Verzió: $VERSION" && say ""
[ "${#DISKS[@]}" -gt 0 ] || die "Nincs olyan belső lemez, amire telepíteni lehetne (legalább $(human $((NEED + 1024 * 1024 * 1024))) kell)."
say " Melyik lemezre telepítsem a SmartFoxot?"
say " Melyik lemezre telepítsem a Fennec OS-t?"
say ""
for i in "${!DISKS[@]}"; do
say " $((i + 1))) $(describe "${DISKS[$i]}")"
@@ -161,14 +161,14 @@ fi
# Boot entry, so firmware that ignores the fallback path still finds it.
ESP=$(lsblk -rpno NAME,PARTN "$TARGET" | awk '$2 == 1 { print $1 }')
if [ -d /sys/firmware/efi/efivars ] && [ -n "$ESP" ]; then
efibootmgr -q -c -d "$TARGET" -p 1 -L SmartFox -l '\EFI\systemd\systemd-bootx64.efi' 2>/dev/null ||
efibootmgr -q -c -d "$TARGET" -p 1 -L "Fennec OS" -l '\EFI\systemd\systemd-bootx64.efi' 2>/dev/null ||
say " (A UEFI boot bejegyzés nem jött létre, a gép a tartalék útvonalról indul.)"
fi
sync
umount "$SRC" 2>/dev/null
banner
say " Kész! A SmartFox telepítve: $TARGET"
say " Kész! A Fennec OS telepítve: $TARGET"
say ""
say " Húzd ki a pendrive-ot, majd nyomj Entert az újraindításhoz."
say " Az első indításkor a rendszer létrehozza az adatpartíciót, ez néhány másodperc."

View File

@@ -1,5 +1,5 @@
[Unit]
Description=SmartFox installer
Description=Fennec OS installer
After=systemd-udevd.service systemd-udev-trigger.service
Conflicts=getty@tty1.service

View File

@@ -1,4 +1,4 @@
# SmartFox OS image (dev build). Build with image/build.sh inside WSL/Linux.
# Fennec OS image (dev build). Build with image/build.sh inside WSL/Linux.
[Distribution]
Distribution=debian
@@ -6,6 +6,11 @@ Release=trixie
Architecture=x86-64
Repositories=main,contrib,non-free,non-free-firmware
[Build]
# mkosi.postinst.chroot adds i386 and Valve's repository for Steam's 32-bit
# libraries (mkosi itself installs one architecture only).
WithNetwork=yes
[Output]
Format=disk
ImageId=smartfox
@@ -26,6 +31,7 @@ ExtraTrees=mkosi.extra
ExtraTrees=stage
Packages=
systemd
apt
systemd-sysv
systemd-boot
systemd-boot-efi
@@ -81,5 +87,26 @@ Packages=
pipewire
pipewire-pulse
wireplumber
libspa-0.2-bluetooth
pulseaudio-utils
avahi-daemon
uxplay
dbus-user-session
libpam-systemd
libseat1
libinput10
gstreamer1.0-tools
gstreamer1.0-plugins-base
gstreamer1.0-plugins-good
gstreamer1.0-plugins-bad
gstreamer1.0-libav
gstreamer1.0-pipewire
# TLS for GStreamer's HTTP source (HTTPS video streams, sf-ui video).
glib-networking
# App sandbox (sf_ipc::sandbox, docs/store.md).
bubblewrap
# Steam: gamescope hosts the X11 client and games; Vulkan for both.
gamescope/trixie-backports
mesa-vulkan-drivers
libvulkan1
xdg-user-dirs

View File

@@ -1,4 +1,4 @@
# Start the SmartFox session on the first console.
# Start the Fennec OS session on the first console.
if [ "$(tty)" = "/dev/tty1" ]; then
exec /usr/bin/sf-session
fi

View File

@@ -1,5 +1,6 @@
#!/bin/sh
# Runs inside cage: apply the output mode, then start the launcher.
# Runs inside the compositor (sf-compositor, or cage as a fallback): apply
# the output mode, start sf-core, then the launcher.
if [ -n "${SMARTFOX_MODE:-}" ]; then
OUT=$(wlr-randr | awk 'NR==1 {print $1}')
wlr-randr --output "$OUT" --custom-mode "$SMARTFOX_MODE" ||
@@ -31,4 +32,10 @@ if [ -x "$PKG/current/bin/sf-launcher" ]; then
rm -f "$TRIES"
fi
fi
exec "$LAUNCHER" --fullscreen --apps /usr/share/smartfox/apps --apps /var/lib/sf-pkg/apps
# sf-core starts and freezes apps, runs DIAL (YouTube cast) and the AirPlay /
# Miracast receivers. It quits by itself when this Wayland session ends.
pkill -u "$(id -u)" -x sf-core 2>/dev/null
# Store apps (sandboxed, docs/store.md): /var/lib/sf-pkg/store/apps.
/usr/bin/sf-shell-exec sf-core --apps /usr/share/smartfox/apps --apps /var/lib/sf-pkg/apps --store-apps /var/lib/sf-pkg/store/apps &
exec "$LAUNCHER" --fullscreen --apps /usr/share/smartfox/apps --apps /var/lib/sf-pkg/apps --store-apps /var/lib/sf-pkg/store/apps

View File

@@ -1,5 +1,5 @@
#!/bin/sh
# SmartFox session: kiosk compositor (cage) with the launcher.
# Fennec OS session: kiosk compositor (cage) with the launcher.
# Apps the launcher starts (Chromium etc.) appear full screen on top of it.
CONF="$HOME/.config/smartfox"
@@ -32,4 +32,15 @@ if [ -z "${SMARTFOX_MODE:-}" ] && systemd-detect-virt -q; then
fi
export SMARTFOX_MODE
# The compositor: sf-compositor (app switching, volume OSD). If it can't start
# (or crashes right away), fall back to cage so the TV still works.
# SMARTFOX_COMPOSITOR=cage in /etc/default/smartfox or session.env forces cage.
if [ "${SMARTFOX_COMPOSITOR:-sf-compositor}" != cage ]; then
start=$(date +%s)
/usr/bin/sf-shell-exec sf-compositor --drm -- /usr/bin/sf-launcher-start >>"$LOG" 2>&1 && exit 0
if [ $(($(date +%s) - start)) -gt 20 ]; then
exit 1 # ran for a while: a normal exit/crash, getty restarts the session
fi
echo "sf-session: sf-compositor failed, falling back to cage" >>"$LOG"
fi
exec cage -d -s -- /usr/bin/sf-launcher-start >>"$LOG" 2>&1

View File

@@ -1,5 +1,5 @@
[Unit]
Description=SmartFox: fill the new data partition (/var) with the factory defaults
Description=Fennec OS: fill the new data partition (/var) with the factory defaults
Documentation=file:/usr/lib/repart.d/50-sf-data.conf
DefaultDependencies=no
RequiresMountsFor=/var

View File

@@ -1,5 +1,5 @@
[Unit]
Description=SmartFox: remote debugging (ssh) off after boot
Description=Fennec OS: remote debugging (ssh) off after boot
After=network.target
[Service]

View File

@@ -1,5 +1,5 @@
[Unit]
Description=SmartFox: watch the remote debugging switch
Description=Fennec OS: watch the remote debugging switch
[Path]
PathModified=/var/lib/smartfox/remote-debug

View File

@@ -1,5 +1,5 @@
[Unit]
Description=SmartFox: remote debugging (ssh) on or off
Description=Fennec OS: remote debugging (ssh) on or off
After=network.target
[Service]

View File

@@ -1,5 +1,5 @@
[Unit]
Description=SmartFox Siri Remote driver
Description=Fennec OS Siri Remote driver
After=bluetooth.service
Wants=bluetooth.service

View File

@@ -1,5 +1,5 @@
[Unit]
Description=SmartFox: switch downloaded packages live before the TV starts
Description=Fennec OS: switch downloaded packages live before the TV starts
DefaultDependencies=no
RequiresMountsFor=/var
After=local-fs.target sf-data-init.service
@@ -9,7 +9,7 @@ ConditionPathIsMountPoint=/var
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/sf-update apply
ExecStart=/usr/bin/sf-shell-exec sf-update apply
[Install]
WantedBy=multi-user.target

View File

@@ -1,10 +1,10 @@
[Unit]
Description=SmartFox: download new shell and app packages (live at next boot)
Description=Fennec OS: download new shell and app packages (live at next boot)
Wants=network-online.target
After=network-online.target sf-update-apply.service
[Service]
Type=oneshot
ExecStart=/usr/bin/sf-update auto
ExecStart=/usr/bin/sf-shell-exec sf-update auto
Nice=10
IOSchedulingClass=idle

View File

@@ -1,5 +1,5 @@
[Unit]
Description=SmartFox: look for package updates a few times a day
Description=Fennec OS: look for package updates a few times a day
[Timer]
OnBootSec=10min

View File

@@ -1,5 +1,5 @@
[Unit]
Description=SmartFox: watch for update requests from the launcher
Description=Fennec OS: watch for update requests from the launcher
Documentation=file:/usr/share/doc/smartfox/updates.md
[Path]

View File

@@ -1,7 +1,7 @@
[Unit]
Description=SmartFox: handle update requests (check, install, confirm, rollback)
Description=Fennec OS: handle update requests (check, install, confirm, rollback)
After=network-online.target sf-update-apply.service
[Service]
Type=oneshot
ExecStart=/usr/bin/sf-update requests
ExecStart=/usr/bin/sf-shell-exec sf-update requests

View File

@@ -4,3 +4,6 @@ d /var/lib/smartfox 0755 tv tv -
# request files (check, install, confirm, rollback; see docs/updates.md).
d /var/lib/sf-pkg 0755 root root -
d /var/lib/smartfox/update-requests 0755 tv tv -
# Store: installed store apps (root) and their links (docs/store.md).
d /var/lib/sf-pkg/store 0755 root root -
d /var/lib/sf-pkg/store/apps 0755 root root -

View File

@@ -10,7 +10,7 @@ if [ ! -L /home ]; then
ln -s var/home /home
fi
# The TV user (uid 1000): auto-login on tty1 starts the SmartFox session.
# 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
@@ -18,6 +18,24 @@ fi
getent group netdev >/dev/null || groupadd -r netdev
usermod -aG netdev tv
# Steam (apps/steam, docs/store.md): the client is 32-bit. Valve's metapackages
# pull in the i386 graphics and system libraries it needs; the launcher itself
# is the sf-app-steam package (factory copy in /usr/share/smartfox/apps/steam).
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
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

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Boots the SmartFox image in QEMU (KVM). Under WSL the window shows up via WSLg.
# Boots the Fennec OS image in QEMU (KVM). Under WSL the window shows up via WSLg.
# sudo bash image/run-qemu.sh [--no-gl] [--bt VID:PID]
# ssh into the VM: ssh -p 2222 root@localhost (password: smartfox)
set -euo pipefail
@@ -43,7 +43,7 @@ if [ -n "${PULSE_SERVER:-}" ] || [ -S /mnt/wslg/PulseServer ]; then
fi
exec qemu-system-x86_64 \
-name SmartFox -machine q35,accel=kvm -cpu host -smp 4 -m 4096 \
-name "Fennec OS" -machine q35,accel=kvm -cpu host -smp 4 -m 4096 \
-drive if=pflash,format=raw,readonly=on,file="$CODE" \
-drive if=pflash,format=raw,file="$VARS" \
-drive file="$IMG",format=raw,if=virtio \