This repository has been archived by the owner on Jun 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·64 lines (59 loc) · 1.6 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
file=nofetch
url=https://raw.githubusercontent.com/jnats/nofetch/main/nofetch
if [ ! -f $file ]
then
curl -LO $url
fi
echo ""
echo "1 - install systemwide"
echo "2 - install for me"
echo ""
read uc
if [ "$uc" == "1" ]
then
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 ""
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
cp $file $localbin/
else
echo ""
echo "> invalid option, check syntax and try again"
echo ""
fi