Skip to content

Commit

Permalink
add a check to ensure 'id' coreutil is present.
Browse files Browse the repository at this point in the history
used to check if user is running as root
  • Loading branch information
secureshellprotocol committed Sep 8, 2024
1 parent 1bb6c59 commit 477defd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ printf "OK!\n"
# Move the binary to standard XDG location and handle permission errors
INSTALL_DIR=$HOME/.local/bin
# If run as 'sudo', install to /usr/local/bin for systemwide use
if [ $EUID -eq 0 ]; then
INSTALL_DIR=/usr/local/bin
if [ -x /usr/bin/id ]; then
if [ `/usr/bin/id -u` -eq 0 ]; then
INSTALL_DIR=/usr/local/bin
fi
fi

if ! mv "$tmp_file" $INSTALL_DIR/wd-41; then
Expand Down

0 comments on commit 477defd

Please sign in to comment.