|
@@ -0,0 +1,137 @@
|
|
1
|
+#!/bin/bash
|
|
2
|
+#
|
|
3
|
+# .---. . .
|
|
4
|
+# | | |
|
|
5
|
+# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
|
6
|
+# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
|
|
7
|
+# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
|
|
8
|
+#
|
|
9
|
+# Freedom in the Cloud
|
|
10
|
+#
|
|
11
|
+# Librevault application
|
|
12
|
+#
|
|
13
|
+# License
|
|
14
|
+# =======
|
|
15
|
+#
|
|
16
|
+# Copyright (C) 2014-2016 Bob Mottram <bob@robotics.uk.to>
|
|
17
|
+#
|
|
18
|
+# This program is free software: you can redistribute it and/or modify
|
|
19
|
+# it under the terms of the GNU Affero General Public License as published by
|
|
20
|
+# the Free Software Foundation, either version 3 of the License, or
|
|
21
|
+# (at your option) any later version.
|
|
22
|
+#
|
|
23
|
+# This program is distributed in the hope that it will be useful,
|
|
24
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
25
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
26
|
+# GNU Affero General Public License for more details.
|
|
27
|
+#
|
|
28
|
+# You should have received a copy of the GNU Affero General Public License
|
|
29
|
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
30
|
+
|
|
31
|
+VARIANTS='none'
|
|
32
|
+
|
|
33
|
+PROTOBUF_REPO="https://github.com/google/protobuf"
|
|
34
|
+PROTOBUF_COMMIT='b97a4a53cdd55be74c30badefeb132a091764f53'
|
|
35
|
+
|
|
36
|
+LIBREVAULT_REPO="https://github.com/Librevault/librevault"
|
|
37
|
+LIBREVAULT_COMMIT='86a6aefcb5cc458f4d42195368fbcff2871f98e3'
|
|
38
|
+LIBREVAULT_PORT=
|
|
39
|
+
|
|
40
|
+function reconfigure_librevault {
|
|
41
|
+ echo -n ''
|
|
42
|
+ # TODO
|
|
43
|
+}
|
|
44
|
+
|
|
45
|
+function upgrade_librevault {
|
|
46
|
+ echo -n ''
|
|
47
|
+ # TODO
|
|
48
|
+}
|
|
49
|
+
|
|
50
|
+function backup_local_librevault {
|
|
51
|
+ # TODO
|
|
52
|
+}
|
|
53
|
+
|
|
54
|
+function restore_local_librevault {
|
|
55
|
+ # TODO
|
|
56
|
+}
|
|
57
|
+
|
|
58
|
+function backup_remote_librevault {
|
|
59
|
+ # TODO
|
|
60
|
+}
|
|
61
|
+
|
|
62
|
+function restore_remote_librevault {
|
|
63
|
+ # TODO
|
|
64
|
+}
|
|
65
|
+
|
|
66
|
+function remove_librevault {
|
|
67
|
+ if ! grep -Fxq "install_librevault" $COMPLETION_FILE; then
|
|
68
|
+ return
|
|
69
|
+ fi
|
|
70
|
+ iptables -D INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT
|
|
71
|
+ iptables -D INPUT -p tcp --dport $LIBREVAULT_PORT -j ACCEPT
|
|
72
|
+ function_check save_firewall_settings
|
|
73
|
+ save_firewall_settings
|
|
74
|
+
|
|
75
|
+ systemctl stop librevault
|
|
76
|
+ systemctl disable librevault
|
|
77
|
+ rm /etc/systemd/system/librevault.service
|
|
78
|
+ sed -i '/install_librevault/d' $COMPLETION_FILE
|
|
79
|
+ sed -i '/configure_firewall_for_librevault/d' $COMPLETION_FILE
|
|
80
|
+ systemctl restart cron
|
|
81
|
+}
|
|
82
|
+
|
|
83
|
+function configure_firewall_for_librevault {
|
|
84
|
+ if grep -Fxq "configure_firewall_for_librevault" $COMPLETION_FILE; then
|
|
85
|
+ return
|
|
86
|
+ fi
|
|
87
|
+ iptables -A INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT
|
|
88
|
+ iptables -A INPUT -p tcp --dport $LIBREVAULT_PORT -j ACCEPT
|
|
89
|
+ function_check save_firewall_settings
|
|
90
|
+ save_firewall_settings
|
|
91
|
+
|
|
92
|
+ OPEN_PORTS+=("Librevault $LIBREVAULT_PORT")
|
|
93
|
+ echo 'configure_firewall_for_librevault' >> $COMPLETION_FILE
|
|
94
|
+}
|
|
95
|
+
|
|
96
|
+function mesh_install_syncthing {
|
|
97
|
+}
|
|
98
|
+
|
|
99
|
+function install_syncthing {
|
|
100
|
+ if [ $INSTALLING_MESH ]; then
|
|
101
|
+ mesh_install_librevault
|
|
102
|
+ return
|
|
103
|
+ fi
|
|
104
|
+
|
|
105
|
+ if grep -Fxq "install_librevalut" $COMPLETION_FILE; then
|
|
106
|
+ return
|
|
107
|
+ fi
|
|
108
|
+
|
|
109
|
+ apt-get -y install build-essential cmake libboost-all-dev libssl-dev
|
|
110
|
+ apt-get -y install qtbase5-dev libqt5svg5-dev libqt5websockets5-dev
|
|
111
|
+ apt-get -y install autoconf automake libtool curl make g++ unzip
|
|
112
|
+
|
|
113
|
+ if [ ! -d $INSTALL_DIR ]; then
|
|
114
|
+ mkdir -p $INSTALL_DIR
|
|
115
|
+ fi
|
|
116
|
+ git_clone $PROTOBUF_REPO $INSTALL_DIR/protobuf
|
|
117
|
+ cd $INSTALL_DIR/protobuf
|
|
118
|
+ git checkout $PROTOBUF_COMMIT -b $PROTOBUF_COMMIT
|
|
119
|
+ ./autogen.sh
|
|
120
|
+ ./configure
|
|
121
|
+ make
|
|
122
|
+ make check
|
|
123
|
+ make install
|
|
124
|
+ ldconfig
|
|
125
|
+
|
|
126
|
+ git_clone $LIBREVAULT_REPO $INSTALL_DIR/librevault
|
|
127
|
+ cd $INSTALL_DIR/librevault
|
|
128
|
+ git checkout $LIBREVAULT_COMMIT -b $LIBREVAULT_COMMIT
|
|
129
|
+ mkdir $INSTALL_DIR/librevault/build
|
|
130
|
+ cd $INSTALL_DIR/librevault/build
|
|
131
|
+ cmake ..
|
|
132
|
+ cmake --build .
|
|
133
|
+
|
|
134
|
+ echo 'install_librevault' >> $COMPLETION_FILE
|
|
135
|
+}
|
|
136
|
+
|
|
137
|
+# NOTE: deliberately no exit 0
|