Fix installer state and launcher freshness checks

This commit is contained in:
Gabriel Brown
2026-08-27 17:31:46 -04:00
parent 99156442b5
commit b5832fc94a
6 changed files with 156 additions and 19 deletions
+9 -2
View File
@@ -8,6 +8,7 @@ declare -gA INSTALLER_PROVENANCE=()
_primary_key_fingerprints() (
local home
set -o pipefail
home="$(mktemp -d)" || exit 1
chmod 700 "$home"
trap 'rm -rf -- "$home"' EXIT
@@ -19,14 +20,20 @@ _primary_key_fingerprints() (
key_fingerprint_matches() {
local file="$1" expected="$2"
local output
local -a primary_fingerprints=()
mapfile -t primary_fingerprints < <(_primary_key_fingerprints "$file")
output="$(_primary_key_fingerprints "$file")" || return 1
[[ -n "$output" ]] || return 1
mapfile -t primary_fingerprints <<<"$output"
[[ ${#primary_fingerprints[@]} -eq 1 && "${primary_fingerprints[0]}" == "$expected" ]]
}
_key_has_one_primary() {
local output
local -a primary_fingerprints=()
mapfile -t primary_fingerprints < <(_primary_key_fingerprints "$1")
output="$(_primary_key_fingerprints "$1")" || return 1
[[ -n "$output" ]] || return 1
mapfile -t primary_fingerprints <<<"$output"
[[ ${#primary_fingerprints[@]} -eq 1 ]]
}
+9 -3
View File
@@ -85,9 +85,15 @@ if [[ -d "$extensions_source" ]] && command -v npm >/dev/null 2>&1; then
# alone takes long enough to be worth not repeating on every re-run of
# a stage that is otherwise nearly instant.
built="$vicinae_data_dir/extensions/$name"
if [[ -d "$built" && "$extension/src" -ot "$built" ]]; then
printf 'Vicinae extension %s is already built\n' "$name"
continue
if [[ -d "$built" ]]; then
newer_source=''
if newer_source="$(find "$extension/src" -type f -newer "$built" -print -quit)" \
&& [[ -z "$newer_source" \
&& ! "$extension/package.json" -nt "$built" \
&& ! "$extension/package-lock.json" -nt "$built" ]]; then
printf 'Vicinae extension %s is already built\n' "$name"
continue
fi
fi
printf 'Building Vicinae extension %s\n' "$name"