bootstrap
Adom Hydrogen (platform base)
Public Made by Adomby adom
Layer Hydrogen's workspace onto a standard Adom workstation.
master
John Lauer
add prepublish-check.sh: repair the mode bit before publishing
6867543
#!/usr/bin/env bash
# Run BEFORE `adom-wiki pkg publish`. Guards the one failure this package keeps shipping.
#
# WHY THIS EXISTS: `adom-wiki repo clone` does not preserve file modes, and the registry
# REQUIRES scripts.install to be exactly "./install.sh" for bootstrap packages (server-side
# validation rejects `bash install.sh`). Those two facts together mean a clone-edit-publish
# cycle ships install.sh with no executable bit, and every install then fails with
# Permission denied. It has happened three times: 0.4.0, 0.5.0, 0.5.6.
#
# The publish linter does warn, but it is one line inside a wall of hints, and a warning
# does not stop the publish.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
fail=0
for f in *.sh; do
[ -f "$f" ] || continue
if [ ! -x "$f" ]; then
echo "FIXING: $f is not executable (repo clone drops the mode bit)"
chmod +x "$f"
fail=1
fi
done
want='./install.sh'
got=$(python3 -c "import json;print((json.load(open('package.json')).get('scripts') or {}).get('install',''))")
if [ "$got" != "$want" ]; then
echo "ERROR: scripts.install is '$got' but the registry requires '$want' for bootstrap packages" >&2
exit 1
fi
if [ "$fail" -eq 1 ]; then
echo "Mode bits repaired. Safe to publish."
else
echo "OK: all *.sh executable, scripts.install correct."
fi