From f6d35a69ec5e038a1dee2e99d87681a923bd943a Mon Sep 17 00:00:00 2001 From: jnats Date: Thu, 29 Apr 2021 18:09:21 +0100 Subject: made install.sh able to work interchangeably with any of my projects --- install.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index 1a4d757..3df0831 100755 --- a/install.sh +++ b/install.sh @@ -1,33 +1,34 @@ #!/usr/bin/env bash -FILE=./nofetch +file=nofetch +url=https://raw.githubusercontent.com/jnats/nofetch/main/nofetch -if ! test -f $FILE; +if ! test -f $file; then - curl -LO https://raw.githubusercontent.com/jnats/nofetch/main/nofetch + curl -LO $url fi if [ $EUID -eq 0 ] then echo "[/] uid 0" - rm $(which nofetch > /dev/null 2>&1) > /dev/null 2>&1 - chmod +x nofetch + rm $(which $file > /dev/null 2>&1) > /dev/null 2>&1 + chmod +x $file mkdir -p /usr/local/bin - cp nofetch /usr/local/bin + cp $file /usr/local/bin elif command -v doas &> /dev/null then echo "[/] doas" - doas rm $(which nofetch > /dev/null 2>&1) > /dev/null 2>&1 - chmod +x nofetch + doas rm $(which $file > /dev/null 2>&1) > /dev/null 2>&1 + chmod +x $file doas mkdir -p /usr/local/bin - doas cp nofetch /usr/local/bin + doas cp $file /usr/local/bin elif command -v sudo &> /dev/null then echo "[/] sudo" - sudo rm $(which nofetch > /dev/null 2>&1) > /dev/null 2>&1 - chmod +x nofetch + sudo rm $(which $file > /dev/null 2>&1) > /dev/null 2>&1 + chmod +x $file sudo mkdir -p /usr/local/bin - sudo cp nofetch /usr/local/bin + sudo cp $file /usr/local/bin else echo "\n[X] neither doas nor sudo found, and command isn't running as root, have you checked README.md ?\n" fi -- cgit v1.2.3