Add web server to mesh images

This commit is contained in:
Bob Mottram 2016-06-25 16:51:04 +01:00
parent 2fb249e6ef
commit f26202a3b7
3 changed files with 110 additions and 0 deletions

View File

@ -526,6 +526,8 @@ TRACKER_PORT=6969
ZERONET_DEFAULT_BLOG_TAGLINE="Blogging on the Mesh"
ZERONET_DEFAULT_FORUM_TAGLINE="A decentralized discussion group"
ZERONET_DEFAULT_MAIL_TAGLINE="Mail for the Mesh"
ZERONET_ID_REPO="https://github.com/HelloZeroNet/ZeroID"
ZERONET_ID_COMMIT='ccf14fdc96fa9cdb2ddd8a7ab283a8e17a4f234b'
# https://github.com/ipfs/go-ipfs
IPFS_GO_REPO="https://github.com/ipfs/go-ipfs"

View File

@ -477,6 +477,14 @@ TOX_NODES=
ZERONET_REPO=
ZERONET_COMMIT=
ZERONET_PORT=
ZERONET_BLOG_REPO=
ZERONET_BLOG_COMMIT=
ZERONET_MAIL_REPO=
ZERONET_MAIL_COMMIT=
ZERONET_FORUM_REPO=
ZERONET_FORUM_COMMIT=
ZERONET_ID_REPO=
ZERONET_ID_COMMIT=
# Directory where source code is downloaded and compiled
INSTALL_DIR=$HOME/build
@ -981,6 +989,96 @@ function mesh_zeronet {
chroot "$rootdir" systemctl enable zeronet.service
}
function mesh_zeronet_blog {
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
ZERONET_BLOG_REPO=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_BLOG_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_BLOG_COMMIT=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_BLOG_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
else
ZERONET_BLOG_REPO=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_BLOG_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_BLOG_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_BLOG_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi
git clone $ZERONET_BLOG_REPO $rootdir/opt/zeronet/ZeroBlog
if [ ! -d $rootdir/opt/zeronet/ZeroBlog ]; then
echo $'ZeroBlog repo could not be cloned'
exit 6739
fi
cd $rootdir/opt/zeronet/ZeroBlog
git checkout $ZERONET_BLOG_COMMIT -b $ZERONET_BLOG_COMMIT
chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet
}
function mesh_zeronet_mail {
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
ZERONET_MAIL_REPO=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_MAIL_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_MAIL_COMMIT=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_MAIL_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
else
ZERONET_MAIL_REPO=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_MAIL_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_MAIL_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_MAIL_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi
git clone $ZERONET_MAIL_REPO $rootdir/opt/zeronet/ZeroMail
if [ ! -d $rootdir/opt/zeronet/ZeroMail ]; then
echo $'ZeroMail repo could not be cloned'
exit 78493
fi
cd $rootdir/opt/zeronet/ZeroMail
git checkout $ZERONET_MAIL_COMMIT -b $ZERONET_MAIL_COMMIT
chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet
}
function mesh_zeronet_forum {
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
ZERONET_FORUM_REPO=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_FORUM_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_FORUM_COMMIT=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_FORUM_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
else
ZERONET_FORUM_REPO=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_FORUM_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_FORUM_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_FORUM_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi
git clone $ZERONET_FORUM_REPO $rootdir/opt/zeronet/ZeroTalk
if [ ! -d $rootdir/opt/zeronet/ZeroTalk ]; then
echo $'ZeroTalk repo could not be cloned'
exit 78252
fi
cd $rootdir/opt/zeronet/ZeroTalk
git checkout $ZERONET_FORUM_COMMIT -b $ZERONET_FORUM_COMMIT
chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet
}
function mesh_zeronet_id {
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
ZERONET_ID_REPO=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_ID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_ID_COMMIT=$(cat /usr/local/bin/${PROJECT_NAME} | grep "ZERONET_ID_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
else
ZERONET_ID_REPO=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_ID_REPO=" | head -n 1 | awk -F '"' '{print $2}')
ZERONET_ID_COMMIT=$(cat /usr/bin/${PROJECT_NAME} | grep "ZERONET_ID_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
fi
git clone $ZERONET_ID_REPO $rootdir/opt/zeronet/ZeroID
if [ ! -d $rootdir/opt/zeronet/ZeroID ]; then
echo $'ZeroID repo could not be cloned'
exit 37936
fi
cd $rootdir/opt/zeronet/ZeroID
git checkout $ZERONET_ID_COMMIT -b $ZERONET_ID_COMMIT
chroot "$rootdir" chown -R zeronet:zeronet /opt/zeronet
}
function mesh_web_server {
if [ -d /etc/apache2 ]; then
chroot "$rootdir" apt-get -y remove --purge apache2
chroot "$rootdir" rm -rf /etc/apache2
fi
chroot "$rootdir" apt-get -y install nginx
if [ ! -d /etc/nginx ]; then
echo $'Unable to install web server'
exit 346825
fi
}
initialise_mesh() {
if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
return
@ -1012,7 +1110,11 @@ initialise_mesh() {
mesh_tox_node
mesh_tox_avahi
mesh_tox_client
mesh_web_server
mesh_zeronet
mesh_zeronet_blog
mesh_zeronet_mail
mesh_zeronet_forum
MESH_SERVICE='mesh-setup.service'
MESH_SETUP_DAEMON=$rootdir/etc/systemd/system/$MESH_SERVICE

View File

@ -483,6 +483,10 @@ if [[ $SERVER_INSTALLATION == "no" ]]; then
fi
fi
if [ -d /opt/zeronet ]; then
ZERONET_DIR=/opt/zeronet
fi
if [[ $SERVER_INSTALLATION == "no" ]]; then
if [ ! -f /tmp/meshtype ]; then
install_web_server
@ -557,6 +561,8 @@ fi
if which firefox > /dev/null; then
firefox $ZERONET_INDEX
elif which iceweasel > /dev/null; then
iceweasel $ZERONET_INDEX
elif which chrome > /dev/null; then
chrome $ZERONET_INDEX
elif which chromium > /dev/null; then