|
@@ -44,86 +44,6 @@ ROUTER_IP_ADDRESS="192.168.1.254"
|
44
|
44
|
|
45
|
45
|
MESH_INSTALL_DIR=/var/lib
|
46
|
46
|
|
47
|
|
-# For Beaglebone Black network reboot daemon
|
48
|
|
-BBBRTC_REPO="https://code.freedombone.net/bashrc/bbbrtc"
|
49
|
|
-PHYREG_REPO="https://code.freedombone.net/bashrc/phyreg"
|
50
|
|
-
|
51
|
|
-function bbb_network_restart_daemon {
|
52
|
|
- rdir="$1"
|
53
|
|
-
|
54
|
|
- # This checks if there is an ethernet boot fault
|
55
|
|
- # and if so it reboots and tries again
|
56
|
|
- # https://github.com/bigjosh/bbbphyfix
|
57
|
|
-
|
58
|
|
- if [ ! -d "$rdir$INSTALL_DIR" ]; then
|
59
|
|
- mkdir -p "$rdir$INSTALL_DIR"
|
60
|
|
- fi
|
61
|
|
-
|
62
|
|
- # install bbbrtc
|
63
|
|
- cd "$rdir$INSTALL_DIR" || exit 357893563
|
64
|
|
- git clone $BBBRTC_REPO "$rdir$INSTALL_DIR/bbbrtc"
|
65
|
|
- cd "$rdir$INSTALL_DIR/bbbrtc" || exit 357893563
|
66
|
|
- if ! make; then
|
67
|
|
- exit 3568735
|
68
|
|
- fi
|
69
|
|
-
|
70
|
|
- # install bbbphyreg
|
71
|
|
- cd "$rdir$INSTALL_DIR" || exit 357893563
|
72
|
|
- git clone $PHYREG_REPO "$rdir$INSTALL_DIR/phyreg"
|
73
|
|
- cd "$rdir$INSTALL_DIR/phyreg" || exit 54789786
|
74
|
|
- make clean
|
75
|
|
- if ! make; then
|
76
|
|
- exit 46879275
|
77
|
|
- fi
|
78
|
|
- make install
|
79
|
|
-
|
80
|
|
- { echo '#!/bin/bash';
|
81
|
|
- echo '';
|
82
|
|
- echo 'sleep 30';
|
83
|
|
- echo '';
|
84
|
|
- echo "if [[ \$(phyreg test 18 13) == \"1\" ]]; then";
|
85
|
|
- echo '';
|
86
|
|
- echo ' sleep 1';
|
87
|
|
- echo '';
|
88
|
|
- echo " NOW=\$(bbbrtc now)";
|
89
|
|
- echo " echo \"chkphy:Rebooting NOW=\$NOW\" >/dev/kmsg";
|
90
|
|
- echo " echo \"Rebooting\" >>/var/tmp/chkphy.log";
|
91
|
|
- echo ' # make sure that log message actually gets written before we pull the plug';
|
92
|
|
- echo ' sync';
|
93
|
|
- echo ' i2cset -f -y 0 0x24 0x0a 0x00';
|
94
|
|
- echo ' bbbrtc now 130';
|
95
|
|
- echo ' bbbrtc wake 110';
|
96
|
|
- echo ' bbbrtc sleep 102';
|
97
|
|
- echo ' bbbrtc now 100';
|
98
|
|
- echo ' while true;';
|
99
|
|
- echo ' do echo waiting to reboot';
|
100
|
|
- echo ' sleep 10';
|
101
|
|
- echo ' done';
|
102
|
|
- echo ' fi';
|
103
|
|
- echo '';
|
104
|
|
- echo "echo \"chkphy:eth0 good\" >/dev/kmsg"; } > "${rdir}/usr/bin/chkphy"
|
105
|
|
- chmod +x "${rdir}/usr/bin/chkphy"
|
106
|
|
-
|
107
|
|
- { echo '[Unit]';
|
108
|
|
- echo "Description=Beaglebone Black Network Restart Daemon";
|
109
|
|
- echo 'After=syslog.target';
|
110
|
|
- echo '';
|
111
|
|
- echo '[Service]';
|
112
|
|
- echo 'Type=simple';
|
113
|
|
- echo 'User=root';
|
114
|
|
- echo 'Group=root';
|
115
|
|
- echo 'WorkingDirectory=/root';
|
116
|
|
- echo 'ExecStart=/usr/bin/chkphy';
|
117
|
|
- echo '';
|
118
|
|
- echo '[Install]';
|
119
|
|
- echo 'WantedBy=multi-user.target'; } > "${rdir}/etc/systemd/system/bbbnetwork.service"
|
120
|
|
- if [ ! "${rdir}" ]; then
|
121
|
|
- systemctl enable bbbnetwork
|
122
|
|
- else
|
123
|
|
- chroot "$rdir" systemctl enable bbbnetwork
|
124
|
|
- fi
|
125
|
|
-}
|
126
|
|
-
|
127
|
47
|
function get_app_icann_address {
|
128
|
48
|
app_name="$1"
|
129
|
49
|
if grep -q "${app_name} domain" "$COMPLETION_FILE"; then
|