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 TRACKER_PORT=6969
MY_USERNAME=$USER MY_USERNAME=$USER
ZERONET_DIR=/home/$MY_USERNAME/zeronet ZERONET_DIR=/home/$MY_USERNAME/zeronet
UPDATED="no"
function install_zeronet_blog { function install_zeronet_blog {
if [ ! -f /home/$MY_USERNAME/README ]; then if [ ! -f /home/$MY_USERNAME/README ]; then
@ -192,6 +193,11 @@ function install_web_server {
return return
fi fi
if [[ $UPDATED == "no" ]]; then
sudo apt-get update
UPDATED="yes"
fi
sudo apt-get -y remove --purge apache2 sudo apt-get -y remove --purge apache2
if [ -d /etc/apache2 ]; then if [ -d /etc/apache2 ]; then
sudo rm -rf /etc/apache2 sudo rm -rf /etc/apache2
@ -206,19 +212,25 @@ function install_web_server {
} }
function install_zeronet { function install_zeronet {
if [ -d $ZERONET_DIR ]; then if [ -d $ZERONET_DIR ]; then
return return
fi 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 [[ $UPDATED == "no" ]]; then
if [ ! -d $ZERONET_DIR ]; then sudo apt-get update
exit 56823 UPDATED="yes"
fi fi
cd $ZERONET_DIR
git checkout bashrc/bootstrap-file 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 if [ -f /var/lib/batman ]; then
@ -233,7 +245,6 @@ fi
if [[ $SERVER_INSTALLATION == "no" ]]; then if [[ $SERVER_INSTALLATION == "no" ]]; then
if [ ! -f /tmp/meshtype ]; then if [ ! -f /tmp/meshtype ]; then
sudo apt-get update
install_web_server install_web_server
install_zeronet install_zeronet
install_zeronet_blog install_zeronet_blog