From 78b9c70165ed93efe5a0a497ed91bb9128280d5c Mon Sep 17 00:00:00 2001 From: aminnairi <18418459+aminnairi@users.noreply.github.com> Date: Sun, 31 Dec 2023 18:36:19 +0100 Subject: [PATCH] the script now requires a non-root user to be run --- main.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.sh b/main.sh index cbfbe0a..05f1257 100755 --- a/main.sh +++ b/main.sh @@ -1,14 +1,14 @@ #!/bin/env bash -ERROR_BECAUSE_NON_ROOT=1 +ERROR_BECAUSE_ROOT=1 ERROR_BECAUSE_NOT_ARCH_LINUX=2 ERROR_BECAUSE_ANSIBLE_INSTALLATION_FAILED=3 ERROR_BECAUSE_PLAYBOOK_INVALID_OR_NOT_FOUND=4 -if [[ "$(id -u)" -ne 0 ]] +if [[ "$(id -u)" -eq 0 ]] then - echo "Please, run this script as root" - exit $ERROR_BECAUSE_NON_ROOT + echo "Please, run this script as user" + exit $ERROR_BECAUSE_ROOT fi if [[ ! -x $(command -v pacman) ]] @@ -56,6 +56,6 @@ ANSIBLE_COLLECTIONS_PATH="$PWD/ansible/collections" ansible-galaxy collection in echo "Done installing needed Ansible packages." echo "Running choosen Ansible Playbook at $choosen_playbook_path..." -ansible-playbook --inventory localhost, --module-path ansible/collections "$choosen_playbook_path" +ansible-playbook --inventory localhost, --ask-become-pass --module-path ansible/collections "$choosen_playbook_path" echo "Done running choosen Ansible Playbook. If this is your first installation, you might want to reboot in order for the settings to take effect."