Set up Pop!_OS for a Federated Core, like CoreDesktop's configure

A port of CoreDesktop's configure to Pop!_OS 24.04 with COSMIC, in the shape
of connector-macos: its own install.sh, update and configure, installed in
~/.local/share/federated-connector/connector.

Every configure item is ported: the Core (email, calendars and contacts
through GNOME Online Accounts and Evolution, as COSMIC has no accounts of its
own; Superpanel; files over davfs2; Element; Tally; the email watcher),
Tailscale, backups, AI agents in the sandbox and their sign-ins, languages
with mise, AI servers, printers, network storage and the agent sandbox.
Folders go in the COSMIC Files sidebar. Each item installs what it needs
from apt, Flathub or the tool's own apt repository when you set it up.

smoketest/run checks it in Ubuntu 24.04 containers with Docker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 14:20:47 -07:00
co-authored by Claude Opus 5.5
commit bc07e1d3e3
60 changed files with 5626 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
# shellcheck shell=bash
# Scenarios set what the runner and items read
# shellcheck disable=SC2034
DESCRIPTION="install.sh piped into bash, as curl | bash runs it, then update"
TIER=quick
scenario() {
step "Install the working copy, with jq missing"
sudo apt-get remove -y jq > /dev/null 2>&1
export FEDERATED_CONNECTOR_SOURCE="$CONNECTOR"
bash < "$CONNECTOR/install.sh" > "$HOME/install.log" 2>&1
check_eq "install.sh succeeds" 0 $?
check "it installed jq again" pkg_installed jq
check "configure is linked in ~/.local/bin" test -L "$HOME/.local/bin/configure"
check "update is linked in ~/.local/bin" test -L "$HOME/.local/bin/update"
check "the install is in place" test -x "$HOME/.local/share/federated-connector/connector/configure"
check_eq "it records the version" local "$(cat "$HOME/.local/share/federated-connector/connector/.version")"
check "configure is on PATH in a new bash" bash -ic 'command -v configure' < /dev/null
check "it didn't ask to run configure without a terminal" grep -q "In a new terminal, run: configure" "$HOME/install.log"
check "it wrote a log" compgen -G "$HOME/.local/state/federated-connector/install-*.log"
step "update"
check "update --version" "$HOME/.local/bin/update" --version
"$HOME/.local/bin/update" > "$HOME/update.log" 2>&1
check_eq "update succeeds" 0 $?
check "no staging folders are left" bash -c '! compgen -G "$HOME/.local/share/federated-connector/.connector-*"'
check_eq "the PATH block is in ~/.bashrc once" 1 "$(grep -c '>>> Federated Connector commands >>>' "$HOME/.bashrc")"
check "the installed configure runs" "$HOME/.local/bin/configure" --help
}
+24
View File
@@ -0,0 +1,24 @@
# shellcheck shell=bash
# Scenarios set what the runner and items read
# shellcheck disable=SC2034
DESCRIPTION="configure --help, --list, the menu, and an item's first question"
TIER=quick
scenario() {
local out err
check "--help" "$CONNECTOR/configure" --help
out="$("$CONNECTOR/configure" --list 2> "$HOME/err")"
err="$(cat "$HOME/err")"
check_eq "--list writes nothing on stderr" "" "$err"
for item in core tailscale backup agents languages ai-servers printers storage; do
check "--list has $item" grep -qE "^(done|to do) +$item " <<< "$out"
done
check_not "--list leaves out sign-ins for agents that aren't installed" grep -qE ' (claude|opencode|hermes) ' <<< "$out"
check_not "--list leaves out the sandbox item without WinBoat" grep -q ' sandbox ' <<< "$out"
check "the menu quits on q" bash -c "echo q | '$CONNECTOR/configure' | grep -q 'Federated Core on this computer'"
check_not "it doesn't warn that this isn't Pop!_OS" bash -c "echo q | '$CONNECTOR/configure' | grep -q 'made for Pop'"
check_eq "an unknown item exits 2" 2 "$("$CONNECTOR/configure" nonsense > /dev/null; echo $?)"
check "configure core gives up on a Superpanel it can't reach" \
bash -c "printf 'https://superpanel.smoke.invalid\n' | '$CONNECTOR/configure' core | grep -q \"Couldn't reach https://superpanel.smoke.invalid\""
check_not "it doesn't run as root" sudo "$CONNECTOR/configure" --list
}
+54
View File
@@ -0,0 +1,54 @@
# shellcheck shell=bash
# Scenarios set what the runner and items read
# shellcheck disable=SC2034
DESCRIPTION="Email, calendars and contacts in GNOME Online Accounts 3.50, without GNOME"
TIER=quick
scenario() {
local G="$CONNECTOR/configure.d/lib/goa-account" out
step "Installing GNOME Online Accounts and Evolution's data server"
# Evolution itself is large and only shows what's here; its data server is
# what reads Online Accounts
sudo apt-get update > /dev/null && sudo apt-get install -y gnome-online-accounts evolution-data-server > /dev/null 2>&1
check "gnome-online-accounts is installed" pkg_installed gnome-online-accounts
source "$CONNECTOR/configure.d/10-core.sh"
goa_ready() { return 0; }
CORE_DOMAIN=smoke.invalid CORE_EMAIL=jo@smoke.invalid CORE_NAME='Jo "Q" Tester'
core_names
PASSWORD='p\ss "word"' APP_PASSWORD=app-password-1
step "Adding the accounts"
check "setup_nextcloud" setup_nextcloud
check "setup_email, with the usual servers when the domain has no autoconfig" setup_email
check "nextcloud_done" nextcloud_done
check "email_done" email_done
check "adding again changes nothing" setup_email
check_eq "there's one email account" 1 "$(grep -c '^Provider=imap_smtp' "$HOME/.config/goa-1.0/accounts.conf")"
check "IMAP is mail.smoke.invalid over SSL" grep -qx 'ImapHost=mail.smoke.invalid' "$HOME/.config/goa-1.0/accounts.conf"
check "SMTP uses STARTTLS on 587" grep -qx 'SmtpUseTls=true' "$HOME/.config/goa-1.0/accounts.conf"
check "the name survives quoting" grep -qxF 'Name=Jo "Q" Tester' "$HOME/.config/goa-1.0/accounts.conf"
check_eq "nothing is turned off" "" "$("$G" disabled owncloud "$CORE_USER@nextcloud.$CORE_DOMAIN")"
step "Pausing email, as email-watch does"
check_not "not paused at first" "$G" paused imap_smtp "$CORE_EMAIL"
check "pause" "$G" pause imap_smtp "$CORE_EMAIL"
check "paused" "$G" paused imap_smtp "$CORE_EMAIL"
jq -n '{"imap-password": "new", "smtp-password": "new"}' | "$G" update imap_smtp "$CORE_EMAIL" 2> /dev/null
check_eq "update saves the password; the server can't be reached, so it exits 3" 3 $?
check_not "update ends the pause" "$G" paused imap_smtp "$CORE_EMAIL"
step "Test a Core's account checks"
"$CONNECTOR/system/email-watch" --check-password "$CORE_EMAIL"
check_eq "email-watch can't tell without Nextcloud (1)" 1 $?
FIXES=() FIX_TITLES=() PROBLEMS=0
out="$(test_account "Email" imap_smtp "$CORE_EMAIL" setup_email fix_email enable_email)"
check "an unreachable mail server is a sign-in failure, not a wrong password" grep -q "can't sign in" <<< "$out"
check_not "...and isn't taken as an old password" grep -q "old password" <<< "$out"
step "Removing"
check "remove owncloud" "$G" remove owncloud "$CORE_USER@nextcloud.$CORE_DOMAIN"
check "remove imap_smtp" "$G" remove imap_smtp "$CORE_EMAIL"
check_not "nothing left" email_done
check "no passwords left in the keyring" bash -c '! secret-tool search --all xdg:schema org.gnome.OnlineAccounts 2>&1 | grep -q goa-identity'
}
+81
View File
@@ -0,0 +1,81 @@
# shellcheck shell=bash
# Scenarios set what the runner and items read
# shellcheck disable=SC2034
DESCRIPTION="The Core item's local parts: Superpanel, Element, the Files sidebar, davfs2's secret"
TIER=quick
scenario() {
local fav="$HOME/.config/cosmic/com.system76.CosmicFiles/v1/favorites" F="$CONNECTOR/configure.d/lib/cosmic-favorites"
source "$CONNECTOR/configure.d/10-core.sh"
CORE_DOMAIN=smoke.invalid CORE_EMAIL=jo@smoke.invalid CORE_NAME=Jo
core_names
step "Superpanel"
check "setup_superpanel without its icon" setup_superpanel
check "superpanel_done" superpanel_done
check "it opens Superpanel" grep -qx 'Exec=xdg-open https://superpanel.smoke.invalid' "$SUPERPANEL_DESKTOP"
check "it falls back to a theme icon" grep -qx 'Icon=applications-internet' "$SUPERPANEL_DESKTOP"
step "Element"
check_eq "without Flatpak, Element's config is in ~/.config" "$HOME/.config/Element/config.json" "$ELEMENT_CONFIG"
mkdir -p "$HOME/.config/Element" && echo '{"brand": "Element"}' > "$ELEMENT_CONFIG"
check "setup_element" setup_element
check_eq "it points at the Core's Matrix server" "https://matrix.smoke.invalid" \
"$(jq -r '.default_server_config["m.homeserver"].base_url' "$ELEMENT_CONFIG")"
check_eq "it keeps the rest" Element "$(jq -r .brand "$ELEMENT_CONFIG")"
flatpak_installed() { [ "$1" = im.riot.Riot ]; }
check_eq "with the Flatpak, it's in the app's folder" \
"$HOME/.var/app/im.riot.Riot/config/Element/config.json" "$(element_config)"
unset -f flatpak_installed
source "$CONNECTOR/configure.d/lib/packages.sh"
step "The COSMIC Files sidebar"
check_not "no favorites file yet" test -f "$fav"
check "sidebar_add" sidebar_add /mnt/smoke.invalid smoke.invalid
check "COSMIC Files' defaults are kept" grep -q '^ Home,$' "$fav"
check "it's added as Named" grep -qF 'Named(path: "/mnt/smoke.invalid", name: "smoke.invalid")' "$fav"
check "sidebar_has" sidebar_has /mnt/smoke.invalid
check "it's in GTK's bookmarks" grep -qx 'file:///mnt/smoke.invalid smoke.invalid' "$HOME/.config/gtk-3.0/bookmarks"
# As COSMIC Files writes it (ron's pretty printer), with a network place
# and a name that needs escaping
cat > "$fav" << 'RON'
[
Home,
Documents,
Network(
uri: "sftp://nas.local/",
name: "NAS, \"main\"",
path: "/run/user/1000/gvfs/sftp:host=nas.local",
),
Path("/mnt/a (b)"),
Named(
path: "/mnt/smoke.invalid",
name: "old name",
),
]
RON
check "adding again replaces the old entry" "$F" add /mnt/smoke.invalid 'smoke "q" \ x'
check_eq "...once" 1 "$(grep -c '/mnt/smoke.invalid' "$fav")"
check "a name with quotes and backslashes is escaped" grep -qF 'name: "smoke \"q\" \\ x")' "$fav"
check "the network place survives" grep -qF 'Network(' "$fav"
check "a Path(...) is found" "$F" has '/mnt/a (b)'
check "remove" "$F" remove '/mnt/a (b)'
check_not "it's gone" "$F" has '/mnt/a (b)'
check "sidebar_remove" sidebar_remove /mnt/smoke.invalid
check_not "removed from COSMIC Files" sidebar_has /mnt/smoke.invalid
check_not "removed from GTK's bookmarks" grep -q smoke.invalid "$HOME/.config/gtk-3.0/bookmarks"
check_eq "three places are left" 3 "$(python3 -c "
import importlib.machinery, importlib.util, sys
loader = importlib.machinery.SourceFileLoader('f', '$F')
m = importlib.util.module_from_spec(importlib.util.spec_from_loader('f', loader)); loader.exec_module(m)
print(len(m.load()))")"
echo 'not ron' > "$fav"
check_not "a file that isn't a RON list is left alone" "$F" add /mnt/x x
check_eq "...unchanged" "not ron" "$(cat "$fav")"
step "davfs2's secret"
APP_PASSWORD='a"b\c d'
check "save_files_secret" save_files_secret
check_eq "only you can read it" 600 "$(stat -c %a "$HOME/.davfs2/secrets")"
check_eq "the app password reads back" 'a"b\c d' "$(files_app_password)"
}
+45
View File
@@ -0,0 +1,45 @@
# shellcheck shell=bash
# Scenarios set what the runner and items read
# shellcheck disable=SC2034
DESCRIPTION="A backup with Ubuntu's restic and rclone to a local WebDAV server standing in for Nextcloud"
TIER=quick
scenario() {
local served="$HOME/served" webdav="http://127.0.0.1:8080/remote.php/dav/files/jo"
step "Installing restic and rclone"
sudo apt-get update > /dev/null && sudo apt-get install -y restic rclone > /dev/null 2>&1
check "restic and rclone are installed" pkg_installed restic rclone
echo "restic $(restic version | cut -d' ' -f2), $(rclone version | head -n 1)"
# Nextcloud's WebDAV, and status.php, which the backup waits for
mkdir -p "$served/remote.php/dav/files/jo"
echo '{"installed":true,"maintenance":false}' > "$served/status.php"
rclone serve webdav "$served" --addr 127.0.0.1:8080 --user jo --pass app-password > "$HOME/serve.log" 2>&1 &
sleep 2
step "Setting up, as configure backup does"
mkdir -p "$CONF_DIR"
printf 'BACKUP_WEBDAV=%q\nBACKUP_USER=jo\nBACKUP_DIR=.backup-smoke\n' "$webdav" > "$CONF_DIR/backup.conf"
printf app-password | secret-tool store --label test federated-connector backup item nextcloud url "$webdav"
printf 'pass phrase' | secret-tool store --label test federated-connector backup item passphrase url "$webdav/.backup-smoke"
source "$CONNECTOR/system/backup-env.sh"
check_eq "restic uses rclone's WebDAV" "rclone::webdav:.backup-smoke" "$RESTIC_REPOSITORY"
check "the passphrase comes from the keyring" test -n "$RESTIC_PASSWORD_COMMAND"
check "rclone reaches the server with the app password" rclone lsf ":webdav:"
check "restic init" restic init
step "A backup"
mkdir -p "$HOME/Documents" "$HOME/.cache/big"
echo "keep me" > "$HOME/Documents/note.txt"
echo "leave me out" > "$HOME/.cache/big/file"
check "system/backup" "$CONNECTOR/system/backup"
check_eq "there's one snapshot" 1 "$(restic snapshots --json | jq length)"
check "a file restores from it" restic restore latest --target "$HOME/restored" --include "$HOME/Documents"
check_eq "...as it was" "keep me" "$(cat "$HOME/restored$HOME/Documents/note.txt")"
check_not "caches are left out" bash -c "restic ls latest | grep -q '/.cache/big'"
check_not "the install is left out" bash -c "restic ls latest | grep -q '/.local/share/federated-connector/'"
step "Without the passphrase in the keyring"
secret-tool clear federated-connector backup item passphrase url "$webdav/.backup-smoke"
check_not "system/backup fails" "$CONNECTOR/system/backup"
}
+48
View File
@@ -0,0 +1,48 @@
# shellcheck shell=bash
# Scenarios set what the runner and items read
# shellcheck disable=SC2034
DESCRIPTION="Node.js and srt download; a stand-in agent in the sandbox"
TIER=all
PRIVILEGED=1
scenario() {
local project="$HOME/Projects/demo" out
source "$CONNECTOR/configure.d/30-agents.sh"
sudo apt-get update > /dev/null && sudo apt-get install -y "${SANDBOX_PACKAGES[@]}" > /dev/null 2>&1
check "bubblewrap works" bwrap_works
step "Node.js and srt"
check_not "Ubuntu's Node.js, if any, isn't new enough or isn't there" node_ok
check "install_srt" install_srt
check "Node.js is in ~/.local/share/federated-connector/node" test -x "$FC_TOOLS/node/bin/node"
check "srt is found" srt_path
step "A stand-in agent"
mkdir -p "$HOME/.local/bin" "$HOME/.ssh" "$project"
echo secret > "$HOME/.ssh/id_test"
cat > "$HOME/.local/bin/opencode" << 'AGENT'
#!/bin/bash
case "$1" in
read-ssh) cat ~/.ssh/id_test ;;
write-home) echo x > ~/outside ;;
write-here) echo x > ./inside ;;
fetch) curl -sf -o /dev/null --max-time 20 "$2" ;;
esac
AGENT
chmod +x "$HOME/.local/bin/opencode"
cd "$project" || return
check_not "it can't read ~/.ssh" "$SANDBOX_BIN/opencode" read-ssh
check_not "it can't write outside its project" "$SANDBOX_BIN/opencode" write-home
check "it can write in its project" "$SANDBOX_BIN/opencode" write-here
check "it reaches an allowed site" "$SANDBOX_BIN/opencode" fetch https://registry.npmjs.org/
check_not "it doesn't reach others" "$SANDBOX_BIN/opencode" fetch https://example.com/
check "unsandboxed runs it directly" "$SANDBOX_BIN/unsandboxed" opencode write-home
cd "$HOME" || return
out="$("$SANDBOX_BIN/opencode" write-here 2>&1)"
check "it won't start in your home folder" grep -q "Start opencode from a project directory" <<< "$out"
step "Typing its name runs it in the sandbox"
check "put_on_path" put_on_path
check "on_path" on_path
check_eq "a new bash finds the sandboxed one first" "$SANDBOX_BIN/opencode" "$(bash -ic 'command -v opencode' < /dev/null 2> /dev/null)"
}
+43
View File
@@ -0,0 +1,43 @@
# shellcheck shell=bash
# Scenarios set what the runner and items read
# shellcheck disable=SC2034
DESCRIPTION="What configure expects of Ubuntu's packages: davfs2, sshfs, GTK's print backend, mise"
TIER=all
scenario() {
sudo apt-get update > /dev/null
step "davfs2, set up as configure core does"
echo "davfs2 davfs2/suid_file boolean true" | sudo debconf-set-selections
sudo apt-get install -y davfs2 > /dev/null 2>&1
check "mount.davfs is setuid, so you can mount without sudo" test -u /usr/sbin/mount.davfs
check "the davfs2 group exists" getent group davfs2
check "davfs2.conf names that group" grep -qE '^#?[[:space:]]*dav_group[[:space:]]+davfs2' /etc/davfs2/davfs2.conf
step "davfs2 installed first, without setuid"
sudo apt-get purge -y davfs2 > /dev/null 2>&1
echo "davfs2 davfs2/suid_file boolean false" | sudo debconf-set-selections
sudo apt-get install -y davfs2 > /dev/null 2>&1
check_not "not setuid" test -u /usr/sbin/mount.davfs
source "$CONNECTOR/configure.d/10-core.sh"
check "davfs2_ready makes it setuid" davfs2_ready
check "...it is" test -u /usr/sbin/mount.davfs
step "sshfs and SMB"
sudo apt-get install -y sshfs smbclient cifs-utils > /dev/null 2>&1
check "fusermount3 is where the SFTP unit expects it" test -x /usr/bin/fusermount3
check "smbclient lists shares with -g" bash -c "smbclient --help 2>&1 | grep -q -- '--grepable'"
step "Printing"
sudo apt-get install -y libgtk-3-0t64 > /dev/null 2>&1
check "GTK's CUPS backend is where setup-printers.sh looks" \
compgen -G '/usr/lib/*/gtk-3.0/*/printbackends/libprintbackend-cups.so'
check "libnss-mdns is a package" apt-cache show libnss-mdns
step "mise's apt repository"
source "$CONNECTOR/configure.d/40-languages.sh"
check "install_mise" install_mise
check "mise runs" mise --version
check "activate" activate
check "a new bash has mise" bash -ic 'command -v mise' < /dev/null
}