forked from Krowemoh/bash-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
38 lines (31 loc) · 878 Bytes
/
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
#!/bin/sh
echo "Installing httb..."
sudo cp -f httb /usr/bin/httb
sudo mkdir /usr/lib/httb
sudo cp -f README.md /usr/lib/httb/README.md
#sudo cp -rf custom /usr/lib/httb/custom/
rsync -av custom/ /usr/lib/httb/custom
#mkdir /usr/lib/httb/custom/db
mkdir /usr/lib/httb/custom/sessions
mkdir /usr/lib/httb/custom/db/users
mkdir /var/www
mkdir /var/www/html
mkdir /etc/httb
cat > /etc/httb/httb.conf.json <<EOF
{
"htmlfolder": "/var/www/html",
"port": "8080"
}
EOF
installfail(){
echo "Installation has failed."
exit 1
}
if [ -f /usr/bin/httb ];then
echo "- Turning httb into an executable..."
sudo chmod +x /usr/bin/httb
echo "Done!"
# if httb babyisalive; then echo "Done! Running \"httb -r '#first' sample.html\" command as example to use it:" && (httb -r '#first' /usr/lib/httb/sample.html &);exit 0; else installfail; fi
else
installfail
fi