fix(admin): stop dry runs before resolving the target volume

This commit is contained in:
2026-10-30 11:13:58 -03:00
parent 405fc18fc0
commit aba073e8b5
4 changed files with 13 additions and 2 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ Creates a hidden local administrator account on the system without performing an
1. Finds and mounts the macOS Data volume 1. Finds and mounts the macOS Data volume
2. Unlocks FileVault if needed 2. Unlocks FileVault if needed
3. Creates an admin user with a custom username and password 3. Creates an admin user with a custom username and password
4. Adds the newly created user to FileVault 4. Attempts FileVault integration when available; verify it after reboot
5. Hides the account from the macOS login window via dscl 5. Hides the account from the macOS login window via dscl
6. Conceals the user's home directory in `/Users` using filesystem flags 6. Conceals the user's home directory in `/Users` using filesystem flags
+4 -1
View File
@@ -25,11 +25,14 @@
run bash -u -c ' run bash -u -c '
source <(sed '\''/^main "\$@"$/d'\'' "$1") source <(sed '\''/^main "\$@"$/d'\'' "$1")
DRY_RUN=true DRY_RUN=true
is_recovery() { return 0; }
resolve_data_volume() { echo TARGET_WAS_ACCESSED; }
dscl_node() { echo ACCOUNT_STATE_WAS_ACCESSED; return 1; } dscl_node() { echo ACCOUNT_STATE_WAS_ACCESSED; return 1; }
admin_only_mode "/mock/Data volume" cmd_admin
' "$script" "$script" ' "$script" "$script"
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
[[ "$output" == *"[DRY RUN] Would create a local admin user"* ]] [[ "$output" == *"[DRY RUN] Would create a local admin user"* ]]
[[ "$output" != *"ACCOUNT_STATE_WAS_ACCESSED"* ]] [[ "$output" != *"ACCOUNT_STATE_WAS_ACCESSED"* ]]
[[ "$output" != *"TARGET_WAS_ACCESSED"* ]]
done done
} }
+4
View File
@@ -205,6 +205,10 @@ cmd_admin() {
if ! is_recovery; then if ! is_recovery; then
error_exit "Admin creation must run from Recovery mode." error_exit "Admin creation must run from Recovery mode."
fi fi
if [ "$DRY_RUN" = true ]; then
admin_only_mode "the selected Data volume"
return
fi
header "Create Local Admin User" header "Create Local Admin User"
local data_mount local data_mount
data_mount=$(resolve_data_volume) data_mount=$(resolve_data_volume)
+4
View File
@@ -2988,6 +2988,10 @@ cmd_admin() {
if ! is_recovery; then if ! is_recovery; then
error_exit "Admin creation must run from Recovery mode." error_exit "Admin creation must run from Recovery mode."
fi fi
if [ "$DRY_RUN" = true ]; then
admin_only_mode "the selected Data volume"
return
fi
header "Create Local Admin User" header "Create Local Admin User"
local data_mount local data_mount
data_mount=$(resolve_data_volume) data_mount=$(resolve_data_volume)