Add dev package mode to Omarchy 4 upgrade
This commit is contained in:
+52
-26
@@ -1,15 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Upgrade a legacy Omarchy install to the package-backed Omarchy 4 layout.
|
||||
# omarchy:args=[--yes] [--reboot] [--channel stable|rc|edge] [--user USER]
|
||||
# omarchy:examples=omarchy upgrade to 4
|
||||
# omarchy:args=[--yes] [--reboot] [--dev] [--channel stable|rc|edge] [--user USER]
|
||||
# omarchy:examples=omarchy upgrade to 4 | omarchy upgrade to 4 --dev
|
||||
# omarchy:requires-sudo=true
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
cat <<'USAGE'
|
||||
Usage: omarchy-upgrade-to-4 [--yes] [--reboot] [--channel stable|rc|edge] [--user USER]
|
||||
Usage: omarchy-upgrade-to-4 [--yes] [--reboot] [--dev] [--channel stable|rc|edge] [--user USER]
|
||||
|
||||
Upgrade any pre-4 Omarchy install to the package-backed Omarchy 4 layout.
|
||||
This script is intentionally self-contained so it can be shipped as a command
|
||||
@@ -18,6 +18,7 @@ in Omarchy 3.8.x or run directly with curl | bash on older systems.
|
||||
Options:
|
||||
-y, --yes Do not prompt before upgrading
|
||||
--reboot Reboot automatically after a successful upgrade
|
||||
--dev Use stop-gap packages from the [omarchy-dev] repo
|
||||
--channel stable|rc|edge Override detected Omarchy package channel
|
||||
--user USER User account to refresh after package install
|
||||
-h, --help Show this help
|
||||
@@ -54,6 +55,7 @@ channel_override="${OMARCHY_UPGRADE_CHANNEL:-${OMARCHY_CHANNEL:-${OMARCHY_MIRROR
|
||||
target_user="${OMARCHY_INSTALL_USER:-}"
|
||||
yes=0
|
||||
auto_reboot=0
|
||||
use_dev_packages=${OMARCHY_UPGRADE_DEV:-0}
|
||||
|
||||
while (($#)); do
|
||||
case "$1" in
|
||||
@@ -65,6 +67,10 @@ while (($#)); do
|
||||
auto_reboot=1
|
||||
shift
|
||||
;;
|
||||
--dev)
|
||||
use_dev_packages=1
|
||||
shift
|
||||
;;
|
||||
--channel)
|
||||
channel_override="${2:-}"
|
||||
shift 2
|
||||
@@ -83,6 +89,12 @@ while (($#)); do
|
||||
esac
|
||||
done
|
||||
|
||||
case "$use_dev_packages" in
|
||||
1|true|yes|on) use_dev_packages=1 ;;
|
||||
0|false|no|off|"") use_dev_packages=0 ;;
|
||||
*) fail "Invalid OMARCHY_UPGRADE_DEV value '$use_dev_packages'. Use 1/0, true/false, or pass --dev." ;;
|
||||
esac
|
||||
|
||||
if ! command -v pacman >/dev/null 2>&1; then
|
||||
fail "This upgrade is only supported on Arch/Omarchy systems with pacman."
|
||||
fi
|
||||
@@ -313,9 +325,12 @@ case "$channel" in
|
||||
esac
|
||||
|
||||
if (( ! yes )); then
|
||||
package_mode="production Omarchy packages"
|
||||
(( use_dev_packages )) && package_mode="stop-gap packages from [omarchy-dev]"
|
||||
|
||||
cat <<EOF
|
||||
|
||||
This will upgrade Omarchy for user '$target_user' to Omarchy 4 using the '$channel' channel.
|
||||
This will upgrade Omarchy for user '$target_user' to Omarchy 4 using the '$channel' channel and $package_mode.
|
||||
|
||||
It will install the package-backed Omarchy 4 stack, overwrite files previously
|
||||
written by the legacy installer, remove retired default packages, and apply the
|
||||
@@ -372,27 +387,28 @@ configure_pacman_channel() {
|
||||
|
||||
as_root cp -f /etc/pacman.conf "/etc/pacman.conf.omarchy-upgrade-to-4.$backup_suffix.bak"
|
||||
|
||||
# TEMPORARY: also inject [omarchy-dev] above [omarchy] so dev-built
|
||||
# packages from share.heyoodle.com (see omarchy-pkgs/bin/publish-dev-repo)
|
||||
# take precedence while the omarchy-4 stack is being iterated on. Revert
|
||||
# this block once the production edge/stable/rc channels have caught up.
|
||||
# Drop any stale [omarchy-dev] block every time. Re-add it only for the
|
||||
# stop-gap dev package mode so normal upgrades resolve the real tagged
|
||||
# packages from [omarchy] once they exist.
|
||||
local dev_server='https://share.heyoodle.com/omarchy/dev/$arch'
|
||||
local tmp
|
||||
|
||||
tmp=$(mktemp)
|
||||
awk -v server="$package_server" -v dev_server="$dev_server" '
|
||||
BEGIN { in_omarchy = 0; in_dev = 0; wrote = 0 }
|
||||
awk -v server="$package_server" -v dev_server="$dev_server" -v use_dev="$use_dev_packages" '
|
||||
BEGIN { in_omarchy = 0; in_dev = 0; wrote = 0; use_dev += 0 }
|
||||
/^\[omarchy-dev\]$/ {
|
||||
# Drop any existing [omarchy-dev] block; we re-emit it next to [omarchy].
|
||||
in_dev = 1
|
||||
in_omarchy = 0
|
||||
next
|
||||
}
|
||||
/^\[omarchy\]$/ {
|
||||
if (!wrote) {
|
||||
print "[omarchy-dev]"
|
||||
print "SigLevel = Never"
|
||||
print "Server = " dev_server
|
||||
print ""
|
||||
if (use_dev) {
|
||||
print "[omarchy-dev]"
|
||||
print "SigLevel = Never"
|
||||
print "Server = " dev_server
|
||||
print ""
|
||||
}
|
||||
print "[omarchy]"
|
||||
print "SigLevel = Optional TrustAll"
|
||||
print "Server = " server
|
||||
@@ -407,10 +423,12 @@ configure_pacman_channel() {
|
||||
END {
|
||||
if (!wrote) {
|
||||
print ""
|
||||
print "[omarchy-dev]"
|
||||
print "SigLevel = Never"
|
||||
print "Server = " dev_server
|
||||
print ""
|
||||
if (use_dev) {
|
||||
print "[omarchy-dev]"
|
||||
print "SigLevel = Never"
|
||||
print "Server = " dev_server
|
||||
print ""
|
||||
}
|
||||
print "[omarchy]"
|
||||
print "SigLevel = Optional TrustAll"
|
||||
print "Server = " server
|
||||
@@ -535,16 +553,23 @@ migrate_1password_beta_package() {
|
||||
}
|
||||
|
||||
install_omarchy_4_packages() {
|
||||
# omarchy-limine and omarchy-dev-tools are no longer separate packages:
|
||||
# omarchy-limine's content (bootloader + snapper configs) folded into
|
||||
# omarchy-settings, and bin/omarchy-dev-* now ships with omarchy itself.
|
||||
# The bootloader stack (limine, snapper, etc.) is hard-depended by
|
||||
# the omarchy package, so it'll be pulled in automatically.
|
||||
# Until Omarchy 4 is tagged and published for real, --dev installs the
|
||||
# stop-gap package names from [omarchy-dev]. They provide/conflict the real
|
||||
# names so testers can later move to omarchy/omarchy-settings cleanly.
|
||||
local omarchy_package=omarchy
|
||||
local settings_package=omarchy-settings
|
||||
if (( use_dev_packages )); then
|
||||
omarchy_package=omarchy-dev
|
||||
settings_package=omarchy-settings-dev
|
||||
fi
|
||||
|
||||
# The bootloader stack (limine, snapper, etc.) is hard-depended by the
|
||||
# Omarchy package, so it'll be pulled in automatically.
|
||||
local core_packages=(
|
||||
omarchy-keyring
|
||||
omarchy-settings
|
||||
"$settings_package"
|
||||
omarchy-nvim
|
||||
omarchy
|
||||
"$omarchy_package"
|
||||
# checkupdates support for update tooling
|
||||
fakeroot
|
||||
pacman-contrib
|
||||
@@ -552,6 +577,7 @@ install_omarchy_4_packages() {
|
||||
local base_packages=()
|
||||
|
||||
log "Installing Omarchy 4 packages"
|
||||
(( use_dev_packages )) && log "Using stop-gap packages from [omarchy-dev]"
|
||||
# --noconfirm answers "no" to conflict-removal prompts. --ask 4 preselects
|
||||
# removing the conflicting package, which is required for legacy packages like
|
||||
# ttf-jetbrains-mono-nerd -> ttf-jetbrains-mono-nerd-basic.
|
||||
|
||||
Reference in New Issue
Block a user