Skip to content

Commit

Permalink
Merge pull request #4 from HarimbolaSantatra/current-user
Browse files Browse the repository at this point in the history
Add option to install for current user only
  • Loading branch information
tsirysndr authored Aug 18, 2024
2 parents f0c6648 + 926541f commit ac9a71f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,27 @@ tar -xzf /tmp/$ASSET_NAME -C /tmp
# Set the correct permissions for the binary
chmod +x /tmp/pocketenv

# Check if the 'local' argument was passed
LOCAL=0
if [ $# -eq 1 ]; then
if [ $1 = "--local" ]; then
LOCAL=1
fi
fi

# Move the extracted binary to the installation directory
# use sudo if OS is Linux
if [ "$OS" = "Linux" ]; then
if command -v sudo >/dev/null 2>&1; then
sudo mv /tmp/pocketenv $INSTALL_DIR
# Install locally if LOCAL is set to 1
LOCAL_DIR="/home/$USER/.local/bin"
if [ "$LOCAL" -eq 1 ]; then
mv /tmp/pocketenv $LOCAL_DIR
else
mv /tmp/pocketenv $INSTALL_DIR
if command -v sudo >/dev/null 2>&1; then
sudo mv /tmp/pocketenv $INSTALL_DIR
else
mv /tmp/pocketenv $INSTALL_DIR
fi
fi
else
mv /tmp/pocketenv $INSTALL_DIR
Expand Down

0 comments on commit ac9a71f

Please sign in to comment.