|
@@ -46,10 +46,17 @@ TAHOELAFS_STORAGE_ONION_PORT=8097
|
46
|
46
|
TAHOE_COMMAND="cd /home/tahoelafs/tahoelafs && venv/bin/tahoe"
|
47
|
47
|
tahoelafs_storage_file=/home/tahoelafs/client/private/servers.yaml
|
48
|
48
|
|
|
49
|
+TAHOELAFS_SHARES_NEEDED=3
|
|
50
|
+TAHOELAFS_SHARES_HAPPY=7
|
|
51
|
+TAHOELAFS_SHARES_TOTAL=10
|
|
52
|
+
|
49
|
53
|
tahoelafs_variables=(ONION_ONLY
|
50
|
54
|
MY_USERNAME
|
51
|
55
|
TAHOELAFS_REPO
|
52
|
|
- TAHOELAFS_PORT)
|
|
56
|
+ TAHOELAFS_PORT
|
|
57
|
+ TAHOELAFS_SHARES_NEEDED
|
|
58
|
+ TAHOELAFS_SHARES_HAPPY
|
|
59
|
+ TAHOELAFS_SHARES_TOTAL)
|
53
|
60
|
|
54
|
61
|
function add_tahoelafs_storage_node_interactive {
|
55
|
62
|
data=$(tempfile 2>/dev/null)
|
|
@@ -78,7 +85,7 @@ function add_tahoelafs_storage_node_interactive {
|
78
|
85
|
|
79
|
86
|
add_tahoelafs_server "${storage_hostname}" "${public_key}" "${nick}" "${furl}"
|
80
|
87
|
|
81
|
|
- if grep -q "$public_key" $tahoelafs_storage_file; then
|
|
88
|
+ if grep -q "$public_key" ${tahoelafs_storage_file}; then
|
82
|
89
|
dialog --title $"Add Tahoe-LAFS storage node" \
|
83
|
90
|
--msgbox $"Storage node added" 6 40
|
84
|
91
|
fi
|
|
@@ -90,15 +97,63 @@ function edit_tahoelafs_nodes {
|
90
|
97
|
systemctl restart tahoelafs-client
|
91
|
98
|
}
|
92
|
99
|
|
|
100
|
+function edit_tahoelafs_shares {
|
|
101
|
+ read_config_param TAHOELAFS_SHARES_NEEDED
|
|
102
|
+ read_config_param TAHOELAFS_SHARES_HAPPY
|
|
103
|
+ read_config_param TAHOELAFS_SHARES_TOTAL
|
|
104
|
+
|
|
105
|
+ data=$(tempfile 2>/dev/null)
|
|
106
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
107
|
+ dialog --backtitle $"Freedombone Configuration" \
|
|
108
|
+ --title $"Tahoe-LAFS shares" \
|
|
109
|
+ --form $"\nEnter the storage node details which can be found on the About screen of another server" 13 40 3 \
|
|
110
|
+ $"Needed:" 1 1 "${TAHOELAFS_SHARES_NEEDED}" 1 14 4 4 \
|
|
111
|
+ $"Happy:" 2 1 "${TAHOELAFS_SHARES_HAPPY}" 2 14 4 4 \
|
|
112
|
+ $"Total:" 3 1 "${TAHOELAFS_SHARES_TOTAL}" 3 14 4 4 \
|
|
113
|
+ 2> $data
|
|
114
|
+ sel=$?
|
|
115
|
+ case $sel in
|
|
116
|
+ 1) return;;
|
|
117
|
+ 255) return;;
|
|
118
|
+ esac
|
|
119
|
+ tl_needed="$(cat $data | sed -n 1p)"
|
|
120
|
+ tl_happy="$(cat $data | sed -n 2p)"
|
|
121
|
+ tl_total="$(cat $data | sed -n 3p)"
|
|
122
|
+ if [ ${#tl_needed} -gt 0 ]; then
|
|
123
|
+ TAHOELAFS_SHARES_NEEDED=${tl_needed}
|
|
124
|
+ fi
|
|
125
|
+ if [ ${#tl_happy} -gt 0 ]; then
|
|
126
|
+ TAHOELAFS_SHARES_HAPPY=${tl_happy}
|
|
127
|
+ fi
|
|
128
|
+ if [ ${#tl_total} -gt 0 ]; then
|
|
129
|
+ TAHOELAFS_SHARES_TOTAL=${tl_total}
|
|
130
|
+ fi
|
|
131
|
+
|
|
132
|
+ sed -i "s|shares.needed.*|shares.needed = ${TAHOELAFS_SHARES_NEEDED}|g" /home/tahoelafs/tahoelafs/client/tahoe.cfg
|
|
133
|
+ sed -i "s|shares.happy.*|shares.happy = ${TAHOELAFS_SHARES_HAPPY}|g" /home/tahoelafs/tahoelafs/client/tahoe.cfg
|
|
134
|
+ sed -i "s|shares.total.*|shares.total = ${TAHOELAFS_SHARES_TOTAL}|g" /home/tahoelafs/tahoelafs/client/tahoe.cfg
|
|
135
|
+
|
|
136
|
+ sed -i "s|shares.needed.*|shares.needed = ${TAHOELAFS_SHARES_NEEDED}|g" /home/tahoelafs/tahoelafs/storage/tahoe.cfg
|
|
137
|
+ sed -i "s|shares.happy.*|shares.happy = ${TAHOELAFS_SHARES_HAPPY}|g" /home/tahoelafs/tahoelafs/storage/tahoe.cfg
|
|
138
|
+ sed -i "s|shares.total.*|shares.total = ${TAHOELAFS_SHARES_TOTAL}|g" /home/tahoelafs/tahoelafs/storage/tahoe.cfg
|
|
139
|
+
|
|
140
|
+ systemctl restart tahoelafs-storage
|
|
141
|
+ systemctl restart tahoelafs-client
|
|
142
|
+
|
|
143
|
+ dialog --title $"Tahoe-LAFS shares" \
|
|
144
|
+ --msgbox $"Shares settings changed" 6 40
|
|
145
|
+}
|
|
146
|
+
|
93
|
147
|
function configure_interactive_tahoelafs {
|
94
|
148
|
data=$(tempfile 2>/dev/null)
|
95
|
149
|
trap "rm -f $data" 0 1 2 5 15
|
96
|
150
|
dialog --backtitle $"Freedombone Configuration" \
|
97
|
151
|
--title $"Tahoe-LAFS" \
|
98
|
|
- --radiolist $"The least authority is always the best" 10 50 3 \
|
|
152
|
+ --radiolist $"The least authority is always the best" 10 50 4 \
|
99
|
153
|
1 "Add a storage node" off \
|
100
|
154
|
2 "Manually edit storage nodes" off \
|
101
|
|
- 3 "Back to main menu" on 2> $data
|
|
155
|
+ 3 "Shares settings" off \
|
|
156
|
+ 4 "Back to main menu" on 2> $data
|
102
|
157
|
sel=$?
|
103
|
158
|
case $sel in
|
104
|
159
|
1) exit 1;;
|
|
@@ -107,6 +162,7 @@ function configure_interactive_tahoelafs {
|
107
|
162
|
case $(cat $data) in
|
108
|
163
|
1) add_tahoelafs_storage_node_interactive;;
|
109
|
164
|
2) edit_tahoelafs_nodes;;
|
|
165
|
+ 3) edit_tahoelafs_shares;;
|
110
|
166
|
esac
|
111
|
167
|
}
|
112
|
168
|
|
|
@@ -117,16 +173,16 @@ function tahoelafs_setup_client_config {
|
117
|
173
|
echo '[node]' > $config_file
|
118
|
174
|
echo "nickname = $nick" >> $config_file
|
119
|
175
|
echo 'reveal-IP-address = false' >> $config_file
|
120
|
|
- echo "web.port = tcp:$TAHOELAFS_ONION_PORT:interface=127.0.0.1" >> $config_file
|
|
176
|
+ echo "web.port = tcp:${TAHOELAFS_ONION_PORT}:interface=127.0.0.1" >> $config_file
|
121
|
177
|
echo 'web.static = public_html' >> $config_file
|
122
|
178
|
echo 'tub.port = disabled' >> $config_file
|
123
|
179
|
echo 'tub.location = disabled' >> $config_file
|
124
|
180
|
echo '' >> $config_file
|
125
|
181
|
echo '[client]' >> $config_file
|
126
|
182
|
echo 'introducer.furl =' >> $config_file
|
127
|
|
- echo 'shares.needed = 3' >> $config_file
|
128
|
|
- echo 'shares.happy = 7' >> $config_file
|
129
|
|
- echo 'shares.total = 10' >> $config_file
|
|
183
|
+ echo "shares.needed = ${TAHOELAFS_SHARES_NEEDED}" >> $config_file
|
|
184
|
+ echo "shares.happy = ${TAHOELAFS_SHARES_HAPPY}" >> $config_file
|
|
185
|
+ echo "shares.total = ${TAHOELAFS_SHARES_TOTAL}" >> $config_file
|
130
|
186
|
echo '' >> $config_file
|
131
|
187
|
echo '[storage]' >> $config_file
|
132
|
188
|
echo 'enabled = false' >> $config_file
|
|
@@ -155,9 +211,9 @@ function tahoelafs_setup_storage_config {
|
155
|
211
|
echo 'introducer.furl =' >> $config_file
|
156
|
212
|
echo 'helper.furl =' >> $config_file
|
157
|
213
|
echo '' >> $config_file
|
158
|
|
- echo 'shares.needed = 3' >> $config_file
|
159
|
|
- echo 'shares.happy = 7' >> $config_file
|
160
|
|
- echo 'shares.total = 10' >> $config_file
|
|
214
|
+ echo "shares.needed = ${TAHOELAFS_SHARES_NEEDED}" >> $config_file
|
|
215
|
+ echo "shares.happy = ${TAHOELAFS_SHARES_HAPPY}" >> $config_file
|
|
216
|
+ echo "shares.total = ${TAHOELAFS_SHARES_TOTAL}" >> $config_file
|
161
|
217
|
echo '' >> $config_file
|
162
|
218
|
echo '[storage]' >> $config_file
|
163
|
219
|
echo 'enabled = true' >> $config_file
|