Defer USB enrollment until owner provisioning completes

This commit is contained in:
acrogenesis committed 2026-09-16 16:05:59 -06:00
1 parent 54bacefbf4
commit 67d173c9f9
5 files changed
+85 -29

No files matched your search

+9 -13
View File
@@ -1,5 +1,12 @@
echo "Configure USB device authorization"
# A deferred install has only the builder's peripherals attached. The owner
# needs working input before there is an account or a session for approvals.
if [[ -z ${OMARCHY_INSTALL_USER:-} ]]; then
systemctl disable usbguard.service
return 0
fi
rules_file="${OMARCHY_USB_AUTHORIZATION_RULES_FILE:-/etc/usbguard/rules.conf}"
daemon_config="${OMARCHY_USB_AUTHORIZATION_DAEMON_CONFIG:-/etc/usbguard/usbguard-daemon.conf}"
@@ -7,21 +14,10 @@ source "$OMARCHY_INSTALL/helpers/usb-authorization.sh"
usb_authorization_require_secure_settings "$daemon_config"
if [[ ! -s $rules_file ]]; then
policy=$(mktemp "${TMPDIR:-/tmp}/omarchy-usb-policy.XXXXXXXXXX")
chmod 600 "$policy"
if usb_authorization_generate_policy "$policy"; then
install -Dm600 -o root -g root "$policy" "$rules_file"
rm -f "$policy"
else
rm -f "$policy"
return 1
fi
usb_authorization_install_policy "$rules_file"
fi
if [[ -n ${OMARCHY_INSTALL_USER:-} ]]; then
usb_authorization_add_user "$OMARCHY_INSTALL_USER"
fi
usb_authorization_add_user "$OMARCHY_INSTALL_USER"
# Installs are followed by a reboot, so enable the daemon without starting it
# in the live ISO's chroot.