Files
LithosAnanke/site/com/install.sh
T
Claude be2c204d56 site(com): Downloads and Documents, built from a release; the nav links; the release's SHA256SUMS covers every file (#126, #157) [skip ci]
The design canvas (v17) gains the Documents artboard -- the Book of Fabric and
the Dictionary of v4 first, then the book, the three volumes and the API
reference, each with its SHA-256, and the SSRN paper -- and Downloads and
Documents in every .com nav; Downloads' reading list becomes a pointer to
Documents. site/com/canvas/ copied from it.

site/com/build.py --release TAG --sums SHA256SUMS builds Downloads and
Documents from the release ([TAG], [RELEASE]/<file>, [SHA:<file>]; a file the
release's SHA256SUMS lacks fails the build). Without a release it builds Home,
Try it and Inquiries exactly as before -- byte for byte -- with no link to the
two pages, so they go live only with alpha.4. install.sh installs them when
built.

scripts/nightly.sh gitea-release: the release's SHA256SUMS now covers every
file it attaches -- the images' sums, then the PDFs and the Root CA's
certificate -- so `sha256sum -c SHA256SUMS` checks all of it and Documents
finds each sum. The Nexus artifacts keep their own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
2026-11-10 11:38:50 +00:00

59 lines
2.7 KiB
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: LicenseRef-Starship-1.0
# Copyright (c) 2023-2026 Robert A. James
# install.sh -- the starshipos-f18.com XWiki's pages, from the "StarshipOS.com" design canvas
# (build.py makes them): Main.WebHome (Home), Inquiries.WebHome, TryIt.WebHome, and the two
# images, attachments of Main.WebHome. All readable by everyone; the wiki's own rights decide the
# rest. Through XWiki's REST API:
#
# XWIKI_USER=rajames XWIKI_PASSWORD=... site/com/install.sh [https://starshipos-f18.com]
#
# Run it again after build.py: pages and images are replaced. It ends by checking, without
# logging in, that every page and image is there.
set -euo pipefail
cd "$(dirname "$0")"
base=${1:-https://starshipos-f18.com}
rest="$base/rest/wikis/xwiki"
user=${XWIKI_USER:?set XWIKI_USER}
pass=${XWIKI_PASSWORD:?set XWIKI_PASSWORD}
auth=(-u "$user:$pass")
page() { # page <space> <title> <file>: create or replace <space>.WebHome
local body
body=$(python3 -c '
import sys
from xml.sax.saxutils import escape
print("<page xmlns=\"http://www.xwiki.org\"><title>%s</title><syntax>xwiki/2.1</syntax>"
"<content>%s</content></page>" % (escape(sys.argv[1]), escape(open(sys.argv[2]).read())))' "$2" "$3")
curl -fsS -o /dev/null -w " page $1.WebHome: %{http_code}\n" "${auth[@]}" -X PUT \
-H 'Content-Type: application/xml' --data-binary "$body" "$rest/spaces/$1/pages/WebHome"
}
attach() { # attach <space> <file>: create or replace an attachment of <space>.WebHome
curl -fsS -o /dev/null -w " attachment $1.WebHome/$2: %{http_code}\n" "${auth[@]}" -X PUT \
-H 'Content-Type: image/jpeg' --data-binary "@$2" "$rest/spaces/$1/pages/WebHome/attachments/$2"
}
echo "=== $base, as $user"
page Main "StarshipOS" Main.WebHome.xwiki
attach Main badge.jpg
attach Main captain-bob.jpg
page Inquiries "Inquiries" Inquiries.WebHome.xwiki
page TryIt "Try StarshipOS" TryIt.WebHome.xwiki
# Downloads and Documents exist once build.py has been given a release (#126, #157)
pages="/bin/view/Main/ /bin/view/Inquiries/ /bin/view/TryIt/"
if [ -f Downloads.WebHome.xwiki ] && [ -f Documents.WebHome.xwiki ]; then
page Downloads "Downloads" Downloads.WebHome.xwiki
page Documents "Documents" Documents.WebHome.xwiki
pages="$pages /bin/view/Downloads/ /bin/view/Documents/"
fi
echo "=== as a guest"
bad=
for u in $pages \
/bin/download/Main/WebHome/badge.jpg /bin/download/Main/WebHome/captain-bob.jpg; do
code=$(curl -s -o /dev/null -w '%{http_code}' "$base$u")
if [ "$code" = 200 ]; then echo " $u: 200"; else echo " $u: $code -- NOT readable"; bad=1; fi
done
[ -z "$bad" ] || { echo "install: a guest cannot read everything; see above" >&2; exit 1; }
echo "=== done: $base/bin/view/Main/"