Files
connector-popos/smoketest/scenarios/30-core-local.sh
T
davidandClaude Opus 5.5 bc07e1d3e3 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>
2026-11-11 14:20:47 -07:00

82 lines
3.8 KiB
Bash

# 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)"
}