From 337d10280f238c483a14531f133b98ae0518d710 Mon Sep 17 00:00:00 2001 From: Benjamin Lupton Date: Wed, 6 Dec 2023 12:12:19 +0800 Subject: [PATCH] ensure awk is installed --- commands/dorothy | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/commands/dorothy b/commands/dorothy index e8a19b023..30306e841 100755 --- a/commands/dorothy +++ b/commands/dorothy @@ -415,43 +415,45 @@ function dorothy() ( # [commands/dorothy] - preference sorted, doesn't do updates, don't do noconfirm # [dorothy-workflow.yml] - preference sorted, does updates, does noconfirm, skips extras # [readme.md] - popularity sorted, does updates, don't do noconfirm, skips extras (ncurses, moreutils, procps) - if command_missing bash curl grep git tput ps; then + # https://repology.org/project/gawk/versions + if command_missing bash curl grep git tput ps awk; then # preference sort if command_exists apt-get; then # for ubuntu/debian/kali # E: Unable to locate package ncurses - try_sudo apt-get install -y bash curl git procps coreutils moreutils + try_sudo apt-get install -y bash curl git procps coreutils moreutils gawk elif command_exists zypper; then # for opensuse - try_sudo zypper --non-interactive install bash curl git-core ncurses coreutils moreutils + try_sudo zypper --non-interactive install bash curl git-core ncurses coreutils moreutils gawk elif command_exists apk; then # for alpine - try_sudo apk add bash curl grep git ncurses coreutils moreutils + try_sudo apk add bash curl grep git ncurses coreutils moreutils gawk elif command_exists pamac; then # for manjaro, prefer over arch as majaro also contains pacman - try_sudo pamac install --no-confirm bash curl git ncurses procps-ng coreutils moreutils + try_sudo pamac install --no-confirm bash curl git ncurses procps-ng coreutils moreutils gawk elif command_exists pacman; then # for arch - try_sudo pacman --refresh --sync --needed --noconfirm bash curl git ncurses procps-ng coreutils moreutils + try_sudo pacman --refresh --sync --needed --noconfirm bash curl git ncurses procps-ng coreutils moreutils gawk elif command_exists urpmi; then # for mageia, prefer over fedora as mageia contains dnf # No package named moreutils - try_sudo urpmi --auto bash curl git ncurses + try_sudo urpmi --auto bash curl git ncurses gawk elif command_exists dnf; then # for fedora - try_sudo dnf --assumeyes --refresh --best --allowerasing install bash curl git ncurses procps coreutils moreutils + try_sudo dnf --assumeyes --refresh --best --allowerasing install bash curl git ncurses procps coreutils moreutils gawk elif test -x "${HOMEBREW_PREFIX-}/bin/brew"; then # for macos, don't use command_exists as dorothy has its own brew helper - "${HOMEBREW_PREFIX-}/bin/brew" install bash curl git ncurses coreutils moreutils + # this is here for consistency only, as it is unnecessary, all the commands already exist on macos without any need for homebrew + "${HOMEBREW_PREFIX-}/bin/brew" install bash curl git ncurses coreutils moreutils gawk elif command_exists xbps-install; then # for void - try_sudo xbps-install --sync --yes bash curl git ncurses coreutils moreutils + try_sudo xbps-install --sync --yes bash curl git ncurses coreutils moreutils gawk elif command_exists nix-env; then # for nix - try_sudo nix-env --install --attr nixpkgs.coreutils nixpkgs.bash nixpkgs.curl nixpkgs.git nixpkgs.ncurses nixpkgs.coreutils nixpkgs.moreutils + try_sudo nix-env --install --attr nixpkgs.coreutils nixpkgs.bash nixpkgs.curl nixpkgs.git nixpkgs.ncurses nixpkgs.coreutils nixpkgs.moreutils nixpkgs.gawk elif command_exists emerge; then # for gentoo - try_sudo emerge app-shells/bash net-misc/curl dev-vcs/git sys-libs/ncurses sys-apps/coreutils sys-apps/moreutils + try_sudo emerge app-shells/bash net-misc/curl dev-vcs/git sys-libs/ncurses sys-apps/coreutils sys-apps/moreutils sys-apps/gawk else # for everything else cat <<-EOF >/dev/stderr @@ -461,6 +463,8 @@ function dorothy() ( grep: $(grep --version || :) git: $(git --version || :) tput: $(tput -V || :) + ps: $(type -P ps || :) + awk: $(awk --version || :) Refer to the manual: https://github.com/bevry/dorothy EOF