From aba073e8b5c9645c6a1cb1d7a7471cafe8c24f29 Mon Sep 17 00:00:00 2001 From: ruihan Date: Fri, 30 Oct 2026 11:13:58 -0300 Subject: [PATCH] fix(admin): stop dry runs before resolving the target volume --- README.md | 2 +- tests/test_admin.bats | 5 ++++- unleash | 4 ++++ unleash-standalone.sh | 4 ++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aea0cc4..075f495 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ Creates a hidden local administrator account on the system without performing an 1. Finds and mounts the macOS Data volume 2. Unlocks FileVault if needed 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 6. Conceals the user's home directory in `/Users` using filesystem flags diff --git a/tests/test_admin.bats b/tests/test_admin.bats index 9476c30..b138156 100644 --- a/tests/test_admin.bats +++ b/tests/test_admin.bats @@ -25,11 +25,14 @@ run bash -u -c ' source <(sed '\''/^main "\$@"$/d'\'' "$1") DRY_RUN=true + is_recovery() { return 0; } + resolve_data_volume() { echo TARGET_WAS_ACCESSED; } dscl_node() { echo ACCOUNT_STATE_WAS_ACCESSED; return 1; } - admin_only_mode "/mock/Data volume" + cmd_admin ' "$script" "$script" [ "$status" -eq 0 ] [[ "$output" == *"[DRY RUN] Would create a local admin user"* ]] [[ "$output" != *"ACCOUNT_STATE_WAS_ACCESSED"* ]] + [[ "$output" != *"TARGET_WAS_ACCESSED"* ]] done } diff --git a/unleash b/unleash index ff5aff8..b96683d 100755 --- a/unleash +++ b/unleash @@ -205,6 +205,10 @@ cmd_admin() { if ! is_recovery; then error_exit "Admin creation must run from Recovery mode." fi + if [ "$DRY_RUN" = true ]; then + admin_only_mode "the selected Data volume" + return + fi header "Create Local Admin User" local data_mount data_mount=$(resolve_data_volume) diff --git a/unleash-standalone.sh b/unleash-standalone.sh index a641110..d47147e 100755 --- a/unleash-standalone.sh +++ b/unleash-standalone.sh @@ -2988,6 +2988,10 @@ cmd_admin() { if ! is_recovery; then error_exit "Admin creation must run from Recovery mode." fi + if [ "$DRY_RUN" = true ]; then + admin_only_mode "the selected Data volume" + return + fi header "Create Local Admin User" local data_mount data_mount=$(resolve_data_volume)