Opened again while the last one was still quitting, Launch Services failed with -600 now and then. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
75 lines
3.7 KiB
Bash
75 lines
3.7 KiB
Bash
# shellcheck shell=bash
|
|
DESCRIPTION="The Core item's local parts: the profile, Superpanel's app, Element's and Nextcloud's config"
|
|
TIER=quick
|
|
|
|
source "$CONNECTOR/configure.d/10-core.sh"
|
|
|
|
# The app opens its page and quits. Opened again while the last one is still
|
|
# quitting, Launch Services can fail with -600 (no such process), so this
|
|
# waits for it to be gone and tries once more.
|
|
superpanel_opens() {
|
|
local i
|
|
for i in 1 2 3 4 5 6 7 8 9 10; do
|
|
pgrep -f "$SUPERPANEL_APP/Contents/MacOS/" > /dev/null || break
|
|
sleep 1
|
|
done
|
|
open -g -W "$SUPERPANEL_APP" 2> /dev/null || { sleep 3; open -g -W "$SUPERPANEL_APP"; }
|
|
}
|
|
|
|
scenario() {
|
|
local dir file uuid icon
|
|
CORE_DOMAIN=smoke.invalid CORE_EMAIL=jo@smoke.invalid CORE_NAME='Jo "Q" & <Co>'
|
|
core_names
|
|
PASSWORD='p&ss<w>"rd '\''x' APP_PASSWORD=abc123XYZ
|
|
|
|
step "Mail settings for a domain without autoconfig"
|
|
mail_settings
|
|
check_eq "falls back to the usual IMAP server" "mail.smoke.invalid 993 SSL" "$IMAP_HOST $IMAP_PORT $IMAP_SOCKET"
|
|
check_eq "...and SMTP" "mail.smoke.invalid 587 STARTTLS" "$SMTP_HOST $SMTP_PORT $SMTP_SOCKET"
|
|
|
|
step "The profile"
|
|
dir="$(mktemp -d)"
|
|
file="$dir/$PROFILE_NAME.mobileconfig"
|
|
uuid="$(uuidgen)"
|
|
check "write_profile, and plutil -lint takes it" write_profile "$file" "mail calendar contacts" "$uuid"
|
|
check_eq "the mail password survives escaping" "$PASSWORD" \
|
|
"$(plutil -extract PayloadContent.0.IncomingPassword raw -o - "$file")"
|
|
check_eq "the name survives escaping" "$CORE_NAME" \
|
|
"$(plutil -extract PayloadContent.0.EmailAccountName raw -o - "$file")"
|
|
check_eq "CalDAV payload" com.apple.caldav.account "$(plutil -extract PayloadContent.1.PayloadType raw -o - "$file")"
|
|
check_eq "CardDAV payload" com.apple.carddav.account "$(plutil -extract PayloadContent.2.PayloadType raw -o - "$file")"
|
|
check_eq "payload UUIDs stay the same" "$(stable_uuid "$PROFILE_ID.mail")" \
|
|
"$(plutil -extract PayloadContent.0.PayloadUUID raw -o - "$file")"
|
|
check "profiles show -output stdout-xml gives a property list" bash -c \
|
|
"source '$CONNECTOR/configure.d/lib/profile.sh'; profiles_xml | plutil -lint -s -"
|
|
check_not "profile_installed is false for a profile that isn't" profile_installed "$PROFILE_ID"
|
|
check "open hands the profile to System Settings" open -g "$file"
|
|
skip "Installing it needs a click in System Settings: check that by hand (see README)"
|
|
rm -rf "$dir"
|
|
|
|
step "Superpanel's app"
|
|
SUPERPANEL="https://example.com"
|
|
SUPERPANEL_APP="$HOME/Applications/Superpanel (smoke).app"
|
|
check "setup_superpanel" setup_superpanel
|
|
check "its signature checks out" codesign --verify --deep --strict "$SUPERPANEL_APP"
|
|
check "it opens" superpanel_opens
|
|
icon="$TMPDIR/icon.png"
|
|
check "an icon converts to .icns" bash -c "sips -s format png -z 512 512 \
|
|
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericApplicationIcon.icns \
|
|
--out '$icon' && sips -s format icns '$icon' --out '$SUPERPANEL_APP/Contents/Resources/applet.icns'"
|
|
check "re-signed after the icon changes" codesign --force --sign - "$SUPERPANEL_APP"
|
|
check "...and still checks out" codesign --verify --deep --strict "$SUPERPANEL_APP"
|
|
check "...and opens" superpanel_opens
|
|
|
|
step "Element and Nextcloud"
|
|
MATRIX="https://matrix.smoke.invalid"
|
|
check "setup_element writes Element's config" setup_element
|
|
check_eq "...pointing at the Core" matrix.smoke.invalid \
|
|
"$(json_get 'd.default_server_config["m.homeserver"].server_name' < "$ELEMENT_CONFIG")"
|
|
mkdir -p "$(dirname "$NEXTCLOUD_CFG")"
|
|
printf '[Accounts]\n0\\url=https://nextcloud.smoke.invalid\n' > "$NEXTCLOUD_CFG"
|
|
check "files_done finds the account in nextcloud.cfg" files_done
|
|
printf '[Accounts]\n0\\url=https://nextcloud.smoke.invalid.evil\n' > "$NEXTCLOUD_CFG"
|
|
check_not "...and not another server's" files_done
|
|
}
|