Skip to content

Commit

Permalink
add option to install for current user only
Browse files Browse the repository at this point in the history
  • Loading branch information
HarimbolaSantatra committed Aug 18, 2024
1 parent f0c6648 commit 926541f
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 926541f

Please sign in to comment.