Skip to content

Commit b8a6455

Browse files
Merge pull request #151 from tobiasrdm/custom-install-dir
Allows change INSTALL_DIR and install without sudo
2 parents c60d4ba + 53e2c63 commit b8a6455

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ For Linux using custom installer:
105105
curl -sSL https://bit.ly/install-xq | sudo bash
106106
```
107107

108+
For Linux using custom installer, changing INSTALL_DIR, without sudo:
109+
```
110+
curl -sSL https://bit.ly/install-xq | INSTALL_DIR=$(pwd) bash
111+
```
112+
108113
For Ubuntu 22.10 or higher via package manager:
109114
```
110115
apt-get install xq

scripts/install.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
URL_PREFIX="https://github.com/sibprogrammer/xq"
6-
INSTALL_DIR=/usr/local/bin/
6+
INSTALL_DIR=${INSTALL_DIR:-/usr/local/bin}
77
BINARY=xq
88
LATEST_VERSION=$(curl -L -s -H 'Accept: application/json' $URL_PREFIX/releases/latest | sed -e 's/.*"tag_name":"v\([^"]*\)".*/\1/')
99
PLATFORM=$(uname -s | tr A-Z a-z)
@@ -28,7 +28,7 @@ ARCHIVE="${BINARY}_${LATEST_VERSION}_${PLATFORM}_${ARCH}.tar.gz"
2828
URL="$URL_PREFIX/releases/download/v${LATEST_VERSION}/$ARCHIVE"
2929

3030
echo "Installation of $BINARY"
31-
rm -f $INSTALL_DIR$BINARY
32-
curl -sSL "$URL" | tar xz -C $INSTALL_DIR $BINARY
33-
chmod +x $INSTALL_DIR$BINARY
34-
echo "Successfully installed at $INSTALL_DIR$BINARY"
31+
rm -f $INSTALL_DIR/$BINARY
32+
curl -sSL "$URL" | tar xz -C $INSTALL_DIR/ $BINARY
33+
chmod +x $INSTALL_DIR/$BINARY
34+
echo "Successfully installed at $INSTALL_DIR/$BINARY"

0 commit comments

Comments
 (0)