#!/usr/bin/env bash# `flavor_identity <real|dev>` — every identifier the old CottonDB Mac bundle# carried, by flavor, said ONCE for the shell. The app itself is gone from the# tree; what still reads this table is `build-main.yml`'s pre-flavor marker.## Swift's half of this table is `Sources/CottonMailbox/AppFlavor.swift`; the Rust# core's (the data folder, the port, the relay-name rule) is# `crates/cotton-core/src/flavor.rs`.## THIS IS A SOURCED SNIPPET as well as a command (`bash flavor.sh print# <flavor>`). It refuses anything that is not exactly one of the two words, so# a typo is a refusal and never a third app.# `flavor_identity <flavor>` sets the FLAVOR_* variables, or returns 2.flavor_identity() {case"${1:-}"in real) FLAVOR=real FLAVOR_APP_NAME="CottonDB" FLAVOR_EXECUTABLE="CottonDB" FLAVOR_BUNDLE_ID="com.decemberfm.cottondb.mac" FLAVOR_URL_SCHEME="tinmen-cotton" FLAVOR_FEED_URL="https://cottondb.com/mac/appcast.xml" FLAVOR_APP_GROUP="M7V3QVXZQH.com.decemberfm.cotton" FLAVOR_SESSION_HOST_LABEL="com.decemberfm.cotton.session-host" FLAVOR_DATA_DIR_NAME="CottonDB" FLAVOR_PORT=8790 FLAVOR_ICON="assets/icon.icns" ;; dev) FLAVOR=dev FLAVOR_APP_NAME="Cotton Dev"# NO SPACE, and not `CottonDB`: `pgrep -x CottonDB` is how the install# lane and the update watcher find the REAL app, and a dev process under# that name would be quit, waited on or counted as the real one. FLAVOR_EXECUTABLE="CottonDev" FLAVOR_BUNDLE_ID="com.decemberfm.cottondb.mac.dev" FLAVOR_URL_SCHEME="cottondev"# EMPTY, and that is the rule rather than a gap: a dev build must never# ask the real feed and install a real release over itself. FLAVOR_FEED_URL="" FLAVOR_APP_GROUP="M7V3QVXZQH.com.decemberfm.cotton.dev" FLAVOR_SESSION_HOST_LABEL="com.decemberfm.cotton.dev.session-host" FLAVOR_DATA_DIR_NAME="CottonDev" FLAVOR_PORT=8791# The tinted dev icon `derive-icons.ts` writes beside the real one. FLAVOR_ICON="assets/icon-dev.icns" ;; *) echo "[flavor] '${1:-}' is not a flavor — say real or dev" >&2return2 ;;esac FLAVOR_INSTALL_PATH="/Applications/$FLAVOR_APP_NAME.app" FLAVOR_SESSION_HOST_PLIST="$FLAVOR_SESSION_HOST_LABEL.plist" FLAVOR_BUNDLE_NAME="$FLAVOR_APP_NAME.app"return0}# The table as `key=value` lines — what the test reads.flavor_print() { flavor_identity "$1" || return $? printf 'flavor=%s\n'"$FLAVOR" printf 'appName=%s\n'"$FLAVOR_APP_NAME" printf 'bundleName=%s\n'"$FLAVOR_BUNDLE_NAME" printf 'executable=%s\n'"$FLAVOR_EXECUTABLE" printf 'bundleId=%s\n'"$FLAVOR_BUNDLE_ID" printf 'urlScheme=%s\n'"$FLAVOR_URL_SCHEME" printf 'feedUrl=%s\n'"$FLAVOR_FEED_URL" printf 'appGroup=%s\n'"$FLAVOR_APP_GROUP" printf 'sessionHostLabel=%s\n'"$FLAVOR_SESSION_HOST_LABEL" printf 'sessionHostPlist=%s\n'"$FLAVOR_SESSION_HOST_PLIST" printf 'installPath=%s\n'"$FLAVOR_INSTALL_PATH" printf 'dataDirName=%s\n'"$FLAVOR_DATA_DIR_NAME" printf 'port=%s\n'"$FLAVOR_PORT" printf 'icon=%s\n'"$FLAVOR_ICON"}# Run as a command: `bash flavor.sh print <flavor>`.if [ "${BASH_SOURCE[0]}" = "$0" ]; thenset -euo pipefailcase"${1:-}"in print) flavor_print "${2:-}" ;; *) echo "usage: flavor.sh print <real|dev>" >&2; exit2 ;;esacfi