-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.sh
executable file
·79 lines (62 loc) · 1.8 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
73
74
75
76
77
78
79
#!/bin/bash
# Package manager.
if ! which apt-get > /dev/null;
then PM=ubuntu;
elif ! which nix-env > /dev/null;
then PM=nix;
fi
# Make sure you have all we need
if ! which git > /dev/null;
then echo "Git is not installed. Installation of git in progress.";
case $PM in
ubuntu)
sudo apt install git-core;;
nix)
sudo nix-env -i git;;
esac
echo "Installation of git done.";
fi;
if ! which node > /dev/null;
then echo "Node is not installed. Installation of Node in progress.";
case $PM in
ubuntu)
sudo apt install nodejs;;
nix)
sudo nix-env -i nodejs;;
esac
echo "Installation of Node done.";
fi;
if ! which openssl > /dev/null;
then echo "openssl is not installed. Installation of openssl in progress.";
case $PM in
ubuntu)
sudo apt install openssl;;
nix)
sudo nix-env -i openssl;;
esac
echo "Installation of openssl done.";
fi;
# clone repositories
git clone https://github.com/garden/services /home/dom/services
git clone https://github.com/garden/tree /home/dom/tree
pushd /home/dom/tree
# populate tree
git clone https://github.com/garden/plugs.git
make load
npm install
# generate HTTPS credentials
openssl genrsa -aes256 -out https.key 1024
openssl req -new -nodes -key https.key -out https.csr
openssl x509 -req -days 365 -in https.csr -signkey https.key -out https.crt
cp https.key{,.orig}
openssl rsa -in https.key.orig -out https.key
popd
# install service scripts
sudo cp /home/dom/services/tree.service /etc/systemd/system/
sudo cp /home/dom/services/redirect.service /etc/systemd/system/
sudo cp /home/dom/services/update.service /etc/systemd/system/
sudo systemctl daemon-reload
# start all services
sudo systemctl start tree.service
sudo systemctl start redirect.service
sudo systemctl start update.service