-
Notifications
You must be signed in to change notification settings - Fork 8
/
install.sh
executable file
·72 lines (52 loc) · 1.31 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
65
66
67
68
69
70
71
72
#!/bin/bash
s_has() {
type "${1-}" > /dev/null 2>&1
}
# install node
if s_has "node" && s_has "npm" ; then
echo "node installed"
else
echo "0. node is not installed. Installing..."
# install nvm
if s_has "nvm" ; then
echo "nvm installed."
else
echo "0.a. Installing nvm..."
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
source ~/.bashrc
echo "nvm installed!"
fi
# install latest node version
nvm install node
nvm use node
n=$(which node); \
n=${n%/bin/node}; \
chmod -R 755 $n/bin/*; \
sudo cp -r $n/{bin,lib,share} /usr/local
echo "Finished! :|"
fi
# download seeder
echo "1. Downloading seeder..."
cd /home/pi
git clone https://github.com/new-computers/seeder
cd seeder
echo "Finished! :|"
# install dependencies
echo "2. Installing dependencies..."
sudo npm i -g add-to-systemd lil-pids
sudo npm install
echo "Finished! :)"
# build
echo "3. Building..."
sudo npm run build
echo "Finished! :>"
# add to systemd
echo "4. Setting up your Pi..."
sudo add-to-systemd dat $(which lil-pids) /home/pi/seeder/services /home/pi/seeder/pids
sudo systemctl start dat
echo "Finished! :D"
# test
# TODO
echo ""
echo "seeder was successfully installed to your Pi."
echo "Open the frontend in a web-browser, by going to its IP address or to http://$(hostname -s).local/"