-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickstart.sh
More file actions
executable file
·49 lines (43 loc) · 1.41 KB
/
Copy pathquickstart.sh
File metadata and controls
executable file
·49 lines (43 loc) · 1.41 KB
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
#!/bin/sh
error() {
echo "Error: $1" >&2
exit "${2:-1}"
}
install() {
if ! command -v "$2" >/dev/null; then
if command -v sudo >/dev/null; then
sudo bash <<"EOF" || error "Failed to install $1, please install it manually"
apt-get install "$1" npm -y ||
dnf install "$1" npm -y ||
pacman -S "$1" npm --noconfirm ||
apk add "$1" npm ||
zypper install -y "$1" npm ||
yum install "$1" npm -y ||
xbps-install -Sy "$1" ||
eopkg install -y "$1"
EOF
else
bash <<"EOF" || error "Failed to install $1, please install it manually"
apt-get install "$1" npm -y ||
dnf install "$1" npm -y ||
pacman -S "$1" npm --noconfirm ||
apk add "$1" npm ||
zypper install -y "$1" npm ||
yum install "$1" npm -y ||
xbps-install -Sy "$1" ||
eopkg install -y "$1"
EOF
fi
fi
}
cd "$(dirname "$0")" || error "Failed to change directory" $?
chmod +x ./deploy.sh
install nodejs node
install grep grep
if ! npm list >/dev/null 2>&1; then
npm install || error "npm failed to install required packages" $?
else
echo "All packages already installed"
fi
printf "\n\033[32;1mYou are now setup!\033[0m\n"
echo "For further guidance check README.md"