From b0f93c6b9dcf30c7c80422190e84700150f0adea Mon Sep 17 00:00:00 2001 From: Karsten Hachmeister Date: Wed, 13 Jul 2022 21:54:00 +0200 Subject: [PATCH] check if commonly used tools are installed --- .config/yadm/bootstrap.d/check-installed-tools | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 .config/yadm/bootstrap.d/check-installed-tools diff --git a/.config/yadm/bootstrap.d/check-installed-tools b/.config/yadm/bootstrap.d/check-installed-tools new file mode 100755 index 0000000..ebfa8da --- /dev/null +++ b/.config/yadm/bootstrap.d/check-installed-tools @@ -0,0 +1,18 @@ +#!/bin/bash + +declare -A TOOLS +TOOLS+=( ["batcat"]=bat ["exa"]=exa ["fdfind"]=fd-find ["glow"]=glow ["readelf"]=binutils ["rg"]=ripgrep ["thefuck"]=thefuck ) + +declare -A PACKAGES + +for tool in ${!TOOLS[@]}; do + if [[ ! -x "$(command -v $tool)" ]]; then + PACKAGES+=("${TOOLS[$tool]}") + fi +done + +if [[ ${#PACKAGES[@]} > 0 ]]; then + echo sudo apt install $(printf " %s" "${!PACKAGES[@]}") +else + echo All needed tools already installed. +fi