#!/bin/bash # 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 " - 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 } logo=${2:?usage: install.sh } 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 : 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("%s" % (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 \ 'StarshipOSxwiki/2.1{{include reference="FlamingoThemesCode.ThemeSheet"/}}' \ "$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"*) echo " the tab's title: ends - StarshipOS";; *) echo " the tab's title: NOT ours" >&2; exit 1;; esac