Fix OMARCHY_USER when archinstall fails (#12)

Get username from JSON config instead of /mnt/home to ensure
error recovery works even when archinstall completely fails.
This commit is contained in:
Jarek authored and GitHub committed 2025-08-20 16:56:35 +02:00
1 parent b9f5ec0284
commit a0dd0127d5
1 file changed
+3 -2
+3 -2
View File
@@ -21,13 +21,14 @@ trap catch_errors ERR
if [[ $(tty) == "/dev/tty1" ]]; then
NETWORK_NEEDED=1 ./installer
# Get username from installer config for reliable error recovery
OMARCHY_USER="$(jq -r '.users[0].username' user_credentials.json)"
archinstall \
--config user_configuration.json \
--creds user_credentials.json \
--silent
OMARCHY_USER="$(ls -1 /mnt/home | head -n1)"
# No need to ask for sudo during the installation (omarchy itself responsible for removing after install)
mkdir -p /mnt/etc/sudoers.d
echo "root ALL=(ALL:ALL) NOPASSWD: ALL\n%wheel ALL=(ALL:ALL) NOPASSWD: ALL\n$OMARCHY_USER ALL=(ALL:ALL) NOPASSWD: ALL" >/mnt/etc/sudoers.d/99-omarchy-installer