From b795268d99291f9e8094ba4e2ac5b93cd1b47efd Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Thu, 6 Nov 2025 20:04:35 -0800 Subject: [PATCH] whoami fix --- install.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index ea3eac0..c9b2073 100755 --- a/install.sh +++ b/install.sh @@ -288,7 +288,7 @@ fi # Only ask about meshbot user if bot is not "none" (n) if [[ $(echo "${bot}" | grep -i "^n") ]]; then - whoami=$(whoami) + bot_user=$(whoami) else if [[ $(echo "${embedded}" | grep -i "^n") ]]; then printf "\nDo you want to add a local user (meshbot) no login, for the bot? (y/n)" @@ -296,14 +296,20 @@ else fi if [[ $(echo "${meshbotservice}" | grep -i "^y") ]] || [[ $(echo "${embedded}" | grep -i "^y") ]]; then - sudo useradd -M meshbot - sudo usermod -L meshbot - sudo groupadd meshbot - sudo usermod -a -G meshbot meshbot - whoami="meshbot" - echo "Added user meshbot with no home directory" + if ! id meshbot &>/dev/null; then + sudo useradd -M meshbot + sudo usermod -L meshbot + if ! getent group meshbot &>/dev/null; then + sudo groupadd meshbot + fi + sudo usermod -a -G meshbot meshbot + echo "Added user meshbot with no home directory" + else + echo "User meshbot already exists" + fi + bot_user="meshbot" else - whoami=$(whoami) + bot_user=$(whoami) fi fi