From 331c799ea7622fc9dcd0f6a9b982b350542e8d0e Mon Sep 17 00:00:00 2001 From: rickpeters Date: Sun, 27 Sep 2026 19:29:04 +0200 Subject: [PATCH] feat: Steamify's default setup for the new user during the install (Calamares step before cleanup) --- .gitignore | 1 + .../modules/shellprocess_steamify.conf | 10 ++ archiso/airootfs/etc/calamares/settings.conf | 127 ++++++++++++++++++ .../airootfs/usr/local/bin/steamify-install | 20 +++ archiso/profiledef.sh | 1 + steamify-prepare.sh | 16 +++ 6 files changed, 175 insertions(+) create mode 100644 archiso/airootfs/etc/calamares/modules/shellprocess_steamify.conf create mode 100644 archiso/airootfs/etc/calamares/settings.conf create mode 100755 archiso/airootfs/usr/local/bin/steamify-install create mode 100755 steamify-prepare.sh diff --git a/.gitignore b/.gitignore index 6713072..c21a7cc 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ archiso/airootfs/etc/environment archiso/airootfs/etc/pacman.d/cachyos-mirrorlist archiso/airootfs/etc/edition-tag archiso/airootfs/etc/version-tag +archiso/airootfs/usr/local/share/steamify/ diff --git a/archiso/airootfs/etc/calamares/modules/shellprocess_steamify.conf b/archiso/airootfs/etc/calamares/modules/shellprocess_steamify.conf new file mode 100644 index 0000000..45727f8 --- /dev/null +++ b/archiso/airootfs/etc/calamares/modules/shellprocess_steamify.conf @@ -0,0 +1,10 @@ +# Steamify: the Steam Machine setup for the new user, before the first boot. +--- + +dontChroot: true +timeout: 3600 +script: + - "-/usr/local/bin/steamify-install ${ROOT} ${USER}" + +i18n: + name: "Setting up the Steam Machine (Steamify)" diff --git a/archiso/airootfs/etc/calamares/settings.conf b/archiso/airootfs/etc/calamares/settings.conf new file mode 100644 index 0000000..ae8ade1 --- /dev/null +++ b/archiso/airootfs/etc/calamares/settings.conf @@ -0,0 +1,127 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# +# Configuration file for Calamares +--- +modules-search: [ local ] + +instances: + +- id: online + module: packages + config: packages_online.conf + +- id: online + module: welcome + config: welcome_online.conf + +- id: before-online + module: shellprocess + config: shellprocess-before-online.conf + +- id: modify_mk_hook + module: shellprocess + config: shellprocess_modify_mk_hook.conf + +- id: reset_mk_hook + module: shellprocess + config: shellprocess_reset_mk_hook.conf + +- id: initialize_pacman + module: shellprocess + config: shellprocess_initialize_pacman.conf + +- id: bootloader + module: packagechooser + config: packagechooser_bootloader.conf + +- id: desktop + module: packagechooser + config: packagechooser_desktop.conf + +- id: enable_ufw + module: shellprocess + config: shellprocess_enable_ufw.conf + +- id: greetd + module: shellprocess + config: shellprocess_greetd.conf + +- id: btrfs_snapshot + module: shellprocess + config: shellprocess_btrfs_snapshot.conf + +- id: steamify + module: shellprocess + config: shellprocess_steamify.conf + +- id: cleanup_calamares + module: shellprocess + config: shellprocess_cleanup_calamares.conf + + +sequence: +- show: + - welcome@online + - locale + - keyboard + - packagechooser@bootloader + - partition + - packagechooser@desktop + - netinstall + - users + - summary +- exec: + - partition + - zfs + - mount + - shellprocess@modify_mk_hook + - shellprocess@initialize_pacman + - shellprocess@before-online + - pacstrap + - machineid + - users + - locale + - keyboard + - localecfg + - chwd + - packages@online + - luksbootkeyfile + - luksopenswaphookcfg + - fstab + - plymouthcfg + - zfshostid + - initcpiocfg + - initcpio + - networkcfg + - displaymanager + - hwclock + - grubcfg + - bootloader + - shellprocess@reset_mk_hook + - services-systemd + - shellprocess + - shellprocess@enable_ufw + - shellprocess@greetd + - shellprocess@btrfs_snapshot + - shellprocess@steamify + - shellprocess@cleanup_calamares + - umount +- show: + - finished + +branding: cachyos + +prompt-install: true + +dont-chroot: false + +oem-setup: false + +disable-cancel: false + +disable-cancel-during-exec: false + +hide-back-and-next-during-exec: true + +quit-at-end: false diff --git a/archiso/airootfs/usr/local/bin/steamify-install b/archiso/airootfs/usr/local/bin/steamify-install new file mode 100755 index 0000000..e44aa24 --- /dev/null +++ b/archiso/airootfs/usr/local/bin/steamify-install @@ -0,0 +1,20 @@ +#!/bin/bash +# steamify-install : runs Steamify's default setup for +# the new user inside the installed system (Calamares, after the users and +# services steps). Steamify refuses root and asks sudo per command, so the +# user gets a NOPASSWD rule for this run only. Never fails the install: a +# problem leaves the log and Steamify can be run again from the desktop. +root="$1" user="$2" +log="$root/var/log/steamify-install.log" +rule="$root/etc/sudoers.d/00-steamify-install" +[[ -d "$root" && -n "$user" ]] || exit 0 + +install -Dm755 /usr/local/share/steamify/steamify.sh "$root/var/tmp/steamify.sh" +printf '%s ALL=(ALL) NOPASSWD: ALL\n' "$user" > "$rule" +chmod 440 "$rule" +arch-chroot "$root" runuser -u "$user" -- env -i HOME="/home/$user" USER="$user" LOGNAME="$user" \ + PATH=/usr/local/bin:/usr/bin TERM=dumb LANG=C.UTF-8 \ + bash -c 'cd ~ && bash /var/tmp/steamify.sh --defaults < /dev/null' > "$log" 2>&1 +echo "exit: $?" >> "$log" +rm -f "$rule" "$root/var/tmp/steamify.sh" +exit 0 diff --git a/archiso/profiledef.sh b/archiso/profiledef.sh index ce4a089..a7bb8d9 100644 --- a/archiso/profiledef.sh +++ b/archiso/profiledef.sh @@ -27,6 +27,7 @@ file_permissions=( ["/root/.gnupg"]="0:0:700" ["/usr/local/bin/choose-mirror"]="0:0:755" ["/usr/local/bin/dmcheck"]="0:0:755" + ["/usr/local/bin/steamify-install"]="0:0:755" ["/usr/local/bin/calamares-online.sh"]="0:0:755" ["/usr/local/bin/remove-nvidia"]="0:0:755" ["/usr/local/bin/removeun"]="0:0:755" diff --git a/steamify-prepare.sh b/steamify-prepare.sh new file mode 100755 index 0000000..234cff9 --- /dev/null +++ b/steamify-prepare.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# steamify-prepare.sh [steamify checkout]: puts the Steamify bundle on the +# ISO (archiso/airootfs/usr/local/share/steamify/steamify.sh), used by the +# installer's Steamify step. Built from a checkout when given, else the +# newest release. Run before buildiso.sh. +set -euo pipefail +dest="$(cd "$(dirname "$0")" && pwd)/archiso/airootfs/usr/local/share/steamify/steamify.sh" +mkdir -p "$(dirname "$dest")" +if [[ -n "${1:-}" ]]; then + (cd "$1" && .github/tools/bundle.sh "$dest") +else + curl -fsSL https://github.com/theupriser/steamify-cachyos/releases/latest/download/steamify.sh -o "$dest" +fi +grep -q -- '--defaults' "$dest" || { echo "This Steamify has no --defaults (needs 2.6.0 or newer)." >&2; exit 1; } +chmod 755 "$dest" +echo "Steamify $(grep -m1 '^VERSION=' "$dest" | cut -d= -f2) on the ISO."