|
@@ -302,6 +302,71 @@ function configure_zeronet_forum {
|
302
|
302
|
echo $'Update of ZeroNet Forum completed' >> $INSTALL_LOG
|
303
|
303
|
}
|
304
|
304
|
|
|
305
|
+function configure_zeronet_id {
|
|
306
|
+ echo $'Updating ZeroID' >> $INSTALL_LOG
|
|
307
|
+
|
|
308
|
+ cd /opt/zeronet
|
|
309
|
+ python zeronet.py --batch siteCreate 2> /opt/zeronet/zeroid.txt
|
|
310
|
+ if [ ! -f /opt/zeronet/zeroid.txt ]; then
|
|
311
|
+ echo $'Unable to create ZeroID' >> $INSTALL_LOG
|
|
312
|
+ exit 47962
|
|
313
|
+ fi
|
|
314
|
+ zeroid_address=$(cat zeroid.txt | grep "Site address" | awk -F ':' '{print $2}')
|
|
315
|
+ zeroid_private_key=$(cat zeroid.txt | grep "Site private key" | awk -F ':' '{print $2}')
|
|
316
|
+ ZERONET_ID_ADDRESS=${zeroid_address//[[:blank:]]/}
|
|
317
|
+ ZERONET_ID_PRIVATE_KEY=${zeroid_private_key//[[:blank:]]/}
|
|
318
|
+
|
|
319
|
+ if [ ${#ZERONET_ID_ADDRESS} -lt 20 ]; then
|
|
320
|
+ echo $"Address: $ZERONET_ID_ADDRESS" >> $INSTALL_LOG
|
|
321
|
+ echo $"Public key: $ZERONET_ID_PRIVATE_KEY" >> $INSTALL_LOG
|
|
322
|
+ echo $'Unable to create ZeroID address' >> $INSTALL_LOG
|
|
323
|
+ exit 76352
|
|
324
|
+ fi
|
|
325
|
+
|
|
326
|
+ if [ ${#ZERONET_ID_PRIVATE_KEY} -lt 20 ]; then
|
|
327
|
+ echo $"Address: $ZERONET_ID_ADDRESS" >> $INSTALL_LOG
|
|
328
|
+ echo $"Public key: $ZERONET_ID_PRIVATE_KEY" >> $INSTALL_LOG
|
|
329
|
+ echo $'Unable to create ZeroID private key' >> $INSTALL_LOG
|
|
330
|
+ exit 87356
|
|
331
|
+ fi
|
|
332
|
+
|
|
333
|
+ if [ ! -d "/opt/zeronet/data/$ZERONET_ID_ADDRESS" ]; then
|
|
334
|
+ echo $"Unable to find site directory: /opt/zeronet/data/$ZERONET_ID_ADDRESS" >> $INSTALL_LOG
|
|
335
|
+ exit 378434
|
|
336
|
+ fi
|
|
337
|
+
|
|
338
|
+ echo $"ZeroID address: $ZERONET_ID_ADDRESS"
|
|
339
|
+ echo $"ZeroID private key: $ZERONET_ID_PRIVATE_KEY"
|
|
340
|
+ cp -r /opt/zeronet/ZeroID/* /opt/zeronet/data/$ZERONET_ID_ADDRESS
|
|
341
|
+ # TODO
|
|
342
|
+ sed -i "s///g" /opt/zeronet/data/$ZERONET_ID_ADDRESS/content.json
|
|
343
|
+ python zeronet.py siteSign $ZERONET_ID_ADDRESS $ZERONET_ID_PRIVATE_KEY --inner_path data/users/content.json
|
|
344
|
+
|
|
345
|
+ # Add an avahi service
|
|
346
|
+ echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /tmp/zeronet-id.service
|
|
347
|
+ echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /tmp/zeronet-id.service
|
|
348
|
+ echo '<service-group>' >> /tmp/zeronet-id.service
|
|
349
|
+ echo ' <name replace-wildcards="yes">%h ZeroID</name>' >> /tmp/zeronet-id.service
|
|
350
|
+ echo ' <service>' >> /tmp/zeronet-id.service
|
|
351
|
+ echo ' <type>_zeronet._udp</type>' >> /tmp/zeronet-id.service
|
|
352
|
+ echo " <port>$ZERONET_PORT</port>" >> /tmp/zeronet-id.service
|
|
353
|
+ echo " <txt-record>$ZERONET_URL/$ZERONET_ID_ADDRESS</txt-record>" >> /tmp/zeronet-id.service
|
|
354
|
+ echo ' </service>' >> /tmp/zeronet-id.service
|
|
355
|
+ echo '</service-group>' >> /tmp/zeronet-id.service
|
|
356
|
+ sudo cp /tmp/zeronet-id.service /etc/avahi/services/zeronet-id.service
|
|
357
|
+
|
|
358
|
+ if [ ! -d /home/$MY_USERNAME/.config/zeronet ]; then
|
|
359
|
+ mkdir -p /home/$MY_USERNAME/.config/zeronet
|
|
360
|
+ chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config
|
|
361
|
+ fi
|
|
362
|
+ echo "$ZERONET_URL/$ZERONET_ID_ADDRESS" > /home/$MY_USERNAME/.config/zeronet/myzeroid
|
|
363
|
+
|
|
364
|
+ sed -i "s|ZeroID address.*|ZeroID address: $ZERONET_ID_ADDRESS|g" /home/$MY_USERNAME/README
|
|
365
|
+ sed -i "s|ZeroID private key.*|ZeroID private key: $ZERONET_ID_PRIVATE_KEY|g" /home/$MY_USERNAME/README
|
|
366
|
+
|
|
367
|
+ echo $'Update of ZeroID completed' >> $INSTALL_LOG
|
|
368
|
+}
|
|
369
|
+
|
305
|
370
|
function configure_toxcore {
|
306
|
371
|
echo $'Configuring toxcore' >> $INSTALL_LOG
|
307
|
372
|
|
|
@@ -382,6 +447,7 @@ if [ -f /root/.initial_mesh_setup ]; then
|
382
|
447
|
configure_zeronet_blog
|
383
|
448
|
configure_zeronet_mail
|
384
|
449
|
configure_zeronet_forum
|
|
450
|
+ configure_zeronet_id
|
385
|
451
|
configure_toxcore
|
386
|
452
|
configure_zeronet
|
387
|
453
|
disable_password_logins
|