forked from c6fc/npk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudshell_install.sh
67 lines (52 loc) · 1.87 KB
/
cloudshell_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
65
66
67
#! /bin/bash
# curl https://raw.githubusercontent/hardcidr/npk-betterui/main/cloudshell_install.sh | bash
NODE_VERSION=17.0.1
if [[ $UID -eq 0 ]]; then
echo "[!] Don't run this as root."
return 1
fi
# install compiler and cmake3, aliased to cmake
if [[ ! -f /usr/bin/cmake ]]; then
echo "[*] Installing CMake3, C++"
sudo yum install -y cmake3 gcc-c++ > /dev/null
sudo ln -s /usr/bin/cmake3 /usr/bin/cmake
fi
# install nvm and node
if [[ ! -d /aws/mde/nvm ]]; then
echo "[*] Installing NVM"
sudo mkdir /aws/mde/nvm
sudo chown cloudshell-user:cloudshell-user /aws/mde/nvm
sudo ln -s /aws/mde/nvm ~/.nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash > /dev/null
fi
export NVM_DIR="/aws/mde/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
echo "[*] Installing node.js ${NODE_VERSION}"
nvm install $NODE_VERSION > /dev/null
nvm alias default $NODE_VERSION
nvm use $NODE_VERSION
# Set up the larger storage environment:
if [[ ! -d /aws/mde/npk ]]; then
sudo mkdir /aws/mde/npk
sudo chown cloudshell-user:cloudshell-user /aws/mde/npk
fi
# Pull the repo:
if [[ ! -f /aws/mde/npk/README.md ]]; then
echo "[*] Cloning the NPK repo"
git clone https://github.com/hardcidr/npk-betterui.git /aws/mde/npk > /dev/null
fi
# Run the deploy:
cd /aws/mde/npk
git pull
echo
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "[+] Installing Node.js prerequisites. This can take up to two minutes, and may appear frozen. DON'T INTERRUPT IT."
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo
echo
npm install > /dev/null
bash -c "exec node bin/index.js deploy -y < /dev/tty"
cd /aws/mde/npk
export PS1="\e[1m\e[32m@hardcidr/npk-betterui>\e[0m "
return 0