More librevault
This commit is contained in:
parent
a6d36eb13e
commit
ccb07ff320
|
@ -28,14 +28,14 @@
|
|||
# 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'
|
||||
VARIANTS='mesh'
|
||||
|
||||
PROTOBUF_REPO="https://github.com/google/protobuf"
|
||||
PROTOBUF_COMMIT='b97a4a53cdd55be74c30badefeb132a091764f53'
|
||||
|
||||
LIBREVAULT_REPO="https://github.com/Librevault/librevault"
|
||||
LIBREVAULT_COMMIT='86a6aefcb5cc458f4d42195368fbcff2871f98e3'
|
||||
LIBREVAULT_PORT=
|
||||
LIBREVAULT_PORT=42345
|
||||
|
||||
function reconfigure_librevault {
|
||||
echo -n ''
|
||||
|
@ -43,23 +43,55 @@ function reconfigure_librevault {
|
|||
}
|
||||
|
||||
function upgrade_librevault {
|
||||
if ! grep -Fxq "install_librevault" $COMPLETION_FILE; then
|
||||
return
|
||||
fi
|
||||
|
||||
function_check set_repo_commit
|
||||
|
||||
if [ -d $INSTALL_DIR/protobuf ]; then
|
||||
if ! grep -q "Protobuf commit:$PROTOBUF_COMMIT" $COMPLETION_FILE; then
|
||||
set_repo_commit $INSTALL_DIR/protobuf "Protobuf commit" "$PROTOBUF_COMMIT" $PROTOBUF_REPO
|
||||
cd $INSTALL_DIR/protobuf
|
||||
./autogen.sh
|
||||
./configure
|
||||
make
|
||||
make check
|
||||
make install
|
||||
ldconfig
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d $INSTALL_DIR/librevault/build ]; then
|
||||
if ! grep -q "Librevault commit:$LIBREVAULT_COMMIT" $COMPLETION_FILE; then
|
||||
set_repo_commit $INSTALL_DIR/librevault "Librevault commit" "$LIBREVAULT_COMMIT" $LIBREVAULT_REPO
|
||||
cd $INSTALL_DIR/librevault
|
||||
git submodule update --init --recursive
|
||||
cd $INSTALL_DIR/librevault/build
|
||||
cmake ..
|
||||
cmake --build .
|
||||
make install
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function backup_local_librevault {
|
||||
echo -n ''
|
||||
# TODO
|
||||
}
|
||||
|
||||
function backup_local_librevault {
|
||||
# TODO
|
||||
}
|
||||
|
||||
function restore_local_librevault {
|
||||
echo -n ''
|
||||
# TODO
|
||||
}
|
||||
|
||||
function backup_remote_librevault {
|
||||
echo -n ''
|
||||
# TODO
|
||||
}
|
||||
|
||||
function restore_remote_librevault {
|
||||
echo -n ''
|
||||
# TODO
|
||||
}
|
||||
|
||||
|
@ -67,12 +99,10 @@ function remove_librevault {
|
|||
if ! grep -Fxq "install_librevault" $COMPLETION_FILE; then
|
||||
return
|
||||
fi
|
||||
if [ $LIBREVAULT_PORT ]; then
|
||||
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
|
||||
fi
|
||||
|
||||
systemctl stop librevault
|
||||
systemctl disable librevault
|
||||
|
@ -85,29 +115,39 @@ function configure_firewall_for_librevault {
|
|||
if grep -Fxq "configure_firewall_for_librevault" $COMPLETION_FILE; then
|
||||
return
|
||||
fi
|
||||
if [ $LIBREVAULT_PORT ]; then
|
||||
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")
|
||||
fi
|
||||
echo 'configure_firewall_for_librevault' >> $COMPLETION_FILE
|
||||
}
|
||||
|
||||
function mesh_install_librevault {
|
||||
install_tracker
|
||||
install_cmake
|
||||
install_cryptopp
|
||||
|
||||
chroot "$rootdir" apt-get -y -t jessie-backports install cmake
|
||||
chroot "$rootdir" apt-get -y install bittornado nginx
|
||||
chroot "$rootdir" apt-get -y install build-essential libboost-all-dev libssl-dev
|
||||
chroot "$rootdir" apt-get -y install build-essential
|
||||
chroot "$rootdir" apt-get -y install autoconf automake libtool curl make unzip
|
||||
|
||||
# A workaround which allows c++14 to be installed
|
||||
sed -i 's|jessie|stretch|g' $rootdir/etc/apt/sources.list
|
||||
sed -i 's|stretch-backports|jessie-backports|g' $rootdir/etc/apt/sources.list
|
||||
chroot "$rootdir" apt-get update
|
||||
chroot "$rootdir" apt-get -y install g++ gcc-6 g++-6 libboost-all-dev libssl-dev
|
||||
chroot "$rootdir" apt-get -y install protobuf-compiler libprotobuf-dev
|
||||
chroot "$rootdir" apt-get -y install qtbase5-dev libqt5svg5-dev libqt5websockets5-dev
|
||||
chroot "$rootdir" apt-get -y install autoconf automake libtool curl make g++ unzip
|
||||
chroot "$rootdir" apt-get -y install libsqlite3-dev qttools5-dev qttools5-dev-tools libnatpmp-dev
|
||||
sed -i 's|stretch|jessie|g' $rootdir/etc/apt/sources.list
|
||||
chroot "$rootdir" apt-get update
|
||||
|
||||
if [ ! -d $rootdir$INSTALL_DIR ]; then
|
||||
chroot "$rootdir" mkdir -p $INSTALL_DIR
|
||||
mkdir -p $rootdir$INSTALL_DIR
|
||||
fi
|
||||
chroot "$rootdir" git clone $PROTOBUF_REPO $rootdir$INSTALL_DIR/protobuf
|
||||
|
||||
git clone $PROTOBUF_REPO $rootdir$INSTALL_DIR/protobuf
|
||||
cd $rootdir$INSTALL_DIR/protobuf
|
||||
git checkout $PROTOBUF_COMMIT -b $PROTOBUF_COMMIT
|
||||
|
||||
|
@ -122,19 +162,59 @@ EOF
|
|||
chroot "$rootdir" chmod +x /root/install_protobuf
|
||||
chroot "$rootdir" /root/install_protobuf
|
||||
|
||||
git_clone $LIBREVAULT_REPO $rootdir$INSTALL_DIR/librevault
|
||||
git clone $LIBREVAULT_REPO $rootdir$INSTALL_DIR/librevault
|
||||
cd $rootdir$INSTALL_DIR/librevault
|
||||
git checkout $LIBREVAULT_COMMIT -b $LIBREVAULT_COMMIT
|
||||
git submodule update --init --recursive
|
||||
|
||||
# rabin seems particularly broken
|
||||
rm -rf $rootdir$INSTALL_DIR/librevault/contrib/rabin
|
||||
git clone https://github.com/bashrc/rabin $rootdir$INSTALL_DIR/librevault/contrib/rabin
|
||||
cd $rootdir$INSTALL_DIR/librevault/contrib/rabin
|
||||
git checkout bashrc/fixup2
|
||||
|
||||
mkdir $rootdir$INSTALL_DIR/librevault/build
|
||||
|
||||
cat <<EOF > $rootdir/root/install_librevault
|
||||
cd $INSTALL_DIR/librevault/build
|
||||
cmake ..
|
||||
cmake --build .
|
||||
cmake -BUILD_UPDATER=OFF ..
|
||||
which Meta_s.pb.cc
|
||||
cmake --build $INSTALL_DIR/librevault/build
|
||||
make install
|
||||
EOF
|
||||
chroot "$rootdir" chmod +x /root/install_librevault
|
||||
chroot "$rootdir" /root/install_librevault
|
||||
chroot "$rootdir" rm /root/install_librevault
|
||||
|
||||
LIBREVAULT_DAEMON=$rootdir/etc/systemd/system/librevault-daemon.service
|
||||
echo '[Unit]' > $LIBREVAULT_DAEMON
|
||||
echo 'Description=Librevault - Peer-to-peer, decentralized and open source file sync (multi-instance-master)' >> $LIBREVAULT_DAEMON
|
||||
echo '' >> $LIBREVAULT_DAEMON
|
||||
echo '[Service]' >> $LIBREVAULT_DAEMON
|
||||
echo 'Type=oneshot' >> $LIBREVAULT_DAEMON
|
||||
echo 'RemainAfterExit=yes' >> $LIBREVAULT_DAEMON
|
||||
echo 'ExecStart=/bin/true' >> $LIBREVAULT_DAEMON
|
||||
echo 'ExecReload=/bin/true' >> $LIBREVAULT_DAEMON
|
||||
echo '' >> $LIBREVAULT_DAEMON
|
||||
echo '[Install]' >> $LIBREVAULT_DAEMON
|
||||
echo 'WantedBy=multi-user.target' >> $LIBREVAULT_DAEMON
|
||||
|
||||
LIBREVAULT_DAEMON=$rootdir/etc/systemd/system/librevault-daemon@.service
|
||||
echo '[Unit]' > $LIBREVAULT_DAEMON
|
||||
echo 'Description=Librevault - Peer-to-peer, decentralized and open source file sync (instance for %I)' >> $LIBREVAULT_DAEMON
|
||||
echo 'After=network.target' >> $LIBREVAULT_DAEMON
|
||||
echo 'PartOf=librevault-daemon.service' >> $LIBREVAULT_DAEMON
|
||||
echo 'ReloadPropagatedFrom=librevault-daemon.service' >> $LIBREVAULT_DAEMON
|
||||
echo '' >> $LIBREVAULT_DAEMON
|
||||
echo '[Service]' >> $LIBREVAULT_DAEMON
|
||||
echo 'User=%i' >> $LIBREVAULT_DAEMON
|
||||
echo 'ExecStart=/usr/bin/librevault-daemon' >> $LIBREVAULT_DAEMON
|
||||
echo 'Restart=on-failure' >> $LIBREVAULT_DAEMON
|
||||
echo '' >> $LIBREVAULT_DAEMON
|
||||
echo '[Install]' >> $LIBREVAULT_DAEMON
|
||||
echo 'WantedBy=multi-user.target' >> $LIBREVAULT_DAEMON
|
||||
|
||||
chroot "$rootdir" systemctl enable librevault-daemon
|
||||
}
|
||||
|
||||
function install_librevault {
|
||||
|
@ -148,11 +228,23 @@ function install_librevault {
|
|||
fi
|
||||
|
||||
install_tracker
|
||||
install_cmake
|
||||
install_cryptopp
|
||||
|
||||
apt-get -y -t jessie-backports install cmake
|
||||
apt-get -y install build-essential libboost-all-dev libssl-dev
|
||||
apt-get -y install build-essential
|
||||
apt-get -y install autoconf automake libtool curl make unzip
|
||||
|
||||
# A workaround which allows c++14 to be installed
|
||||
sed -i 's|jessie|stretch|g' /etc/apt/sources.list
|
||||
sed -i 's|stretch-backports|jessie-backports|g' /etc/apt/sources.list
|
||||
apt-get update
|
||||
apt-get -y install protobuf-compiler libprotobuf-dev
|
||||
apt-get -y install g++ gcc-6 g++-6 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
|
||||
apt-get -y install libsqlite3-dev qttools5-dev qttools5-dev-tools libnatpmp-dev
|
||||
apt-get -y install gcc-6 g++-6 libboost-all-dev
|
||||
sed -i 's|stretch|jessie|g' /etc/apt/sources.list
|
||||
apt-get update
|
||||
|
||||
if [ ! -d $INSTALL_DIR ]; then
|
||||
mkdir -p $INSTALL_DIR
|
||||
|
@ -167,15 +259,66 @@ function install_librevault {
|
|||
make install
|
||||
ldconfig
|
||||
|
||||
if ! grep -q "Protobuf commit" $COMPLETION_FILE; then
|
||||
echo "Protobuf commit:$PROTOBUF_COMMIT" >> $COMPLETION_FILE
|
||||
else
|
||||
sed -i "s/Protobuf commit.*/Protobuf commit:$PROTOBUF_COMMIT/g" $COMPLETION_FILE
|
||||
fi
|
||||
|
||||
git_clone $LIBREVAULT_REPO $INSTALL_DIR/librevault
|
||||
cd $INSTALL_DIR/librevault
|
||||
git checkout $LIBREVAULT_COMMIT -b $LIBREVAULT_COMMIT
|
||||
git submodule update --init --recursive
|
||||
|
||||
# rabin seems particularly broken
|
||||
rm -rf $INSTALL_DIR/librevault/contrib/rabin
|
||||
git clone https://github.com/bashrc/rabin $INSTALL_DIR/librevault/contrib/rabin
|
||||
cd $INSTALL_DIR/librevault/contrib/rabin
|
||||
git checkout bashrc/fixup2
|
||||
|
||||
mkdir $INSTALL_DIR/librevault/build
|
||||
cd $INSTALL_DIR/librevault/build
|
||||
cmake ..
|
||||
cmake -BUILD_UPDATER=OFF ..
|
||||
cmake --build .
|
||||
make install
|
||||
|
||||
if ! grep -q "Librevault commit" $COMPLETION_FILE; then
|
||||
echo "Librevault commit:$LIBREVAULT_COMMIT" >> $COMPLETION_FILE
|
||||
else
|
||||
sed -i "s/Librevault commit.*/Librevault commit:$LIBREVAULT_COMMIT/g" $COMPLETION_FILE
|
||||
fi
|
||||
|
||||
LIBREVAULT_DAEMON=/etc/systemd/system/librevault-daemon.service
|
||||
echo '[Unit]' > $LIBREVAULT_DAEMON
|
||||
echo 'Description=Librevault - Peer-to-peer, decentralized and open source file sync (multi-instance-master)' >> $LIBREVAULT_DAEMON
|
||||
echo '' >> $LIBREVAULT_DAEMON
|
||||
echo '[Service]' >> $LIBREVAULT_DAEMON
|
||||
echo 'Type=oneshot' >> $LIBREVAULT_DAEMON
|
||||
echo 'RemainAfterExit=yes' >> $LIBREVAULT_DAEMON
|
||||
echo 'ExecStart=/bin/true' >> $LIBREVAULT_DAEMON
|
||||
echo 'ExecReload=/bin/true' >> $LIBREVAULT_DAEMON
|
||||
echo '' >> $LIBREVAULT_DAEMON
|
||||
echo '[Install]' >> $LIBREVAULT_DAEMON
|
||||
echo 'WantedBy=multi-user.target' >> $LIBREVAULT_DAEMON
|
||||
|
||||
LIBREVAULT_DAEMON=/etc/systemd/system/librevault-daemon@.service
|
||||
echo '[Unit]' > $LIBREVAULT_DAEMON
|
||||
echo 'Description=Librevault - Peer-to-peer, decentralized and open source file sync (instance for %I)' >> $LIBREVAULT_DAEMON
|
||||
echo 'After=network.target' >> $LIBREVAULT_DAEMON
|
||||
echo 'PartOf=librevault-daemon.service' >> $LIBREVAULT_DAEMON
|
||||
echo 'ReloadPropagatedFrom=librevault-daemon.service' >> $LIBREVAULT_DAEMON
|
||||
echo '' >> $LIBREVAULT_DAEMON
|
||||
echo '[Service]' >> $LIBREVAULT_DAEMON
|
||||
echo 'User=%i' >> $LIBREVAULT_DAEMON
|
||||
echo 'ExecStart=/usr/bin/librevault-daemon' >> $LIBREVAULT_DAEMON
|
||||
echo 'Restart=on-failure' >> $LIBREVAULT_DAEMON
|
||||
echo '' >> $LIBREVAULT_DAEMON
|
||||
echo '[Install]' >> $LIBREVAULT_DAEMON
|
||||
echo 'WantedBy=multi-user.target' >> $LIBREVAULT_DAEMON
|
||||
|
||||
systemctl enable librevault-daemon
|
||||
systemctl start librevault-daemon
|
||||
|
||||
echo 'install_librevault' >> $COMPLETION_FILE
|
||||
}
|
||||
|
||||
|
|
|
@ -555,6 +555,7 @@ initialise_mesh() {
|
|||
install_avahi
|
||||
install_batman
|
||||
install_tomb
|
||||
#install_librevault
|
||||
#install_ipfs
|
||||
install_tox
|
||||
install_web_server
|
||||
|
@ -618,6 +619,7 @@ function mesh_client_startup_applications {
|
|||
echo 'dconf write /org/mate/power-manager/lock-blank-screen false' >> $START_DESKTOP
|
||||
echo 'dconf write /org/mate/power-manager/lock-hibernate false' >> $START_DESKTOP
|
||||
echo 'dconf write /org/mate/power-manager/lock-keyring-hibernate false' >> $START_DESKTOP
|
||||
echo 'dconf write /org/mate/desktop/peripherals/touchpad/scroll-method 2' >> $START_DESKTOP
|
||||
echo "touch /home/$MY_USERNAME/.dbus/Xdbus" >> $START_DESKTOP
|
||||
echo "chmod 600 /home/$MY_USERNAME/.dbus/Xdbus" >> $START_DESKTOP
|
||||
echo "env | grep DBUS_SESSION_BUS_ADDRESS > /home/$MY_USERNAME/.dbus/Xdbus" >> $START_DESKTOP
|
||||
|
|
|
@ -63,6 +63,7 @@ ZERONET_PORT=15441
|
|||
IPFS_PORT=4001
|
||||
TOX_PORT=33445
|
||||
TRACKER_PORT=6969
|
||||
LIBREVAULT_PORT=42345
|
||||
|
||||
# Ethernet bridge definition (bridged to bat0)
|
||||
BRIDGE=br-mesh
|
||||
|
@ -141,6 +142,8 @@ function stop {
|
|||
iptables -D INPUT -p udp --dport $IPFS_PORT -j ACCEPT
|
||||
iptables -D INPUT -p tcp --dport $TOX_PORT -j ACCEPT
|
||||
iptables -D INPUT -p udp --dport $TOX_PORT -j ACCEPT
|
||||
iptables -D INPUT -p tcp --dport $LIBREVAULT_PORT -j ACCEPT
|
||||
iptables -D INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT
|
||||
|
||||
systemctl restart network-manager
|
||||
}
|
||||
|
@ -246,6 +249,8 @@ function start {
|
|||
iptables -A INPUT -p tcp --dport $IPFS_PORT -j ACCEPT
|
||||
iptables -A INPUT -p tcp --dport $TOX_PORT -j ACCEPT
|
||||
iptables -A INPUT -p udp --dport $TOX_PORT -j ACCEPT
|
||||
iptables -A INPUT -p tcp --dport $LIBREVAULT_PORT -j ACCEPT
|
||||
iptables -A INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT
|
||||
|
||||
systemctl restart avahi-daemon
|
||||
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# .---. . .
|
||||
# | | |
|
||||
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
||||
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
|
||||
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
|
||||
#
|
||||
# Freedom in the Cloud
|
||||
#
|
||||
# Some things need a recent build of CMake to compile
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
CMAKE_REPO="https://github.com/Kitware/CMake"
|
||||
CMAKE_COMMIT='d6734eeb875ceca5d810e829ca90541918dca2b4'
|
||||
|
||||
function mesh_install_cmake {
|
||||
if [ ! -d $rootdir$INSTALL_DIR ]; then
|
||||
chroot "$rootdir" mkdir -p $INSTALL_DIR
|
||||
fi
|
||||
|
||||
chroot "$rootdir" apt-get -y install build-essential
|
||||
|
||||
git clone $CMAKE_REPO $rootdir$INSTALL_DIR/cmake
|
||||
cd $rootdir$INSTALL_DIR/cmake
|
||||
git checkout $CMAKE_COMMIT -b $CMAKE_COMMIT
|
||||
|
||||
cat <<EOF > $rootdir/root/install_cmake
|
||||
cd $INSTALL_DIR/cmake
|
||||
./bootstrap
|
||||
make
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 72581
|
||||
fi
|
||||
make install
|
||||
EOF
|
||||
chroot "$rootdir" chmod +x /root/install_cmake
|
||||
chroot "$rootdir" /root/install_cmake
|
||||
chroot "$rootdir" rm /root/install_cmake
|
||||
}
|
||||
|
||||
function install_cmake {
|
||||
if [ $INSTALLING_MESH ]; then
|
||||
mesh_install_cmake
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -d $INSTALL_DIR/cmake ]; then
|
||||
if ! grep -q "CMake commit:$CMAKE_COMMIT" $COMPLETION_FILE; then
|
||||
set_repo_commit $INSTALL_DIR/cmake "CMake commit" "$CMAKE_COMMIT" $CMAKE_REPO
|
||||
cd $INSTALL_DIR/cmake
|
||||
./bootstrap
|
||||
make
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 72581
|
||||
fi
|
||||
make install
|
||||
fi
|
||||
fi
|
||||
|
||||
if grep -Fxq "install_cmake" $COMPLETION_FILE; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -d $INSTALL_DIR ]; then
|
||||
mkdir -p $INSTALL_DIR
|
||||
fi
|
||||
|
||||
apt-get -y install build-essential
|
||||
|
||||
git_clone $CMAKE_REPO $INSTALL_DIR/cmake
|
||||
cd $INSTALL_DIR/cmake
|
||||
git checkout $CMAKE_COMMIT -b $CMAKE_COMMIT
|
||||
./bootstrap
|
||||
make
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 72581
|
||||
fi
|
||||
make install
|
||||
|
||||
echo 'install_cmake' >> $COMPLETION_FILE
|
||||
}
|
||||
|
||||
# NOTE: deliberately there is no "exit 0"
|
|
@ -0,0 +1,104 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# .---. . .
|
||||
# | | |
|
||||
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
||||
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
|
||||
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
|
||||
#
|
||||
# Freedom in the Cloud
|
||||
#
|
||||
# A recent version of crypto++ is needed by some things
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
CRYPTOPP_REPO="https://github.com/weidai11/cryptopp"
|
||||
CRYPTOPP_COMMIT='65e91a8caa8c1846cb311bc83d8507e12699d6d3'
|
||||
|
||||
function mesh_install_cryptopp {
|
||||
if [ ! -d $rootdir$INSTALL_DIR ]; then
|
||||
chroot "$rootdir" mkdir -p $INSTALL_DIR
|
||||
fi
|
||||
|
||||
chroot "$rootdir" apt-get -y install build-essential
|
||||
|
||||
git clone $CRYPTOPP_REPO $rootdir$INSTALL_DIR/cryptopp
|
||||
cd $rootdir$INSTALL_DIR/cryptopp
|
||||
git checkout $CRYPTOPP_COMMIT -b $CRYPTOPP_COMMIT
|
||||
mkdir $rootdir$INSTALL_DIR/cryptopp/build
|
||||
|
||||
cat <<EOF > $rootdir/root/install_cryptopp
|
||||
cd $INSTALL_DIR/cryptopp/build
|
||||
cmake ..
|
||||
make
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 62825
|
||||
fi
|
||||
make install
|
||||
EOF
|
||||
chroot "$rootdir" chmod +x /root/install_cryptopp
|
||||
chroot "$rootdir" /root/install_cryptopp
|
||||
chroot "$rootdir" rm /root/install_cryptopp
|
||||
}
|
||||
|
||||
function install_cryptopp {
|
||||
if [ $INSTALLING_MESH ]; then
|
||||
mesh_install_cryptopp
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -d $INSTALL_DIR/cryptopp ]; then
|
||||
if ! grep -q "Crypto++ commit:$CRYPTOPP_COMMIT" $COMPLETION_FILE; then
|
||||
set_repo_commit $INSTALL_DIR/cryptopp "Crypto++ commit" "$CRYPTOPP_COMMIT" $CRYPTOPP_REPO
|
||||
cd $INSTALL_DIR/cryptopp/build
|
||||
cmake ..
|
||||
make
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 72581
|
||||
fi
|
||||
make install
|
||||
fi
|
||||
fi
|
||||
|
||||
if grep -Fxq "install_cryptopp" $COMPLETION_FILE; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -d $INSTALL_DIR ]; then
|
||||
mkdir -p $INSTALL_DIR
|
||||
fi
|
||||
|
||||
apt-get -y install build-essential
|
||||
|
||||
git_clone $CRYPTOPP_REPO $INSTALL_DIR/cryptopp
|
||||
cd $INSTALL_DIR/cryptopp
|
||||
git checkout $CRYPTOPP_COMMIT -b $CRYPTOPP_COMMIT
|
||||
mkdir -p $INSTALL_DIR/cryptopp/build
|
||||
cd $INSTALL_DIR/cryptopp/build
|
||||
cmake ..
|
||||
make
|
||||
if [ ! "$?" = "0" ]; then
|
||||
exit 62826
|
||||
fi
|
||||
make install
|
||||
|
||||
echo 'install_cryptopp' >> $COMPLETION_FILE
|
||||
}
|
||||
|
||||
# NOTE: deliberately there is no "exit 0"
|
Loading…
Reference in New Issue