LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.
C cdebiandesktop-environmentebpffirewalllandlocklinuxlinux-distributionopen-sourceprivacyquickjsraspberry-pi-5reactsecuritywaylandwayland-compositor
lordos package: repository source, version migrations, restart notice
Federico Pereira99d9fd60dff4
diff --git a/packaging/kernel/zz-lordos-reboot-required b/packaging/kernel/zz-lordos-reboot-requirednew file mode 100644index 0000000..160f12a--- /dev/null+++ b/packaging/kernel/zz-lordos-reboot-required@@ -0,0 +1,9 @@+#!/bin/sh+# A new kernel takes effect at the next boot: tell Store → Updates (and anything else that reads+# the Debian convention /run/reboot-required) to offer a restart. Shipped by the lordos package;+# run by the kernel packages' postinst with the kernel version as $1 (docs/UPDATES.md).+set -e+[ -d /run ] || exit 0+touch /run/reboot-required 2>/dev/null || exit 0+case "${1:-}" in *[!A-Za-z0-9.+~-]*|"") echo linux-image ;; *) echo "linux-image-$1" ;; esac >> /run/reboot-required.pkgs 2>/dev/null || true+exit 0diff --git a/packaging/migrations/001-0.8.1-network-permissions.sh b/packaging/migrations/001-0.8.1-network-permissions.shnew file mode 100644index 0000000..42798b3--- /dev/null+++ b/packaging/migrations/001-0.8.1-network-permissions.sh@@ -0,0 +1,8 @@+# 0.8.1: per-app network permissions (lord-netperm) on wherever LordOS starts at boot.+# The ISO, the Raspberry Pi image and install.sh enable lord-netperm.service, but the 0.8.0 package+# itself did not, so a system set up with apt alone had the firewall off. Runs once: if an+# administrator disables it afterwards, it stays disabled.+command -v systemctl >/dev/null 2>&1 || exit 0+[ "$(systemctl is-enabled lordos.service 2>/dev/null || true)" = enabled ] || exit 0+systemctl enable lord-netperm.service >/dev/null 2>&1 || true+if [ -d /run/systemd/system ]; then systemctl start lord-netperm.service >/dev/null 2>&1 || true; fidiff --git a/packaging/migrations/002-0.8.1-root-ssh-keys.sh b/packaging/migrations/002-0.8.1-root-ssh-keys.shnew file mode 100644index 0000000..eacfbd4--- /dev/null+++ b/packaging/migrations/002-0.8.1-root-ssh-keys.sh@@ -0,0 +1,20 @@+# 0.8.1: LordOS's SSH defaults (/etc/ssh/sshd_config.d/10-lordos.conf, new in 0.8.1) say+# "PermitRootLogin no". A server upgraded from 0.8.0 that is administered as root with an SSH key+# (a VPS, for example) would be locked out at the next sshd restart. On such an upgrade only, root+# keeps logging in with keys, never with a password (Debian's own default), through a drop-in that+# sshd reads before LordOS's. Delete /etc/ssh/sshd_config.d/09-lordos-root-keys.conf to apply+# LordOS's default; a new install never gets it.+[ -n "${LORDOS_OLD_VERSION:-}" ] || exit 0+dpkg --compare-versions "$LORDOS_OLD_VERSION" lt 0.8.1~ || exit 0+[ -x /usr/sbin/sshd ] || exit 0+[ -s /root/.ssh/authorized_keys ] || exit 0+f=/etc/ssh/sshd_config.d/09-lordos-root-keys.conf+[ -e "$f" ] && exit 0+mkdir -p /etc/ssh/sshd_config.d+cat > "$f" <<'CONF'+# Written by the lordos package when upgrading from 0.8.0 (docs/UPDATES.md, "Migrations"): this+# server had root SSH keys, so root keeps logging in with keys only. LordOS's default, in+# 10-lordos.conf, is no root login at all: delete this file and restart ssh to apply it.+PermitRootLogin prohibit-password+CONF+chmod 644 "$f"diff --git a/packaging/migrations/migrate b/packaging/migrations/migratenew file mode 100644index 0000000..bb54070--- /dev/null+++ b/packaging/migrations/migrate@@ -0,0 +1,27 @@+#!/bin/sh+# migrate — applies LordOS's system migrations, each one once (docs/UPDATES.md, "Migrations").+#+# /usr/lib/lordos/migrate [<previous version>] (the lordos package's postinst runs it)+#+# Every /usr/lib/lordos/migrations/NNN-<version>-<name>.sh runs in NNN order unless+# /var/lib/lordos/migrations/NNN-<version>-<name> records that it already ran, so any upgrade path+# (0.8.1 → 0.8.3, or 0.8.0 → 0.8.3 at once) ends in the same state. A migration is idempotent,+# never touches the users' home folders and gets the previous version in LORDOS_OLD_VERSION (empty+# on a new install). If one fails, the next ones don't run and the package stays unconfigured, so+# `dpkg --configure -a` (or the Store's next update) runs it again.+set -eu+DIR=${LORDOS_MIGRATIONS_DIR:-/usr/lib/lordos/migrations}+STATE=${LORDOS_MIGRATIONS_STATE:-/var/lib/lordos/migrations}+mkdir -p "$STATE"+for m in "$DIR"/[0-9][0-9][0-9]-*.sh; do+ [ -f "$m" ] || continue+ id=$(basename "$m" .sh)+ [ -e "$STATE/$id" ] && continue+ if LORDOS_OLD_VERSION=${1:-} sh -eu "$m"; then+ date -u +%Y-%m-%dT%H:%M:%SZ > "$STATE/$id"+ echo "LordOS: migration $id applied"+ else+ echo "LordOS: migration $id failed; run 'dpkg --configure -a' to try again" >&2+ exit 1+ fi+donediff --git a/tools/iso/mkdeb.sh b/tools/iso/mkdeb.shindex 7c37ce5..4541b9e 100755--- a/tools/iso/mkdeb.sh+++ b/tools/iso/mkdeb.sh@@ -18,6 +18,12 @@# image or install.sh; the package never selects it)# /usr/share/grub/themes/lordos/ the boot menu theme (amd64; the ISO and the disk installer)# /usr/share/doc/lordos/ README, copyright, changelog+# /usr/lib/lordos/apt/lordos.sources the signed LordOS repository on lordos.org (updates from the+# Store and apt; docs/UPDATES.md): postinst copies it to+# /etc/apt/sources.list.d/ when missing, postrm removes it+# /usr/share/keyrings/lordos-archive-keyring.gpg the key that signs that repository+# /usr/lib/lordos/migrate, migrations/ version-to-version system migrations, run by postinst+# /etc/kernel/postinst.d/zz-lordos-reboot-required "restart required" after a kernel updateset -euOUT=${1:?uso: mkdeb.sh salida.deb}ROOT=$(pwd)@@ -70,6 +76,13 @@ install -m 644 assets/app-host.bundle.js "$L/assets/app-host.bundle.js"# system apps that run as their own sandboxed process (manifest "process": "isolated"; e.g. Passwords)[ -d assets/sysapps ] && cp -r assets/sysapps "$L/assets/"install -m 755 tools/iso/rootfs/usr/lib/lordos/lordos-live-prep "$L/lordos-live-prep"+# updates in place (docs/UPDATES.md): the repository, its key, the migrations and the restart notice+install -D -m 644 packaging/apt/lordos.sources "$L/apt/lordos.sources"+install -D -m 644 packaging/keys/lordos-archive-keyring.gpg "$PKG/usr/share/keyrings/lordos-archive-keyring.gpg"+install -m 755 packaging/migrations/migrate "$L/migrate"+install -d "$L/migrations"+install -m 644 packaging/migrations/[0-9][0-9][0-9]-*.sh "$L/migrations/"+install -D -m 755 packaging/kernel/zz-lordos-reboot-required "$PKG/etc/kernel/postinst.d/zz-lordos-reboot-required"install -D -m 644 tools/iso/rootfs/etc/wireplumber/wireplumber.conf.d/lordos-bluez.conf "$PKG/etc/wireplumber/wireplumber.conf.d/lordos-bluez.conf"install -D -m 644 tools/iso/rootfs/etc/pipewire/pipewire-pulse.conf.d/lordos-no-modules.conf "$PKG/etc/pipewire/pipewire-pulse.conf.d/lordos-no-modules.conf"# in a virtual machine only: more headroom for emulated sound cards (docs/SOUND.md, "Virtual machines")@@ -105,7 +118,7 @@ install -m 644 tools/iso/rootfs/etc/systemd/system/lord-netperm.service "$PKG/us# fans by temperature from the first boot (docs/FANS.md): enabled by postinst, also in a chrootinstall -m 644 tools/iso/rootfs/etc/systemd/system/lord-fand.service "$PKG/usr/lib/systemd/system/lord-fand.service"find "$L" -type d -exec chmod 755 {} +-find "$L/themes" "$L/assets" -type f -exec chmod 644 {} ++find "$L/themes" "$L/assets" "$L/migrations" "$L/apt" -type f -exec chmod 644 {} +D="$PKG/usr/share/doc/lordos"install -m 644 README.md "$D/README.md"@@ -199,6 +212,21 @@ if [ "$1" = configure ] && command -v systemctl >/dev/null 2>&1; thenif [ -d /run/systemd/system ]; then systemctl restart systemd-sysctl.service >/dev/null 2>&1 || true; fiif [ -d /run/systemd/system ]; then systemctl restart lord-fand.service >/dev/null 2>&1 || true; fifi+# the LordOS repository: added when missing, so an administrator's edit (Enabled: no) is kept; not a+# conffile, so removing the package also removes it and apt keeps working (docs/UPDATES.md)+if [ "$1" = configure ] && [ ! -e /etc/apt/sources.list.d/lordos.sources ] && [ -d /etc/apt/sources.list.d ]; then+ install -m 644 /usr/lib/lordos/apt/lordos.sources /etc/apt/sources.list.d/lordos.sources+fi+# version-to-version system changes, each applied once (docs/UPDATES.md, "Migrations")+if [ "$1" = configure ] && [ -x /usr/lib/lordos/migrate ]; then+ /usr/lib/lordos/migrate "${2:-}"+fi+# an upgrade replaced the desktop under the running sessions: Store → Updates offers a restart+# (the Debian convention /run/reboot-required; never on a new install or in an image build)+if [ "$1" = configure ] && [ -n "${2:-}" ] && [ -d /run/systemd/system ] &&+ [ "$2" != "$(dpkg-query -W -f '${Version}' lordos 2>/dev/null || true)" ]; then+ touch /run/reboot-required 2>/dev/null && echo lordos >> /run/reboot-required.pkgs 2>/dev/null || true+fi# the boot splash lives in the initramfs: when it is the selected theme, rebuild it with the new images# (initramfs-tools' trigger; the theme is selected by the ISO, the Pi image or install.sh, never here)if [ "$1" = configure ] && [ -x /usr/sbin/plymouth-set-default-theme ] &&@@ -223,6 +251,14 @@ if [ "$1" = remove ] && [ -x /usr/sbin/plymouth-set-default-theme ] &&fiCchmod 755 "$PKG/DEBIAN/prerm"+# without the package its key is gone: take the repository out of apt's sources too+cat > "$PKG/DEBIAN/postrm" <<'C'+#!/bin/sh+set -e+if [ "$1" = remove ] || [ "$1" = purge ]; then rm -f /etc/apt/sources.list.d/lordos.sources; fi+if [ "$1" = purge ]; then rm -rf /var/lib/lordos/migrations; fi+C+chmod 755 "$PKG/DEBIAN/postrm"# files under /etc are conffiles (lintian: file-in-etc-not-marked-as-conffile)( cd "$PKG" && find etc -type f | sed 's|^|/|' ) > "$PKG/DEBIAN/conffiles"chmod 644 "$PKG/DEBIAN/conffiles"