From 91b6cd8f1d53a97fcf64e48a678b84ccd386a212 Mon Sep 17 00:00:00 2001 From: aminnairi <18418459+aminnairi@users.noreply.github.com> Date: Sat, 6 Jan 2024 11:26:32 +0100 Subject: [PATCH] added a preliminary check to ensure fzf is installed in the installation script --- main.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/main.sh b/main.sh index ae6b981..257f216 100755 --- a/main.sh +++ b/main.sh @@ -13,6 +13,7 @@ ERROR_BECAUSE_ROOT=1 ERROR_BECAUSE_NOT_ARCH_LINUX=2 ERROR_BECAUSE_TOO_MUCH_ARGUMENTS_PROVDED=3 ERROR_BECAUSE_ANSIBLE_INSTALLATION_FAILED=4 +ERRROR_BECAUSE_FUZZY_FILE_FINDER_INSTALLATION_FAILED=5 ERROR_BECAUSE_PLAYBOOK_PATH_DOES_NOT_EXIST=6 if [[ "$(id -u)" -eq 0 ]] @@ -41,6 +42,18 @@ then fi fi +if [[ ! -x "$(command -v fzf)" ]] +then + echo "Fuzzy file finder not found, installing..." + + if [[ ! "$(sudo pacman -Syy --noconfirm fzf)" ]] + then + echo "Installation of fuzzy file finder failed." + display_help + exit $ERRROR_BECAUSE_FUZZY_FILE_FINDER_INSTALLATION_FAILED + fi +fi + if [[ $# -gt 1 ]] then echo "Too much arguments provided."