fix: make installer gate portable in root CI

This commit is contained in:
Qiufeng
2026-09-03 08:02:48 +08:00
parent 69a4b482ec
commit 4f42a1ea07
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "tallynote", "name": "tallynote",
"version": "1.1.15", "version": "1.1.16",
"private": true, "private": true,
"type": "module", "type": "module",
"packageManager": "pnpm@9.0.6", "packageManager": "pnpm@9.0.6",
+6
View File
@@ -88,6 +88,12 @@ bash -c '
chmod 700 "$mode_dir" chmod 700 "$mode_dir"
[[ "$(stat_mode_bits "$mode_dir")" == 448 ]] [[ "$(stat_mode_bits "$mode_dir")" == 448 ]]
mkdir -p "$owner_parent" mkdir -p "$owner_parent"
# CI runs this shell suite as root. Make the parent genuinely non-root in
# that environment so the assertion exercises the ownership guard instead
# of accidentally passing because root-owned parents are allowed.
if [[ "${EUID:-$(id -u)}" == 0 ]]; then
chown 65534:65534 "$owner_parent"
fi
if (assert_path_chain "$owner_parent/child") >/dev/null 2>&1; then if (assert_path_chain "$owner_parent/child") >/dev/null 2>&1; then
echo "expected non-root path parent to fail" >&2 echo "expected non-root path parent to fail" >&2
exit 1 exit 1