Files
omarchycn/bin/omarchy-setup-hardware
T
David Heinemeier HanssonandClaude Opus 5 477284f002 Hide install-time setup plumbing from the command listing
The setup group is described as interactive setup wizards, but these three
are not that. omarchy-setup-system is the ISO's entry point in the target
chroot, omarchy-setup-hardware is what it calls for device quirks, and
omarchy-setup-lock is called by install/config/lockscreen-pam.sh. None of
them is something to browse to and run.

Hiding only affects listings, so the ISO and the install leaves keep routing
through the CLI exactly as before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-10 13:58:16 -07:00

76 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# omarchy:summary=Apply Omarchy hardware-specific packages and system configuration
# omarchy:group=setup
# omarchy:requires-sudo=true
# omarchy:examples=omarchy setup hardware --install-user dhh
# omarchy:hidden=true
set -euo pipefail
usage() {
cat <<USAGE
Usage: omarchy setup hardware --install-user USER
omarchy setup hardware --defer-provisioning
Runs idempotent hardware detection/setup for the installed machine. This is
called by omarchy-setup-system during ISO finalization and can be rerun later
for diagnostics or after hardware/package updates.
--defer-provisioning runs without an install user (deferred-provisioning installs create the user at
first boot); group grants are recorded in /var/lib/omarchy/provisioning/groups.
USAGE
}
install_user="${OMARCHY_INSTALL_USER:-}"
defer_provisioning=0
while (($#)); do
case "$1" in
--install-user)
install_user="${2:-}"
shift 2
;;
--defer-provisioning)
defer_provisioning=1
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown option: $1" >&2
usage >&2
exit 1
;;
esac
done
if (( EUID != 0 )); then
echo "Error: omarchy-setup-hardware must run as root" >&2
exit 1
fi
if (( defer_provisioning )); then
install_user=""
else
if [[ -z $install_user || $install_user == "root" ]]; then
echo "Error: --install-user must name the target non-root user" >&2
exit 1
fi
if ! getent passwd "$install_user" >/dev/null; then
echo "Error: user '$install_user' does not exist" >&2
exit 1
fi
fi
export OMARCHY_INSTALL_USER="$install_user"
export OMARCHY_PATH="${OMARCHY_PATH:-/usr/share/omarchy}"
export OMARCHY_INSTALL="${OMARCHY_INSTALL:-$OMARCHY_PATH/install}"
export OMARCHY_INSTALL_LOG_FILE="${OMARCHY_INSTALL_LOG_FILE:-/var/log/omarchy-install.log}"
export PATH="$OMARCHY_PATH/bin:$PATH"
source "$OMARCHY_INSTALL/helpers/logging.sh"
source "$OMARCHY_INSTALL/hardware/all.sh"