fix(installer): resolve local macOS patcher after cwd changes
This commit is contained in:
parent
5093e21e35
commit
2d3289fbc5
@ -1085,9 +1085,8 @@ patch_playbooks_for_macos() {
|
||||
info "Fetching and running macOS playbook patches..."
|
||||
local patch_script="/tmp/patch-macos-playbooks.py"
|
||||
local raw_url="https://raw.githubusercontent.com/ai-workspace-lab/xworkspace-console/main/scripts/patch-macos-playbooks.py"
|
||||
local bootstrap_script_dir local_patch_script
|
||||
bootstrap_script_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-}")" 2>/dev/null && pwd || true)"
|
||||
local_patch_script="${bootstrap_script_dir}/patch-macos-playbooks.py"
|
||||
local local_patch_script
|
||||
local_patch_script="${XWORKSPACE_CONSOLE_DIR}/scripts/patch-macos-playbooks.py"
|
||||
|
||||
if [ -f "$local_patch_script" ]; then
|
||||
cp "$local_patch_script" "$patch_script"
|
||||
|
||||
@ -251,8 +251,22 @@ test_macos_plugin_patch_uses_stable_directory() {
|
||||
}
|
||||
|
||||
test_local_bootstrap_prefers_local_macos_patcher() {
|
||||
grep -Fq 'if [ -f "$local_patch_script" ]' "$BOOTSTRAP" ||
|
||||
fail "local bootstrap does not prefer its checked-in macOS patcher"
|
||||
local checkout workdir
|
||||
checkout="$(mktemp -d)"
|
||||
workdir="$(mktemp -d)"
|
||||
mkdir -p "$checkout/scripts"
|
||||
printf 'local-patcher-marker\n' > "$checkout/scripts/patch-macos-playbooks.py"
|
||||
(
|
||||
XWORKSPACE_CONSOLE_DIR="$checkout"
|
||||
cd "$workdir"
|
||||
# shellcheck disable=SC2329
|
||||
python3() {
|
||||
grep -q '^local-patcher-marker$' "$1" ||
|
||||
fail "patch function did not execute the checked-in patcher"
|
||||
}
|
||||
patch_playbooks_for_macos
|
||||
)
|
||||
rm -rf "$checkout" "$workdir"
|
||||
grep -Fq '"${raw_url}?rev=$(date +%s)"' "$BOOTSTRAP" ||
|
||||
fail "remote macOS patcher download is not cache-busted"
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user