FDS/OS 1.0

This commit is contained in:
2026-09-21 22:29:23 +08:00
commit 99bc3d15c5
430 changed files with 34876 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
set -euo pipefail
# Login accounting is volatile on a read-only SYSTEM root.
install -m 0664 -o root -g utmp /dev/null /run/utmp
install -m 0664 -o root -g utmp /dev/null /var/log/wtmp
install -m 0600 -o root -g utmp /dev/null /var/log/btmp
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
# Local single-user console. Drop root before reading any user shell startup files.
set -euo pipefail
if [[ $(cat /usr/share/fds/image-profile) == recovery ]]; then
# Explicit recovery image only; never read shell startup files from DATA.
install -d -m 0700 /run/fds/recovery-home
cd /run/fds/recovery-home
printf '\nFDS RECOVERY — LOCAL MAINTENANCE CONSOLE\nDATA stays read-only until explicitly selected.\nUse fds recovery help for inspection and repair commands.\n'
exec /usr/bin/env -i HOME=/run/fds/recovery-home USER=root LOGNAME=root \
SHELL=/bin/bash PATH=/usr/bin:/bin LANG=en_US.UTF-8 TERM="${TERM:-linux}" \
/bin/bash --login
fi
cd /home/fds
exec /usr/bin/s6-setuidgid fds /usr/bin/env -i \
HOME=/home/fds USER=fds LOGNAME=fds SHELL=/bin/bash \
PATH=/usr/bin:/bin LANG=en_US.UTF-8 TERM="${TERM:-linux}" \
/bin/bash --login
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
set -euo pipefail
read -r name < /etc/hostname
exec /usr/bin/hostname "$name"
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
set -euo pipefail
# /dev is supplied by the kernel/early userspace; s6 stage 1 mounts /run.
# Never remount SYSTEM writable.
mountpoint -q /proc || mount -t proc -o nosuid,nodev,noexec proc /proc
mountpoint -q /sys || mount -t sysfs -o nosuid,nodev,noexec sysfs /sys
mountpoint -q /tmp || mount -t tmpfs -o mode=1777,nosuid,nodev tmpfs /tmp
mountpoint -q /var/tmp || mount -t tmpfs -o mode=1777,nosuid,nodev tmpfs /var/tmp
mountpoint -q /var/log || mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /var/log
mountpoint -q /home/fds || mount -t tmpfs -o mode=0700,uid=1000,gid=1000,nosuid,nodev tmpfs /home/fds
mkdir -p /dev/pts /dev/shm /run/lock /run/log
mountpoint -q /dev/pts || mount -t devpts -o mode=0620,gid=5,nosuid,noexec devpts /dev/pts
mountpoint -q /dev/shm || mount -t tmpfs -o mode=1777,nosuid,nodev tmpfs /dev/shm
ln -snf /proc/self/fd /dev/fd
ln -snf /proc/self/fd/0 /dev/stdin
ln -snf /proc/self/fd/1 /dev/stdout
ln -snf /proc/self/fd/2 /dev/stderr
# Local TCP/UDP is base IPC. External interfaces remain down until requested.
ip link set dev lo up
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
# Stage 2 is a child of native s6-svscan, never PID 1.
set -euo pipefail
/usr/bin/fds-boottrace adopt || printf 'Boot trace could not be initialized\n' >&2
s6-rc-init -c /etc/s6-rc/compiled -l /run/s6-rc /run/service
exec /etc/s6-linux-init/current/scripts/runlevel "${1:-default}"
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
set -euo pipefail
# A native shutdown is irrevocable once started. Keep this hook alive on failure
# instead of letting a nonzero script exit trigger final process killing.
if ! /usr/bin/fds-power --shutdown-hook; then
printf 'FDS shutdown helper failed; remaining powered on for recovery.\n' >&2
exec /usr/bin/fds-power --hold-shutdown
fi
failed=()
if [[ -d /run/s6-rc ]]; then
if ! s6-rc -b -l /run/s6-rc -t 15000 -d -a change; then
printf 'FDS service stop failed after verified DATA unmount; native cleanup will terminate remaining processes.\n' >&2
failed=(failed)
fi
fi
/usr/bin/fds-power --record-final "${failed[@]}"
# s6-linux-init-shutdownd handles the final process cleanup, sync and unmount.
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/execlineb -P
/usr/bin/true
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
set -euo pipefail
case ${1:-default} in
default|boot|2|3|4|5) exec s6-rc -l /run/s6-rc -t 15000 -u change boot ;;
*) printf 'Unsupported FDS runlevel: %s\n' "$1" >&2; exit 100 ;;
esac
+21
View File
@@ -0,0 +1,21 @@
# Image-time s6 configuration. The native upstream binaries own PID 1.
pkgname=fds-init
version=0.1.0
revision=1
archs="aarch64"
depends="iproute2 s6-linux-init s6-rc s6 execline coreutils util-linux bash eudev fds-dasungd fds-cli fds-cartridged"
short_desc="FDS native s6 boot graph and shutdown configuration"
maintainer="FDS/OS maintainers"
license="Public Domain"
homepage="https://skarnet.org/software/s6-linux-init/"
do_install() {
local input="${XBPS_SRCDISTDIR}/${pkgname}-${version}"
(cd "$input" && sha256sum -c SHA256SUMS) || return 1
vmkdir etc/s6-rc/source
cp -a "${input}/s6-source/." "${DESTDIR}/etc/s6-rc/source/"
vmkdir usr/share/fds/init-skel
cp -a "${FILESDIR}/skel/." "${DESTDIR}/usr/share/fds/init-skel/"
for f in runtime-fs console hostname console-session; do
vinstall "${FILESDIR}/${f}" 755 usr/libexec/fds
done
}