From 91dc1ee1febafd6b05349db8d0f69360e8b67887 Mon Sep 17 00:00:00 2001 From: Vatsal Gupta <40350810+gvatsal60@users.noreply.github.com> Date: Mon, 28 Sep 2026 04:53:50 +0000 Subject: [PATCH] Replace logname with id --- .update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.update.sh b/.update.sh index ac220ef..f0b3ad9 100755 --- a/.update.sh +++ b/.update.sh @@ -20,7 +20,7 @@ export DEBIAN_FRONTEND=noninteractive ADJUSTED_ID="None" -NON_ROOT_USER=$(logname 2>/dev/null || echo "nobody") +NON_ROOT_USER=$(id -un 2>/dev/null || echo "nobody") ################################################################################################### # Functions @@ -236,7 +236,7 @@ update_brew() { # Safely drop privileges back to the normal user to run brew commands if [ "${NON_ROOT_USER}" != "nobody" ] && [ "${NON_ROOT_USER}" != "root" ]; then - if ! su - "${NON_ROOT_USER}" -s /bin/sh -c "${_brew_cmds}"; then + if ! su - "${NON_ROOT_USER}" -c "${_brew_cmds}"; then print_err "Error: Brew commands failed for user ${NON_ROOT_USER}." return fi