Files
LithosAnanke/site/brand/install.sh
T
Claude 3bd81097e1 chore(license): an SPDX header on every source file that had none (LicenseRef-Starship-1.0) [skip ci]
The header scan (Captain Bob, 2026-11-10): 788 source files -- 351 with the
SL-1.0 header, 12 with the old name (docs/working/experiments, kept by
ruling), 31 under someone else's licence (tools/kconfig, Linux's, GPL-2.0:
kept), and 394 with none. Ruled: the SPDX form; capsules (.4th, .f18) and
proofs (.thy) left for a ruling of their own (mkcapsule's 64x16 block format,
content-addressed capsules).

253 files now begin
    SPDX-License-Identifier: LicenseRef-Starship-1.0
    Copyright (c) 2023-2026 Robert A. James
as a /* */ block (C, headers, assembly, linker scripts) or # lines (scripts,
Makefiles, Kconfig; below a shebang or a coding line); tools/mkcapsule.c,
which had the copyright line, gets the SPDX line only.

Not touched: docs/working/ (archive and old campaign material, as the
ruling kept the experiments); v4/system/post_cases.c (generated by
v4/tools/mkpost.py, "do not edit" -- the generator has the header).

Comments only: the kernel builds on amd64, aarch64, riscv64; make -C v4
test-32: 39 programs, 0 failures; every changed script parses.

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

60 lines
3.5 KiB
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: LicenseRef-Starship-1.0
# Copyright (c) 2023-2026 Robert A. James
# install.sh -- the wiki's banner says StarshipOS, not XWiki (Captain Bob, 2026-11-07: "The banner
# XWiki should not say that").
#
# site/brand/install.sh https://starshipos-f18.com starshipos-com.png
# site/brand/install.sh https://starshipos-f18.org starshipos-org.png
#
# In XWiki 17 the top bar's logo is the colour theme's. This makes a colour theme of our own,
# FlamingoThemes.StarshipOS -- a copy of the stock Iceberg with our wordmark as its logo -- and
# makes it the wiki's; the stock theme is not touched (set colorTheme back to
# FlamingoThemes.Iceberg to undo). It also makes the browser tab's title "<page> - StarshipOS".
# Run again after changing the wordmark: the logo is replaced. XWIKI_USER and XWIKI_PASSWORD as for
# site/*/install.sh. Everything goes as XML: XWiki refuses form and plain-text writes without its
# form token.
set -euo pipefail
cd "$(dirname "$0")"
base=${1:?usage: install.sh <wiki URL> <logo.png>}
logo=${2:?usage: install.sh <wiki URL> <logo.png>}
rest="$base/rest/wikis/xwiki/spaces"
auth=(-u "${XWIKI_USER:?set XWIKI_USER}:${XWIKI_PASSWORD:?set XWIKI_PASSWORD}")
theme="$rest/FlamingoThemes/pages/StarshipOS"
x() { curl -fsS -m 60 "${auth[@]}" "$@"; }
prop() { # prop <object URL> <name> <value>: set one property
x -o /dev/null -w " $2: %{http_code}\n" -X PUT -H 'Content-Type: application/xml' \
--data-binary "$(python3 -c '
import sys
from xml.sax.saxutils import escape
print("<property xmlns=\"http://www.xwiki.org\" name=\"%s\"><value>%s</value></property>" % (escape(sys.argv[1]), escape(sys.argv[2])))' "$2" "$3")" \
"$1/properties/$2"
}
echo "=== $base: the colour theme FlamingoThemes.StarshipOS"
x -o /dev/null -w " page: %{http_code}\n" -X PUT -H 'Content-Type: application/xml' --data-binary \
'<page xmlns="http://www.xwiki.org"><title>StarshipOS</title><syntax>xwiki/2.1</syntax><content>{{include reference="FlamingoThemesCode.ThemeSheet"/}}</content></page>' \
"$theme"
x -o /dev/null -w " logo $logo: %{http_code}\n" -X PUT -H 'Content-Type: image/png' --data-binary "@$logo" \
"$theme/attachments/$logo"
have=$(x -H 'Accept: application/json' "$theme/objects/FlamingoThemesCode.ThemeClass" |
python3 -c 'import json,sys; print(len(json.load(sys.stdin).get("objectSummaries") or []))')
if [ "$have" = 0 ]; then
# Iceberg's theme object, every property as it is, posted to our page
x -H 'Accept: application/xml' "$rest/FlamingoThemes/pages/Iceberg/objects/FlamingoThemesCode.ThemeClass/0" |
x -o /dev/null -w " theme object, from Iceberg: %{http_code}\n" -X POST -H 'Content-Type: application/xml' \
--data-binary @- "$theme/objects"
fi
prop "$theme/objects/FlamingoThemesCode.ThemeClass/0" logo "$logo"
prop "$theme/objects/FlamingoThemesCode.ThemeClass/0" logo-description "StarshipOS"
echo "=== the wiki's preferences"
prefs="$rest/XWiki/pages/XWikiPreferences/objects/XWiki.XWikiPreferences/0"
prop "$prefs" colorTheme "FlamingoThemes.StarshipOS"
prop "$prefs" title "\$tdoc.getRenderedTitle('plain/1.0') - StarshipOS"
echo "=== check, as a guest"
page=$(curl -sS -m 60 "$base/bin/login/XWiki/XWikiLogin") # a page that shows the chrome to a guest
case "$page" in *"FlamingoThemes/StarshipOS/$logo"*) echo " the banner's logo: ours";; *) echo " the banner's logo: NOT ours" >&2; exit 1;; esac
case "$page" in *"- StarshipOS</title>"*) echo " the tab's title: ends - StarshipOS";; *) echo " the tab's title: NOT ours" >&2; exit 1;; esac