freedomboneeee/src/freedombone-app-librevault

138 lines
3.7 KiB
Plaintext
Raw Normal View History

2016-08-24 20:41:57 +02:00
#!/bin/bash
#
# .---. . .
# | | |
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
#
# Freedom in the Cloud
#
# Librevault application
#
# License
# =======
#
# Copyright (C) 2014-2016 Bob Mottram <bob@robotics.uk.to>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
VARIANTS='none'
PROTOBUF_REPO="https://github.com/google/protobuf"
PROTOBUF_COMMIT='b97a4a53cdd55be74c30badefeb132a091764f53'
LIBREVAULT_REPO="https://github.com/Librevault/librevault"
LIBREVAULT_COMMIT='86a6aefcb5cc458f4d42195368fbcff2871f98e3'
LIBREVAULT_PORT=
function reconfigure_librevault {
echo -n ''
# TODO
}
function upgrade_librevault {
echo -n ''
# TODO
}
function backup_local_librevault {
# TODO
}
function restore_local_librevault {
# TODO
}
function backup_remote_librevault {
# TODO
}
function restore_remote_librevault {
# TODO
}
function remove_librevault {
if ! grep -Fxq "install_librevault" $COMPLETION_FILE; then
return
fi
iptables -D INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT
iptables -D INPUT -p tcp --dport $LIBREVAULT_PORT -j ACCEPT
function_check save_firewall_settings
save_firewall_settings
systemctl stop librevault
systemctl disable librevault
rm /etc/systemd/system/librevault.service
sed -i '/install_librevault/d' $COMPLETION_FILE
sed -i '/configure_firewall_for_librevault/d' $COMPLETION_FILE
systemctl restart cron
}
function configure_firewall_for_librevault {
if grep -Fxq "configure_firewall_for_librevault" $COMPLETION_FILE; then
return
fi
iptables -A INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT
iptables -A INPUT -p tcp --dport $LIBREVAULT_PORT -j ACCEPT
function_check save_firewall_settings
save_firewall_settings
OPEN_PORTS+=("Librevault $LIBREVAULT_PORT")
echo 'configure_firewall_for_librevault' >> $COMPLETION_FILE
}
function mesh_install_syncthing {
}
function install_syncthing {
if [ $INSTALLING_MESH ]; then
mesh_install_librevault
return
fi
if grep -Fxq "install_librevalut" $COMPLETION_FILE; then
return
fi
apt-get -y install build-essential cmake libboost-all-dev libssl-dev
apt-get -y install qtbase5-dev libqt5svg5-dev libqt5websockets5-dev
apt-get -y install autoconf automake libtool curl make g++ unzip
if [ ! -d $INSTALL_DIR ]; then
mkdir -p $INSTALL_DIR
fi
git_clone $PROTOBUF_REPO $INSTALL_DIR/protobuf
cd $INSTALL_DIR/protobuf
git checkout $PROTOBUF_COMMIT -b $PROTOBUF_COMMIT
./autogen.sh
./configure
make
make check
make install
ldconfig
git_clone $LIBREVAULT_REPO $INSTALL_DIR/librevault
cd $INSTALL_DIR/librevault
git checkout $LIBREVAULT_COMMIT -b $LIBREVAULT_COMMIT
mkdir $INSTALL_DIR/librevault/build
cd $INSTALL_DIR/librevault/build
cmake ..
cmake --build .
echo 'install_librevault' >> $COMPLETION_FILE
}
# NOTE: deliberately no exit 0