Skip to content

Commit 21e4c97

Browse files
committed
Add installation script for crabd
1 parent 71570d3 commit 21e4c97

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

install.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh
2+
3+
err_msg="\033[31m> A problem occured during download!\033[0m"
4+
add_path=false
5+
version=latest
6+
7+
if [ -n "$1" ]; then
8+
version="$1"
9+
fi
10+
file_url="https://github.com/scnplt/crabd/releases/download/$version/linux-crabd.tar.gz"
11+
12+
read -p "Do you want to add crabd to /usr/bin/? (y/N): " user_input
13+
if echo "$user_input" | grep -iq "^[Yy]$"; then
14+
add_path=true
15+
fi
16+
17+
echo "Downloading from $file_url"
18+
19+
if which curl >/dev/null; then
20+
if ! curl -fSL "$file_url" -o linux-crabd.tar.gz; then
21+
echo "$err_msg"
22+
exit 1
23+
fi
24+
elif which wget >/dev/null; then
25+
if ! wget "$file_url"; then
26+
echo "err_msg"
27+
exit 1
28+
fi
29+
else
30+
echo 'curl or wget not installed!'
31+
exit 1
32+
fi
33+
34+
tar xzf linux-crabd.tar.gz
35+
rm linux-crabd.tar.gz
36+
37+
if $add_path; then
38+
echo '\033[33m> Adding crabd to /usr/bin/\033[0m'
39+
mv crabd /usr/bin && chmod +x /usr/bin/crabd
40+
fi
41+
42+
echo '\033[32m> Installation complete.\033[0m'

0 commit comments

Comments
 (0)