more configure options

This commit is contained in:
2026-10-26 15:33:27 -06:00
parent bbd6b83f64
commit 1bdd38d2b1
2 changed files with 37 additions and 3 deletions
+1 -1
View File
@@ -212,7 +212,7 @@ configure
It covers: It covers:
- **Your Federated Computer Core.** Give it your Superpanel's address (e.g. https://superpanel.example.com), your Core email, name and password, and it adds Superpanel to your applications, joins this computer to your Core's Tailscale network, adds your Nextcloud (calendar, contacts and files) and email to GNOME's Online Accounts, and mounts your Nextcloud files at /mnt/example.com ("example.com" in the Files sidebar). For Nextcloud and the files it creates a Nextcloud app password, which you can revoke in Nextcloud under Settings > Security. - **Your Federated Computer Core.** Give it your Superpanel's address (e.g. https://superpanel.example.com), your Core email, name and password, and it adds Superpanel to your applications, joins this computer to your Core's Tailscale network, adds your Nextcloud (calendar, contacts and files) and email to GNOME's Online Accounts, and mounts your Nextcloud files at /mnt/example.com ("example.com" in the Files sidebar), and points Element at your Core's Matrix server. For Nextcloud and the files it creates a Nextcloud app password, which you can revoke in Nextcloud under Settings > Security.
- Signing in to Claude Code, opencode and Hermes Agent and choosing their model providers. - Signing in to Claude Code, opencode and Hermes Agent and choosing their model providers.
To set up one thing, name it, e.g. `configure hermes`; `configure --list` shows the names. To set up one thing, name it, e.g. `configure hermes`; `configure --list` shows the names.
+36 -2
View File
@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
TITLE="Federated Computer Core" TITLE="Federated Computer Core"
DESCRIPTION="Superpanel, Tailscale, Nextcloud, email and files" DESCRIPTION="Superpanel, Tailscale, Nextcloud, email, files and Element"
# What you entered last time, so running this again only does what's missing # What you entered last time, so running this again only does what's missing
CORE_CONF="$HOME/.config/coredesktop/core.conf" CORE_CONF="$HOME/.config/coredesktop/core.conf"
@@ -15,6 +15,8 @@ core_names() {
WEBDAV="$NEXTCLOUD/remote.php/dav/files/$CORE_USER" WEBDAV="$NEXTCLOUD/remote.php/dav/files/$CORE_USER"
MOUNT="/mnt/$CORE_DOMAIN" MOUNT="/mnt/$CORE_DOMAIN"
SUPERPANEL_DESKTOP="$HOME/.local/share/applications/core-$CORE_DOMAIN-superpanel.desktop" SUPERPANEL_DESKTOP="$HOME/.local/share/applications/core-$CORE_DOMAIN-superpanel.desktop"
MATRIX="https://matrix.$CORE_DOMAIN"
ELEMENT_CONFIG="$HOME/.config/Element/config.json"
} }
superpanel_done() { superpanel_done() {
@@ -40,10 +42,22 @@ files_done() {
grep -qs " $MOUNT davfs " /etc/fstab && grep -qs "^$MOUNT " "$HOME/.davfs2/secrets" grep -qs " $MOUNT davfs " /etc/fstab && grep -qs "^$MOUNT " "$HOME/.davfs2/secrets"
} }
element_installed() {
command -v element-desktop > /dev/null
}
# Done when Element isn't installed, as there's nothing to set up
element_done() {
element_installed || return 0
jq -e --arg url "$MATRIX" \
'.default_server_config["m.homeserver"].base_url | rtrimstr("/") == $url' \
"$ELEMENT_CONFIG" &> /dev/null
}
is_configured() { is_configured() {
[ -n "$CORE_DOMAIN" ] || return 1 [ -n "$CORE_DOMAIN" ] || return 1
core_names core_names
superpanel_done && tailscale_done && nextcloud_done && email_done && files_done superpanel_done && tailscale_done && nextcloud_done && email_done && files_done && element_done
} }
save_conf() { save_conf() {
@@ -255,6 +269,25 @@ EOF
echo "Your Nextcloud files are at $MOUNT (\"$CORE_DOMAIN\" in the Files sidebar)." echo "Your Nextcloud files are at $MOUNT (\"$CORE_DOMAIN\" in the Files sidebar)."
} }
# Element Desktop reads ~/.config/Element/config.json over its built-in
# settings. Pointing it at the Core's Matrix server means you only choose
# "Sign in" (the Core offers single sign-on through Authelia). The Core's Matrix
# server is named after its address, matrix.<domain>, and says where its API is.
setup_element() {
local base_url config
base_url="$(curl -sf --max-time 15 "$MATRIX/.well-known/matrix/client" \
| jq -r '.["m.homeserver"].base_url // empty' 2> /dev/null)"
base_url="${base_url:-$MATRIX}"
mkdir -p "$(dirname "$ELEMENT_CONFIG")"
config="$(cat "$ELEMENT_CONFIG" 2> /dev/null)"
[ -n "$config" ] || config='{}'
jq --arg url "${base_url%/}" --arg name "matrix.$CORE_DOMAIN" \
'.default_server_config = {"m.homeserver": {base_url: $url, server_name: $name}}' \
<<< "$config" > "$ELEMENT_CONFIG.tmp" && mv -f "$ELEMENT_CONFIG.tmp" "$ELEMENT_CONFIG" || return 1
echo "Element will use $MATRIX the next time it starts."
}
# Run a step unless it's done; a failed step doesn't stop the ones after it # Run a step unless it's done; a failed step doesn't stop the ones after it
step() { step() {
local name="$1" title="$2" local name="$1" title="$2"
@@ -310,6 +343,7 @@ run_configure() {
step nextcloud "Nextcloud in Online Accounts" step nextcloud "Nextcloud in Online Accounts"
step email "Email in Online Accounts" step email "Email in Online Accounts"
step files "Nextcloud files at $MOUNT" step files "Nextcloud files at $MOUNT"
element_installed && step element "Element with your Core's Matrix server"
unset PASSWORD APP_PASSWORD unset PASSWORD APP_PASSWORD
return $STATUS return $STATUS
} }