Repository navigation
Default OMARCHY_PATH and pass --yes to mise during unattended update #14337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: quattro
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -104,6 +104,22 @@ grep -F "OMARCHY_PATH is not a git checkout: $checkout" "$test_tmp/invalid.err" | |||||
| fail "invalid dev checkout reports the configured path" "$(cat "$test_tmp/invalid.err")" | ||||||
| pass "invalid dev checkout fails with a useful error" | ||||||
|
|
||||||
| : >"$git_log" | ||||||
| if ! env -u OMARCHY_PATH PATH="$stub_bin:$PATH" "$ROOT/bin/omarchy-update-dev" >"$test_tmp/unset.out" 2>"$test_tmp/unset.err"; then | ||||||
| fail "unset OMARCHY_PATH should skip like the packaged install" "$(cat "$test_tmp/unset.err")" | ||||||
| fi | ||||||
| [[ ! -s $git_log ]] || fail "unset OMARCHY_PATH does not invoke git" "$(cat "$git_log")" | ||||||
| pass "unset OMARCHY_PATH defaults to the packaged install and skips git" | ||||||
|
|
||||||
| grep -qE '^ *omarchy-update-dev$' "$ROOT/bin/omarchy-update" || | ||||||
| fail "top-level update includes the dev checkout step" | ||||||
| pass "top-level update includes the dev checkout step" | ||||||
|
|
||||||
| # The source-root check runs in omarchy-update, before omarchy-update-dev. | ||||||
| # pkexec omarchy-update -y arrives with OMARCHY_PATH unset, so the default | ||||||
| # has to be established here or the check exits before the helper runs. | ||||||
| default_line=$(grep -n 'export OMARCHY_PATH="${OMARCHY_PATH:-/usr/share/omarchy}"' "$ROOT/bin/omarchy-update" | head -1 | cut -d: -f1) | ||||||
| check_line=$(grep -n 'omarchy_security_require_source_root' "$ROOT/bin/omarchy-update" | head -1 | cut -d: -f1) | ||||||
| [[ -n $default_line && -n $check_line && $default_line -lt $check_line ]] || | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new condition uses
Suggested change
File Used: Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||
| fail "update entry point defaults OMARCHY_PATH before the source-root check" | ||||||
|
Comment on lines
+121
to
+124
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new assertion greps for the exact assignment instead of running File Used: Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||
| pass "update entry point defaults OMARCHY_PATH before the source-root check" | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This adds a separate test file even though File Used: Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
|
|
||
| test_tmp=$(mktemp -d) | ||
| trap 'rm -rf "$test_tmp"' EXIT | ||
|
|
||
| stub_bin="$test_tmp/bin" | ||
| mise_log="$test_tmp/mise.log" | ||
| mkdir -p "$stub_bin" | ||
|
|
||
| cat >"$stub_bin/mise" <<'SH' | ||
| #!/bin/bash | ||
| printf '%s\n' "$*" >>"$TEST_MISE_LOG" | ||
| SH | ||
| chmod +x "$stub_bin/mise" | ||
|
|
||
| cat >"$stub_bin/omarchy-cmd-present" <<'SH' | ||
| #!/bin/bash | ||
| [[ $1 == mise ]] | ||
| SH | ||
| chmod +x "$stub_bin/omarchy-cmd-present" | ||
|
|
||
| run_mise_update() { | ||
| : >"$mise_log" | ||
| TEST_MISE_LOG="$mise_log" PATH="$stub_bin:$PATH" "$@" "$ROOT/bin/omarchy-update-mise" | ||
| } | ||
|
|
||
| run_mise_update env -u OMARCHY_UPDATE_UNATTENDED | ||
| grep -Fx -- "up" "$mise_log" >/dev/null || | ||
| fail "interactive update runs mise up without --yes" "$(cat "$mise_log")" | ||
| pass "interactive update runs mise up without --yes" | ||
|
|
||
| run_mise_update env OMARCHY_UPDATE_UNATTENDED=1 | ||
| grep -Fx -- "up --yes" "$mise_log" >/dev/null || | ||
| fail "unattended update passes --yes to mise up" "$(cat "$mise_log")" | ||
| pass "unattended update passes --yes to mise up" | ||
Uh oh!
There was an error while loading. Please reload this page.