Skip to content

Commit

Permalink
ISSUE-36 use actual home dir (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischabot authored Oct 6, 2024
1 parent c48f013 commit b8e3364
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ set -e
# Get the environment/OS
environment=$(uname)

# If the script is run as root, set the HOME variable to the user's home directory
if [ "$EUID" -eq 0 ]; then
ACTUAL_USER=$(logname 2>/dev/null || echo $SUDO_USER)
HOME="/home/$ACTUAL_USER"
fi

# Function to exit with an error message
exit_with_error() {
echo "Error: $1"
Expand Down Expand Up @@ -117,8 +111,10 @@ input=${input// /}
# Echo the final directory used
echo "The base directory is set to: $input"

# Replace leading tilde (~) with the actual home directory path
NODEHOME="${input/#\~/$HOME}" # support ~ in path
# Expand the tilde in the input if any
NODEHOME=`realpath "${input}"`

echo "Real path for directory is: $NODEHOME"

# Check all things that will be needed for this script to succeed like access to docker and docker-compose
# If any check fails, attempt to install the missing dependency
Expand Down Expand Up @@ -699,4 +695,4 @@ To use the Command Line Interface:
2. Enter the validator container with ./shell.sh.
3. Run "operator-cli --help" for commands

EOF
EOF

0 comments on commit b8e3364

Please sign in to comment.