|
@@ -1,81 +0,0 @@
|
1
|
|
-#!/bin/bash
|
2
|
|
-#
|
3
|
|
-# .---. . .
|
4
|
|
-# | | |
|
5
|
|
-# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
6
|
|
-# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
|
7
|
|
-# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
|
8
|
|
-#
|
9
|
|
-# Freedom in the Cloud
|
10
|
|
-#
|
11
|
|
-# Web interface for the mesh
|
12
|
|
-#
|
13
|
|
-# License
|
14
|
|
-# =======
|
15
|
|
-#
|
16
|
|
-# Copyright (C) 2015-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
|
|
-PROJECT_NAME='freedombone'
|
32
|
|
-
|
33
|
|
-export TEXTDOMAIN=${PROJECT_NAME}-meshweb
|
34
|
|
-export TEXTDOMAINDIR="/usr/share/locale"
|
35
|
|
-
|
36
|
|
-MESH_INSTALL_DIR=/var/lib
|
37
|
|
-PEERS_FILE=/tmp/meshwebstart
|
38
|
|
-
|
39
|
|
-if [ -d $MESH_INSTALL_DIR/zeronet ]; then
|
40
|
|
- ZERONET_DIR=$MESH_INSTALL_DIR/zeronet
|
41
|
|
-fi
|
42
|
|
-
|
43
|
|
-avahi-browse -atl | awk -F ' ' '{print $4}' | sort -u > $PEERS_FILE
|
44
|
|
-
|
45
|
|
-if [ ! -f $PEERS_FILE ]; then
|
46
|
|
- echo $'No peers were found'
|
47
|
|
- exit 0
|
48
|
|
-fi
|
49
|
|
-
|
50
|
|
-# count the peers
|
51
|
|
-ctr=0
|
52
|
|
-while IFS='' read -r line || [[ -n "$line" ]]; do
|
53
|
|
- ctr=$((ctr + 1))
|
54
|
|
-done < "$PEERS_FILE"
|
55
|
|
-rm $PEERS_FILE
|
56
|
|
-
|
57
|
|
-# enough peers
|
58
|
|
-if [ ${ctr} -lt "1" ]; then
|
59
|
|
- echo $'No peers were found'
|
60
|
|
- exit 0
|
61
|
|
-fi
|
62
|
|
-
|
63
|
|
-ZERONET_INDEX=$MESH_INSTALL_DIR/zeronet/mesh.html
|
64
|
|
-
|
65
|
|
-if which firefox > /dev/null; then
|
66
|
|
- firefox $ZERONET_INDEX
|
67
|
|
-elif which midori > /dev/null; then
|
68
|
|
- midori $ZERONET_INDEX
|
69
|
|
-elif which iceweasel > /dev/null; then
|
70
|
|
- iceweasel $ZERONET_INDEX
|
71
|
|
-elif which chrome > /dev/null; then
|
72
|
|
- chrome $ZERONET_INDEX
|
73
|
|
-elif which chromium > /dev/null; then
|
74
|
|
- chromium $ZERONET_INDEX
|
75
|
|
-elif which xdg-open > /dev/null; then
|
76
|
|
- xdg-open $ZERONET_INDEX
|
77
|
|
-elif which gnome-open > /dev/null; then
|
78
|
|
- gnome-open $ZERONET_INDEX
|
79
|
|
-fi
|
80
|
|
-
|
81
|
|
-exit 0
|