-
Notifications
You must be signed in to change notification settings - Fork 3
/
install
executable file
·56 lines (51 loc) · 1.42 KB
/
install
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
#!/bin/sh
echo "This will install curl, nodeJS and yarn"
echo " "
#Check if java is installed
if [ -z "$(command -v java)" ]; then
echo "Java not found"
echo "Please install Java JDK >= 8 manually!"
exit 1
else
echo "Java found on your system"
fi
#Check if curl is installed (default for non empty string is -n)
if [ "$(command -v curl)" ]; then
echo "Curl found on your system"
elif [ "$(command -v apt-get)" ]; then
#Install curl debian/ubuntu
sudo apt-get update
sudo apt-get install curl
elif [ "$(command -v yum)" ]; then
#Install curl RHEL/CentOS/Fedora
yum install curl
elif [ "$(command -v zypper)" ]; then
#Install curl OpenSUSE
zypper install curl
elif [ "$(command -v pacman)" ]; then
#Install curl ArchLinux
pacman -Sy curl
else
echo 'Curl not found'
echo 'Please install curl manually!'
exit 1
fi
#Install Node.JS
curl https://nodejs.org/dist/v20.12.2/node-v20.12.2-linux-x64.tar.xz > node.tar.xz
sudo mkdir -p /usr/local/lib/nodejs
sudo tar -xJvf node.tar.xz -C /usr/local/lib/nodejs
rm node.tar.xz
#Export node path
export PATH=/usr/local/lib/nodejs/node-v20.12.2-linux-x64/bin:$PATH
. ~/.profile
# Check if yarn is installed
if [ "$(command -v yarn)" ]; then
echo 'yarn found on your system'
elif [ "$(command -v npm)" ]; then
# Install yarn via npm
sudo npm install --global yarn
else
echo 'Could not find npm package manager.'
echo 'Please install yarn manually!'
exit 1
fi