Skip to content

Commit

Permalink
ensure awk is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Dec 6, 2023
1 parent 1fd7062 commit 337d102
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions commands/dorothy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 337d102

Please sign in to comment.