added git installation verification in the main script

This commit is contained in:
aminnairi
2024-01-07 12:18:10 +01:00
parent d93c7693f0
commit d1b61f32b1
+14 -2
View File
@@ -14,8 +14,9 @@ ERROR_BECAUSE_NOT_ARCH_LINUX=2
ERROR_BECAUSE_TOO_MUCH_ARGUMENTS_PROVDED=3 ERROR_BECAUSE_TOO_MUCH_ARGUMENTS_PROVDED=3
ERROR_BECAUSE_ANSIBLE_INSTALLATION_FAILED=4 ERROR_BECAUSE_ANSIBLE_INSTALLATION_FAILED=4
ERRROR_BECAUSE_FUZZY_FILE_FINDER_INSTALLATION_FAILED=5 ERRROR_BECAUSE_FUZZY_FILE_FINDER_INSTALLATION_FAILED=5
ERROR_BECAUSE_GIT_PULL_FAILED=6 ERROR_BECAUSE_GIT_INSTALLATION_FAILED=6
ERROR_BECAUSE_PLAYBOOK_PATH_DOES_NOT_EXIST=7 ERROR_BECAUSE_GIT_PULL_FAILED=7
ERROR_BECAUSE_PLAYBOOK_PATH_DOES_NOT_EXIST=8
if [[ "$(id -u)" -eq 0 ]] if [[ "$(id -u)" -eq 0 ]]
then then
@@ -55,6 +56,17 @@ then
fi fi
fi fi
if [[ ! -x "$(command -v git)" ]]
then
echo "Git not found, installing..."
if [[ ! "$(sudo pacman -Syy --noconfirm git)" ]]
then
echo "Installation of git failed."
exit $ERROR_BECAUSE_GIT_INSTALLATION_FAILED
fi
fi
if [[ $# -gt 1 ]] if [[ $# -gt 1 ]]
then then
echo "Too much arguments provided." echo "Too much arguments provided."