aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinstall.sh72
1 files changed, 51 insertions, 21 deletions
diff --git a/install.sh b/install.sh
index 3df0831..c3d0e04 100755
--- a/install.sh
+++ b/install.sh
@@ -3,32 +3,62 @@
file=nofetch
url=https://raw.githubusercontent.com/jnats/nofetch/main/nofetch
-if ! test -f $file;
+if [ ! -f $file ]
then
- curl -LO $url
+ curl -LO $url
fi
-if [ $EUID -eq 0 ]
+echo ""
+echo "1 - install systemwide"
+echo "2 - install for me"
+echo ""
+read uc
+
+if [ "$uc" == "1" ]
then
- echo "[/] uid 0"
- rm $(which $file > /dev/null 2>&1) > /dev/null 2>&1
- chmod +x $file
- mkdir -p /usr/local/bin
- cp $file /usr/local/bin
-elif command -v doas &> /dev/null
+ if [ $EUID -eq 0 ]
+ then
+ echo ""
+ echo "[/] uid 0"
+ echo ""
+ rm $(which $file > /dev/null 2>&1) > /dev/null 2>&1
+ chmod +x $file
+ mkdir -p /usr/local/bin
+ cp $file /usr/local/bin
+ elif command -v doas &> /dev/null
+ then
+ echo ""
+ echo "[/] doas"
+ echo ""
+ doas rm $(which $file > /dev/null 2>&1) > /dev/null 2>&1
+ chmod +x $file
+ doas mkdir -p /usr/local/bin
+ doas cp $file /usr/local/bin
+ elif command -v sudo &> /dev/null
+ then
+ echo ""
+ echo "[/] sudo"
+ echo ""
+ sudo rm $(which $file > /dev/null 2>&1) > /dev/null 2>&1
+ chmod +x $file
+ sudo mkdir -p /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
+elif [ "$uc" == "2" ]
then
- echo "[/] doas"
- doas rm $(which $file > /dev/null 2>&1) > /dev/null 2>&1
- chmod +x $file
- doas mkdir -p /usr/local/bin
- doas cp $file /usr/local/bin
-elif command -v sudo &> /dev/null
-then
- echo "[/] sudo"
- sudo rm $(which $file > /dev/null 2>&1) > /dev/null 2>&1
+ echo ""
+ echo "> what is your preferred local binary directory? (make sure it exists and is in your \$PATH)"
+ echo ""
+
+ read localbin_up
+ localbin=$(echo $localbin_up | sed "s|~|$HOME|g")
+ echo ""
chmod +x $file
- sudo mkdir -p /usr/local/bin
- sudo cp $file /usr/local/bin
+ cp $file $localbin/
else
- echo "\n[X] neither doas nor sudo found, and command isn't running as root, have you checked README.md ?\n"
+ echo ""
+ echo "> invalid option, check syntax and try again"
+ echo ""
fi