making sure the repository is at its latest revision before installing

This commit is contained in:
aminnairi
2024-01-07 11:29:20 +01:00
parent 641084d547
commit f74a0d895b
+12 -1
View File
@@ -14,7 +14,8 @@ 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
ERROR_BECAUSE_GIT_PULL_FAILED=6
ERROR_BECAUSE_PLAYBOOK_PATH_DOES_NOT_EXIST=7
if [[ "$(id -u)" -eq 0 ]]
then
@@ -63,6 +64,16 @@ fi
choosen_playbook_path=$1
echo "Updating this repository before anything else..."
if [[ ! $(git pull --all --rebase --prune) ]]
then
echo "Failed to update this repository"
exit $ERROR_BECAUSE_GIT_PULL_FAILED
fi
echo "Done updating this repository, now at the latest revision."
if [[ -z $choosen_playbook_path ]]
then
choosen_playbook_file="$(/usr/bin/find ansible -name '*.yml' -type f -maxdepth 1 | xargs basename -a | /usr/bin/fzf --header 'Choose a configuration file' --pointer 👉 --prompt 🔍)"