diff --git a/README.md b/README.md index cb6fe3b..5b75ab7 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ and nothing to re-apply after somebody else's release. | [themes.md](docs/themes.md) | the palette pipeline and how to add a theme | | [widgets.md](docs/widgets.md) | the ported GTK widgets and where they went | | [menu.md](docs/menu.md) | the menu tree and what was trimmed | +| [packages.md](docs/packages.md) | leaving the Omarchy repository, and updating | | [upstream.md](docs/upstream.md) | the fork base, for diffing later | ## Install diff --git a/bin/blob-repo-migrate b/bin/blob-repo-migrate new file mode 100755 index 0000000..1139233 --- /dev/null +++ b/bin/blob-repo-migrate @@ -0,0 +1,152 @@ +#!/bin/bash + +# blob:summary=Move off the Omarchy package repository and remove it from pacman.conf +# blob:args=[--apply] +# blob:requires-sudo=true + +set -e + +pacman_conf=/etc/pacman.conf +apply=false +[[ ${1-} == --apply ]] && apply=true + +drop_packages=( + omarchy + omarchy-keyring + omarchy-settings + omarchy-nvim + omacalc + omacut + omawrite + tensaku + tobi-try + cliamp + herdr + ttfx + linux-omarchy + linux-omarchy-headers + asdcontrol +) + +substitutions=( + "ttf-jetbrains-mono-nerd-basic:ttf-jetbrains-mono-nerd" + "hyprland-preview-share-picker:hyprland-preview-share-picker-git" +) + +aur_managed=( + aether + limine-mkinitcpio-hook + limine-snapper-sync + localsend + minecraft-launcher + mise-bin + spotify + ttf-ia-writer + tzupdate + ufw-docker + visual-studio-code-bin + xdg-terminal-exec + yaru-icon-theme + yay +) + +installed() { + pacman -Q "$1" &>/dev/null +} + +heading() { + printf '\n%s\n' "$1" +} + +if ! grep -q '^\[omarchy\]' "$pacman_conf"; then + echo "The [omarchy] repository is already absent from $pacman_conf." + exit 0 +fi + +echo "Migrating off the Omarchy package repository." +echo +echo "Booted kernel: $(uname -r)" + +if ! installed linux; then + echo + echo "REFUSING: the stock 'linux' package is not installed, and this would" >&2 + echo "remove linux-omarchy. Install 'linux' first." >&2 + exit 1 +fi + +heading "Remove (Omarchy's own software, and hardware support this machine does not use):" +for package in "${drop_packages[@]}"; do + installed "$package" && echo " $package" +done + +heading "Replace with an equivalent:" +for pair in "${substitutions[@]}"; do + from=${pair%%:*} + to=${pair##*:} + installed "$from" && echo " $from -> $to" +done + +heading "Keep, rebuilt from the AUR on the next update:" +for package in "${aur_managed[@]}"; do + installed "$package" && echo " $package" +done + +heading "Then: comment out [omarchy] in $pacman_conf and resync." + +if [[ $apply == false ]]; then + echo + echo "This was a dry run. Re-run with --apply to carry it out." + exit 0 +fi + +echo +read -rp "Apply all of the above? [y/N] " answer +[[ $answer == [yY] ]] || exit 0 + +blob-sudo-keepalive + +for pair in "${substitutions[@]}"; do + from=${pair%%:*} + to=${pair##*:} + installed "$from" || continue + echo "Installing $to..." + if pacman -Sl core extra multilib 2>/dev/null | awk -v n="$to" '$2==n {found=1} END {exit !found}'; then + sudo pacman -S --needed --noconfirm "$to" + else + yay -S --needed --noconfirm "$to" + fi + sudo pacman -Rdd --noconfirm "$from" || true +done + +to_remove=() +for package in "${drop_packages[@]}"; do + installed "$package" && to_remove+=("$package") +done +if (( ${#to_remove[@]} )); then + echo "Removing ${#to_remove[@]} package(s)..." + sudo pacman -Rns --noconfirm "${to_remove[@]}" +fi + +backup="$pacman_conf.bak.$(date +%s)" +echo "Backing up $pacman_conf to $backup" +sudo cp "$pacman_conf" "$backup" + +sudo awk ' + /^\[omarchy\]/ { in_block = 1; print "# [omarchy] removed by blob-repo-migrate"; next } + in_block && /^\[/ { in_block = 0 } + in_block && /^Server[[:space:]]*=/ { print "# " $0; next } + in_block && /^[[:space:]]*$/ { in_block = 0 } + { print } +' "$pacman_conf" > /tmp/pacman.conf.blob && sudo install -m644 /tmp/pacman.conf.blob "$pacman_conf" +rm -f /tmp/pacman.conf.blob + +echo "Resyncing package databases..." +sudo pacman -Syy + +heading "Done. Remaining foreign packages (now AUR-managed):" +pacman -Qmq | sed 's/^/ /' + +heading "Next steps:" +echo " blob update rebuilds the AUR packages above from source" +echo " pacman -Qtdq check for orphans the removals left behind" +echo " $backup restore point if anything is wrong" diff --git a/docs/commands.md b/docs/commands.md index b567c93..ba7fdb2 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -430,6 +430,12 @@ of the `blob` listing. | `blob-remove-security-fido2` | Remove FIDO2 authentication from sudo and polkit | - | | `blob-remove-security-sudoless-docker` | Disable sudoless Docker by removing your user from the docker group | - | +## repo + +| Command | Does | Arguments | +| --- | --- | --- | +| `blob-repo-migrate` | Move off the Omarchy package repository and remove it from pacman.conf | [--apply] | + ## restart | Command | Does | Arguments | @@ -614,4 +620,4 @@ of the `blob` listing. ## Totals -290 commands. +291 commands. diff --git a/docs/packages.md b/docs/packages.md new file mode 100644 index 0000000..a6aeacc --- /dev/null +++ b/docs/packages.md @@ -0,0 +1,89 @@ +# Packages + +## Leaving the Omarchy repository + +Omarchy ships its own binary repository, added to `/etc/pacman.conf`: + +``` +[omarchy] +Server = https://pkgs.omarchy.org/stable/$arch +``` + +Thirty-one installed packages came from it. `blob-repo-migrate` moves off it. +Run it dry first; it changes nothing without `--apply`: + +``` +blob repo-migrate +blob repo-migrate --apply +``` + +It refuses to run if the stock `linux` package is not installed, because it +removes `linux-omarchy`. + +## What happens to each package + +### Removed (15) + +Omarchy's own software, plus one hardware helper this machine has no use for: + +`omarchy`, `omarchy-keyring`, `omarchy-settings`, `omarchy-nvim`, `omacalc`, +`omacut`, `omawrite`, `tensaku`, `tobi-try`, `cliamp`, `herdr`, `ttfx`, +`linux-omarchy`, `linux-omarchy-headers`, `asdcontrol`. + +`linux-omarchy` was installed but not booted - the running kernel is stock +`core/linux`, so the machine is not relying on it. `asdcontrol` sets brightness +on Apple Studio Displays and is reachable only from +`blob-brightness-display-apple`. + +### Replaced (2) + +| From | To | Where | +| --- | --- | --- | +| `ttf-jetbrains-mono-nerd-basic` | `ttf-jetbrains-mono-nerd` | official `extra` | +| `hyprland-preview-share-picker` | `hyprland-preview-share-picker-git` | AUR | + +The first is Omarchy's trimmed build of a font Arch ships in full. + +### Kept, from the AUR (14) + +`aether`, `limine-mkinitcpio-hook`, `limine-snapper-sync`, `localsend`, +`minecraft-launcher`, `mise-bin`, `spotify`, `ttf-ia-writer`, `tzupdate`, +`ufw-docker`, `visual-studio-code-bin`, `xdg-terminal-exec`, `yaru-icon-theme`, +`yay`. + +All exist in the AUR under the same name. Once the repository is gone, pacman +treats them as foreign and `yay` picks them up, so `blob update` rebuilds them +from source. The first update after migrating therefore takes noticeably longer +than usual. + +Two are worth knowing about: + +- `xdg-terminal-exec` is load-bearing. Every TUI launcher's `Exec=` line calls + it, so if its AUR build ever fails, TUI shortcuts stop opening. +- `aether` is in the AUR at a version newer than the one the repository shipped. + +`quickshell` never came from the Omarchy repository - it is in official `extra`. + +## Updating + +``` +blob update +``` + +Refreshes the keyring, runs `pacman -Syu`, runs `yay -Sua` when the AUR is +reachable, prunes orphans, and sends a notification. `blob update-available` +prints the pending count that the bar's update indicator reads. + +This replaces 27 upstream scripts of channel, migration, and version-pinning +machinery. There are no release channels: there is one repository set, which is +Arch plus the AUR. + +## After migrating + +``` +pacman -Qtdq # orphans the removals left behind +pacman -Qm # everything now AUR-managed +``` + +`blob-repo-migrate` backs up `/etc/pacman.conf` to `pacman.conf.bak.` +before editing, and prints the path.