diff --git a/bin/omarchy-cmd-missing b/bin/omarchy-cmd-missing new file mode 100755 index 0000000..fad91ce --- /dev/null +++ b/bin/omarchy-cmd-missing @@ -0,0 +1,9 @@ +#!/bin/bash + +for cmd in "$@"; do + if ! command -v "$cmd" &>/dev/null; then + return 0 + fi +done + +return 1 diff --git a/bin/omarchy-cmd-present b/bin/omarchy-cmd-present new file mode 100755 index 0000000..7c703b4 --- /dev/null +++ b/bin/omarchy-cmd-present @@ -0,0 +1,7 @@ +#!/bin/bash + +for cmd in "$@"; do + command -v "$cmd" &>/dev/null || return 1 +done + +return 0 diff --git a/bin/omarchy-migrate b/bin/omarchy-migrate index 0f7ba64..45cf1ed 100755 --- a/bin/omarchy-migrate +++ b/bin/omarchy-migrate @@ -14,7 +14,7 @@ for file in ~/.local/share/omarchy/migrations/*.sh; do if [[ ! -f "$STATE_DIR/$filename" && ! -f "$STATE_DIR/skipped/$filename" ]]; then echo -e "\e[32m\nRunning migration (${filename%.sh})\e[0m" - if bash -e $file; then + if bash $file; then touch "$STATE_DIR/$filename" else if gum confirm "Migration ${filename%.sh} failed. Skip and continue?"; then diff --git a/bin/omarchy-pkg-add b/bin/omarchy-pkg-add new file mode 100755 index 0000000..1694336 --- /dev/null +++ b/bin/omarchy-pkg-add @@ -0,0 +1,7 @@ +#!/bin/bash + +for pkg in "$@"; do + pacman -Q "$pkg" &>/dev/null || return 1 +done + +return 0 diff --git a/bin/omarchy-pkg-drop b/bin/omarchy-pkg-drop new file mode 100755 index 0000000..fc9da0d --- /dev/null +++ b/bin/omarchy-pkg-drop @@ -0,0 +1,7 @@ +#!/bin/bash + +for pkg in "$@"; do + if pacman -Q "$pkg" &>/dev/null; then + sudo pacman -Rns --noconfirm "$pkg" + fi +done diff --git a/bin/omarchy-pkg-missing b/bin/omarchy-pkg-missing new file mode 100755 index 0000000..9e340af --- /dev/null +++ b/bin/omarchy-pkg-missing @@ -0,0 +1,9 @@ +#!/bin/bash + +for pkg in "$@"; do + if ! pacman -Q "$pkg" &>/dev/null; then + return 0 + fi +done + +return 1 diff --git a/bin/omarchy-pkg-present b/bin/omarchy-pkg-present new file mode 100755 index 0000000..1694336 --- /dev/null +++ b/bin/omarchy-pkg-present @@ -0,0 +1,7 @@ +#!/bin/bash + +for pkg in "$@"; do + pacman -Q "$pkg" &>/dev/null || return 1 +done + +return 0 diff --git a/default/bash/functions b/default/bash/functions index e074f46..152deeb 100644 --- a/default/bash/functions +++ b/default/bash/functions @@ -65,54 +65,3 @@ img2png() { -define png:exclude-chunk=all \ "${1%.*}.png" } - - -pkg-present() { - for pkg in "$@"; do - pacman -Q "$pkg" &>/dev/null || return 1 - done - - return 0 -} - -pkg-missing() { - for pkg in "$@"; do - if ! pacman -Q "$pkg" &>/dev/null; then - return 0 - fi - done - - return 1 -} - -pkg-add() { - for pkg in "$@"; do - if ! pacman -Q "$pkg" &>/dev/null; then - sudo pacman -S --noconfirm --needed "$pkg" - fi - done -} - -pkg-remove() { - for pkg in "$@"; do - if pacman -Q "$pkg" &>/dev/null; then - sudo pacman -Rns --noconfirm "$pkg" - fi - done -} - -cmd-present() { - for cmd in "$@"; do - command -v "$cmd" &>/dev/null || return 1 - done - return 0 -} - -cmd-missing() { - for cmd in "$@"; do - if ! command -v "$cmd" &>/dev/null; then - return 0 - fi - done - return 1 -} diff --git a/migrations/1751134562.sh b/migrations/1751134562.sh deleted file mode 100644 index 8291842..0000000 --- a/migrations/1751134562.sh +++ /dev/null @@ -1,3 +0,0 @@ -echo "Ensure new pkg/cmd functions are available to old-run migrations" - -source $OMARCHY_PATH/default/bash/functions diff --git a/migrations/1751135253.sh b/migrations/1751135253.sh index 821dd6b..c076657 100644 --- a/migrations/1751135253.sh +++ b/migrations/1751135253.sh @@ -1,3 +1,3 @@ echo "Add missing installation of bat (used by the ff alias)" -pkg-add bat +omarchy-pkg-add bat diff --git a/migrations/1751510848.sh b/migrations/1751510848.sh index d1485e9..6b289d4 100644 --- a/migrations/1751510848.sh +++ b/migrations/1751510848.sh @@ -1,3 +1,3 @@ echo "Installing missing fd terminal tool for finding files" -pkg-add fd +omarchy-pkg-add fd diff --git a/migrations/1751667620.sh b/migrations/1751667620.sh index d19aafa..d93c600 100644 --- a/migrations/1751667620.sh +++ b/migrations/1751667620.sh @@ -1,9 +1,9 @@ echo "Switching from vlc to mpv for the default video player" -if cmd-missing mpv; then - pkg-remove vlc +if omarchy-cmd-missing mpv; then + omarchy-pkg-drop vlc rm ~/.local/share/applications/vlc.desktop - pkg-add mpv + omarchy-pkg-add mpv xdg-mime default mpv.desktop video/mp4 xdg-mime default mpv.desktop video/x-msvideo xdg-mime default mpv.desktop video/x-matroska diff --git a/migrations/1751672984.sh b/migrations/1751672984.sh index e423526..b2d9ecb 100644 --- a/migrations/1751672984.sh +++ b/migrations/1751672984.sh @@ -1,3 +1,3 @@ echo "Add LocalSend as new default application" -pkg-add localsend +omarchy-pkg-add localsend diff --git a/migrations/1751679069.sh b/migrations/1751679069.sh index cee3def..abe68a4 100644 --- a/migrations/1751679069.sh +++ b/migrations/1751679069.sh @@ -1,3 +1,3 @@ echo "Install ffmpegthumbnailer for video thumbnails in the file manager" -pkg-add ffmpegthumbnailer +omarchy-pkg-add ffmpegthumbnailer diff --git a/migrations/1751821819.sh b/migrations/1751821819.sh index 0b78cd2..dc282c2 100644 --- a/migrations/1751821819.sh +++ b/migrations/1751821819.sh @@ -1,3 +1,3 @@ echo "Install bash-completion" -pkg-add bash-completion +omarchy-pkg-add bash-completion diff --git a/migrations/1751887718.sh b/migrations/1751887718.sh index a3643ea..3d3f401 100644 --- a/migrations/1751887718.sh +++ b/migrations/1751887718.sh @@ -1,6 +1,6 @@ echo "Install Impala as new wifi selection TUI" -if cmd-missing impala; then - pkg-add impala +if omarchy-cmd-missing impala; then + omarchy-pkg-add impala omarchy-refresh-waybar fi diff --git a/migrations/1752082381.sh b/migrations/1752082381.sh index 3f3a88e..e351fd9 100644 --- a/migrations/1752082381.sh +++ b/migrations/1752082381.sh @@ -1,3 +1,3 @@ echo "Adding gnome-keyring to make 1password work with 2FA codes" -pkg-add gnome-keyring +omarchy-pkg-add gnome-keyring diff --git a/migrations/1752091783.sh b/migrations/1752091783.sh index e0339ea..b8b5306 100644 --- a/migrations/1752091783.sh +++ b/migrations/1752091783.sh @@ -1,4 +1,4 @@ echo "Install Plymouth splash screen" -pkg-add uwsm plymouth +omarchy-pkg-add uwsm plymouth source "$OMARCHY_PATH/install/login/plymouth.sh" diff --git a/migrations/1752292967.sh b/migrations/1752292967.sh index b91bae5..d587fc4 100644 --- a/migrations/1752292967.sh +++ b/migrations/1752292967.sh @@ -1,6 +1,6 @@ echo "Update to use UWSM and seamless login" -if cmd-missing uwsm; then +if omarchy-cmd-missing uwsm; then sudo rm -f /etc/systemd/system/getty@tty1.service.d/override.conf sudo rmdir /etc/systemd/system/getty@tty1.service.d/ 2>/dev/null || true diff --git a/migrations/1752678932.sh b/migrations/1752678932.sh index 8fdb22a..915a74d 100644 --- a/migrations/1752678932.sh +++ b/migrations/1752678932.sh @@ -1,3 +1,3 @@ echo "Install missing docker-buildx package for out-of-the-box Kamal compatibility" -pkg-add docker-buildx +omarchy-pkg-add docker-buildx diff --git a/migrations/1752885858.sh b/migrations/1752885858.sh index 797af4a..2d2b25a 100644 --- a/migrations/1752885858.sh +++ b/migrations/1752885858.sh @@ -1,3 +1,3 @@ echo "Install slurp + wl-screenrec for new ALT+PrintScreen screen recorder" -pkg-add slurp wl-screenrec +omarchy-pkg-add slurp wl-screenrec diff --git a/migrations/1752896442.sh b/migrations/1752896442.sh index 71df10a..f8fa9a8 100644 --- a/migrations/1752896442.sh +++ b/migrations/1752896442.sh @@ -1,8 +1,8 @@ echo "Replace volume control GUI with a TUI" -if cmd-missing wiremix; then - pkg-add wiremix - pkg-remove pavucontrol +if omarchy-cmd-missing wiremix; then + omarchy-pkg-add wiremix + omarchy-pkg-drop pavucontrol omarchy-refresh-applications omarchy-refresh-waybar fi diff --git a/migrations/1752897642.sh b/migrations/1752897642.sh index 119d419..1b4b1f8 100644 --- a/migrations/1752897642.sh +++ b/migrations/1752897642.sh @@ -1,3 +1,3 @@ echo "Remove needless fcitx5-configtool package" -pkg-remove fcitx5-configtool +omarchy-pkg-drop fcitx5-configtool diff --git a/migrations/1752955912.sh b/migrations/1752955912.sh index f3d3285..fa55477 100644 --- a/migrations/1752955912.sh +++ b/migrations/1752955912.sh @@ -1,3 +1,3 @@ echo "Install satty for the new screenshot flow" -pkg-add satty +omarchy-pkg-add satty diff --git a/migrations/1752981883.sh b/migrations/1752981883.sh index 3bb6b21..34a5395 100644 --- a/migrations/1752981883.sh +++ b/migrations/1752981883.sh @@ -1,9 +1,9 @@ echo "Replace wofi with walker as the default launcher" -if cmd-missing walker; then - pkg-add walker-bin libqalculate +if omarchy-cmd-missing walker; then + omarchy-pkg-add walker-bin libqalculate - pkg-remove wofi + omarchy-pkg-drop wofi rm -rf ~/.config/wofi mkdir -p ~/.config/walker diff --git a/migrations/1753138691.sh b/migrations/1753138691.sh index 79928c9..d9197ba 100644 --- a/migrations/1753138691.sh +++ b/migrations/1753138691.sh @@ -1,6 +1,6 @@ echo "Install swayOSD to show volume status" -if cmd-missing swayosd-server; then - pkg-add swayosd +if omarchy-cmd-missing swayosd-server; then + omarchy-pkg-add swayosd setsid uwsm app -- swayosd-server &>/dev/null & fi diff --git a/migrations/1753176520.sh b/migrations/1753176520.sh index c6ae1dd..186b8a7 100644 --- a/migrations/1753176520.sh +++ b/migrations/1753176520.sh @@ -1,3 +1,3 @@ echo "Install wf-recorder for screen recording for nvidia" -pkg-add wf-recorder +omarchy-pkg-add wf-recorder diff --git a/migrations/1753495989.sh b/migrations/1753495989.sh index 2a25942..09f164a 100644 --- a/migrations/1753495989.sh +++ b/migrations/1753495989.sh @@ -1,6 +1,6 @@ echo "Allow updating of timezone by right-clicking on the clock (or running omarchy-cmd-tzupdate)" -if cmd-missing tzupdate; then +if omarchy-cmd-missing tzupdate; then $OMARCHY_PATH/install/config/timezones.sh omarchy-refresh-waybar fi diff --git a/migrations/1754215533.sh b/migrations/1754215533.sh index a034dff..2657b62 100644 --- a/migrations/1754215533.sh +++ b/migrations/1754215533.sh @@ -1,7 +1,7 @@ echo "Enable auto-discovery of network printers" if [[ ! -f /etc/systemd/resolved.conf.d/10-disable-multicast.conf ]]; then - pkg-add avahi nss-mdns + omarchy-pkg-add avahi nss-mdns # Disable multicast dns in resolved. Avahi will provide this for better network printer discovery sudo mkdir -p /etc/systemd/resolved.conf.d @@ -10,7 +10,7 @@ if [[ ! -f /etc/systemd/resolved.conf.d/10-disable-multicast.conf ]]; then fi if ! grep -q '^CreateRemotePrinters Yes' /etc/cups/cups-browsed.conf; then - pkg-add cups-browsed + omarchy-pkg-add cups-browsed # Enable automatically adding remote printers echo 'CreateRemotePrinters Yes' | sudo tee -a /etc/cups/cups-browsed.conf sudo systemctl enable --now cups-browsed.service diff --git a/migrations/1754221967.sh b/migrations/1754221967.sh index 24ef64c..b1e42b7 100644 --- a/migrations/1754221967.sh +++ b/migrations/1754221967.sh @@ -1,3 +1,3 @@ echo "Add support for accessing Android phone data via file manager" -pkg-add gvfs-mtp +omarchy-pkg-add gvfs-mtp diff --git a/migrations/1754509222.sh b/migrations/1754509222.sh index b9daaaa..48f3c85 100644 --- a/migrations/1754509222.sh +++ b/migrations/1754509222.sh @@ -1,3 +1,3 @@ echo "Add xmlstarlet needed for updating fonts via Omarchy menu" -pkg-add xmlstarlet +omarchy-pkg-add xmlstarlet diff --git a/migrations/1754984734.sh b/migrations/1754984734.sh index d9f6cf1..843e4a0 100644 --- a/migrations/1754984734.sh +++ b/migrations/1754984734.sh @@ -1,6 +1,6 @@ echo "Configure Docker to use the host's DNS resolver" -if cmd-present docker; then +if omarchy-cmd-present docker; then # If the daemon configuration has been changed since we wrote it, leave it as-is ORIGINAL_CONFIG='{"log-driver":"json-file","log-opts":{"max-size":"10m","max-file":"5"}}' diff --git a/migrations/1755164105.sh b/migrations/1755164105.sh index c5e3e10..26ba519 100644 --- a/migrations/1755164105.sh +++ b/migrations/1755164105.sh @@ -9,9 +9,9 @@ set_theme_colors() { fi } -if cmd-present chromium; then - pkg-remove chromium - pkg-add omarchy-chromium +if omarchy-cmd-present chromium; then + omarchy-pkg-drop chromium + omarchy-pkg-add omarchy-chromium if pgrep -x chromium; then if gum confirm "Chromium must be restarted. Ready?"; then diff --git a/migrations/1755436367.sh b/migrations/1755436367.sh index 38fd6f3..e7c8970 100644 --- a/migrations/1755436367.sh +++ b/migrations/1755436367.sh @@ -1,6 +1,6 @@ echo "Add minimal starship prompt to terminal" -if cmd-missing starship; then - pkg-add starship +if omarchy-cmd-missing starship; then + omarchy-pkg-add starship cp $OMARCHY_PATH/config/starship.toml ~/.config/starship.toml fi diff --git a/migrations/1755455095.sh b/migrations/1755455095.sh index 6246dcf..2a929fe 100644 --- a/migrations/1755455095.sh +++ b/migrations/1755455095.sh @@ -1,3 +1,3 @@ echo "Ensure TTE and dependencies are installed" -pkg-add python-poetry-core python-terminaltexteffects +omarchy-pkg-add python-poetry-core python-terminaltexteffects diff --git a/migrations/1755459930.sh b/migrations/1755459930.sh index 7d04c0c..73af324 100644 --- a/migrations/1755459930.sh +++ b/migrations/1755459930.sh @@ -1,3 +1,3 @@ echo "Add potentially missing dependency for power profile controls" -pkg-add python-gobject +omarchy-pkg-add python-gobject diff --git a/migrations/1755548643.sh b/migrations/1755548643.sh index 051e542..f98b730 100644 --- a/migrations/1755548643.sh +++ b/migrations/1755548643.sh @@ -1,3 +1,3 @@ echo "Install wf-recorder for intel based device" -pkg-add wf-recorder +omarchy-pkg-add wf-recorder diff --git a/migrations/1755865046.sh b/migrations/1755865046.sh index 92a2312..c48962e 100644 --- a/migrations/1755865046.sh +++ b/migrations/1755865046.sh @@ -1,4 +1,4 @@ echo "Switch from lazydocker-bin to lazydocker official" -pkg-remove lazydocker-bin -pkg-add lazydocker +omarchy-pkg-drop lazydocker-bin +omarchy-pkg-add lazydocker diff --git a/migrations/1756060611.sh b/migrations/1756060611.sh index a26039b..b1bc95d 100644 --- a/migrations/1756060611.sh +++ b/migrations/1756060611.sh @@ -1,13 +1,13 @@ echo "Migrate AUR packages to official repos where possible" reinstall_package_opr() { - if pkg-present $1; then + if omarchy-pkg-present $1; then sudo pacman -Rns --noconfirm $1 sudo pacman -S --noconfirm ${2:-$1} fi } -pkg-remove yay-bin-debug +omarchy-pkg-drop yay-bin-debug reinstall_package_opr yay-bin yay reinstall_package_opr obsidian-bin obsidian diff --git a/migrations/1756115364.sh b/migrations/1756115364.sh index dd2ade5..a7c3925 100644 --- a/migrations/1756115364.sh +++ b/migrations/1756115364.sh @@ -1,6 +1,6 @@ echo "Replace buggy native Zoom client with webapp" -if pkg-present zoom; then - pkg-remove zoom +if omarchy-pkg-present zoom; then + omarchy-pkg-drop zoom omarchy-webapp-install "Zoom" https://app.zoom.us/wc/home https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/zoom.png fi diff --git a/migrations/1756410649.sh b/migrations/1756410649.sh index 71f8585..7347f9b 100644 --- a/migrations/1756410649.sh +++ b/migrations/1756410649.sh @@ -1,6 +1,6 @@ echo "Remove any Chaotic-AUR infrastructure packages" -pkg-remove chaotic-keyring chaotic-mirrorlist +omarchy-pkg-drop chaotic-keyring chaotic-mirrorlist if sudo pacman-key --list-keys 3056513887B78AEB >/dev/null 2>&1; then sudo pacman-key --delete 3056513887B78AEB diff --git a/migrations/1756411865.sh b/migrations/1756411865.sh index dc26393..8dcf8ef 100644 --- a/migrations/1756411865.sh +++ b/migrations/1756411865.sh @@ -1,3 +1,3 @@ echo "Add back ttf-ia-writer if it was missing" -pkg-add ttf-ia-writer +omarchy-pkg-add ttf-ia-writer diff --git a/migrations/1756507384.sh b/migrations/1756507384.sh index b49888a..77c640e 100755 --- a/migrations/1756507384.sh +++ b/migrations/1756507384.sh @@ -1,4 +1,4 @@ echo "Replace JetBrains Mono font with the Nerd Font edition" -pkg-add ttf-jetbrains-mono-nerd -pkg-remove ttf-jetbrains-mono +omarchy-pkg-add ttf-jetbrains-mono-nerd +omarchy-pkg-drop ttf-jetbrains-mono diff --git a/migrations/1756556731.sh b/migrations/1756556731.sh index 3a772ba..477b754 100644 --- a/migrations/1756556731.sh +++ b/migrations/1756556731.sh @@ -1,3 +1,3 @@ echo "Add Samba network drive support to the file manager" -pkg-add gvfs-smb +omarchy-pkg-add gvfs-smb