Files
omarchy/bin/omarchy-channel-set
T
David Heinemeier HanssonandClaude Fable 5.1 d78ea9e158 Point GitHub URLs at omacom/omarchy instead of basecamp/omarchy
The repo moved to the omacom org. GitHub redirects the old URLs, but
`omarchy channel set dev` was still cloning from basecamp/omarchy, which
left every dev checkout with a stale origin remote that confuses gh
(pr create fails with "No commits between omacom:quattro and
basecamp:<branch>"). Update the clone URL, the quattro upgrade tarball,
the update-confirm release link, the systemd Documentation link, and
the manual.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LSFKDatumRZHB8zqk5CP5C
2026-09-13 17:20:29 +02:00

104 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
# omarchy:summary=Set the Omarchy package channel.
# omarchy:args=<stable|rc|edge|dev>
# omarchy:requires-sudo=true
set -euo pipefail
usage() { echo "Usage: omarchy-channel-set [stable|rc|edge|dev]"; }
fail() { echo "Error: $*" >&2; exit 1; }
confirm_dev() {
cat <<'WARNING'
The dev channel links Omarchy directly to a checkout of the source in ~/omarchy.
It's exclusively intended for developers working on Omarchy itself.
WARNING
gum confirm --default=false "Switch to dev channel?"
}
validate_dev_checkout() {
local checkout="$1"
if [[ -e $checkout && ! -d $checkout/.git ]]; then
fail "$checkout already exists and is not a git checkout."
fi
if [[ -d $checkout/.git && ( ! -d $checkout/bin || ! -d $checkout/default || ! -d $checkout/shell ) ]]; then
fail "$checkout is a git checkout, but it does not look like Omarchy."
fi
}
link_dev_checkout() {
local checkout="$1"
[[ -d $checkout/.git ]] || git clone https://github.com/omacom/omarchy.git "$checkout"
omarchy-dev-link "$checkout" --no-reboot
}
(( $# > 0 )) || { usage; exit 1; }
dev_checkout=""
channel="$1"
leaving_dev=0
case "$channel" in
stable)
pacman_channel=stable
packages=(omarchy omarchy-settings)
;;
rc)
pacman_channel=rc
packages=(omarchy omarchy-settings)
;;
edge)
pacman_channel=edge
packages=(omarchy-dev omarchy-settings-dev)
;;
dev)
confirm_dev || { echo "Cancelled."; exit 0; }
dev_checkout="$HOME/omarchy"
validate_dev_checkout "$dev_checkout"
pacman_channel=edge
packages=(omarchy-dev omarchy-settings-dev)
;;
*)
echo "Unknown channel: $channel" >&2
usage >&2
exit 1
;;
esac
# A failure past this point leaves the channel switch half-applied, so say how
# to pick it back up rather than dying silently under set -e.
trap 'echo -e "\nThe channel switch did not complete. Review the error above, then rerun: omarchy-channel-set '"$channel"'" >&2' ERR
if [[ -z $dev_checkout && $OMARCHY_PATH != "/usr/share/omarchy" ]]; then
leaving_dev=1
fi
if [[ -n $dev_checkout ]]; then
link_dev_checkout "$dev_checkout"
export OMARCHY_PATH="$dev_checkout"
export PATH="$OMARCHY_PATH/bin:$PATH"
omarchy-state set reboot-required
fi
omarchy-refresh-pacman "$pacman_channel"
# --ask 4 accepts omarchy <-> omarchy-dev replacement prompts without file overwrites.
omarchy-update-pacman -S --needed --noconfirm --ask 4 "${packages[@]}"
if [[ -z $dev_checkout ]]; then
omarchy-dev-unlink --no-reboot
export OMARCHY_PATH=/usr/share/omarchy
if (( leaving_dev )); then
omarchy-state set reboot-required
fi
fi
omarchy-update -y