Skip to content

Commit

Permalink
Merge pull request #147 from Erotemic/robust-home-lookup
Browse files Browse the repository at this point in the history
More robust user home
  • Loading branch information
goldyfruit committed Sep 16, 2024
2 parents f380c0a + 931add0 commit ab513c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
# Set global variables based on sudo usage
if [ -n "$SUDO_USER" ]; then
export RUN_AS="$SUDO_USER"
export RUN_AS_HOME="/home/$SUDO_USER"
else
export RUN_AS=$USER
export RUN_AS_HOME="/$SUDO_USER"
fi
export RUN_AS_HOME=$(eval echo ~"$RUN_AS")

# Check for git command to be installed
if ! command -v git &>/dev/null; then
Expand Down
3 changes: 1 addition & 2 deletions utils/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ function detect_user() {
# sudo user
export RUN_AS="$SUDO_USER"
export RUN_AS_UID="$SUDO_UID"
export RUN_AS_HOME="/home/$SUDO_USER"
else
# root user
export RUN_AS="$USER"
export RUN_AS_UID="$EUID"
export RUN_AS_HOME="/$RUN_AS"
fi
export RUN_AS_HOME=$(eval echo ~"$RUN_AS")
export VENV_PATH="${RUN_AS_HOME}/.venvs/${INSTALLER_VENV_NAME}"
}

Expand Down

0 comments on commit ab513c6

Please sign in to comment.