Only update if necessary

This commit is contained in:
Bob Mottram 2015-09-03 18:40:31 +01:00
parent 16316ede09
commit 60e24314a2
1 changed files with 24 additions and 13 deletions

View File

@ -16,6 +16,7 @@ ZERONET_PORT=15441
TRACKER_PORT=6969
MY_USERNAME=$USER
ZERONET_DIR=/home/$MY_USERNAME/zeronet
UPDATED="no"
function install_zeronet_blog {
if [ ! -f /home/$MY_USERNAME/README ]; then
@ -192,6 +193,11 @@ function install_web_server {
return
fi
if [[ $UPDATED == "no" ]]; then
sudo apt-get update
UPDATED="yes"
fi
sudo apt-get -y remove --purge apache2
if [ -d /etc/apache2 ]; then
sudo rm -rf /etc/apache2
@ -206,19 +212,25 @@ function install_web_server {
}
function install_zeronet {
if [ -d $ZERONET_DIR ]; then
return
fi
sudo apt-get -y install python python-msgpack python-gevent
sudo apt-get -y install python-pip bittornado
sudo pip install msgpack-python --upgrade
if [ -d $ZERONET_DIR ]; then
return
fi
git clone $ZERONET_REPO $ZERONET_DIR
if [ ! -d $ZERONET_DIR ]; then
exit 56823
fi
cd $ZERONET_DIR
git checkout bashrc/bootstrap-file
if [[ $UPDATED == "no" ]]; then
sudo apt-get update
UPDATED="yes"
fi
sudo apt-get -y install python python-msgpack python-gevent
sudo apt-get -y install python-pip bittornado
sudo pip install msgpack-python --upgrade
git clone $ZERONET_REPO $ZERONET_DIR
if [ ! -d $ZERONET_DIR ]; then
exit 56823
fi
cd $ZERONET_DIR
git checkout bashrc/bootstrap-file
}
if [ -f /var/lib/batman ]; then
@ -233,7 +245,6 @@ fi
if [[ $SERVER_INSTALLATION == "no" ]]; then
if [ ! -f /tmp/meshtype ]; then
sudo apt-get update
install_web_server
install_zeronet
install_zeronet_blog