|
@@ -120,6 +120,29 @@ function mesh_avahi {
|
120
|
120
|
chmod +x "$rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME"
|
121
|
121
|
}
|
122
|
122
|
|
|
123
|
+function keep_avahi_running {
|
|
124
|
+ WATCHDOG_SCRIPT_NAME="keepon"
|
|
125
|
+
|
|
126
|
+ if [ ! -f "/usr/bin/$WATCHDOG_SCRIPT_NAME" ]; then
|
|
127
|
+ { echo '#!/bin/bash';
|
|
128
|
+ echo 'LOGFILE=/var/log/keepon.log';
|
|
129
|
+ echo "CURRENT_DATE=\$(date)"; } > "/usr/bin/$WATCHDOG_SCRIPT_NAME"
|
|
130
|
+ fi
|
|
131
|
+
|
|
132
|
+ if ! grep -q "avahi daemon" "/usr/bin/$WATCHDOG_SCRIPT_NAME"; then
|
|
133
|
+ { echo '';
|
|
134
|
+ echo '# keep avahi daemon running';
|
|
135
|
+ echo "AVAHI_RUNNING=\$(systemctl is-active avahi-daemon >/dev/null 2>&1 && echo Running)";
|
|
136
|
+ echo "if [ ! \$AVAHI_RUNNING ]; then";
|
|
137
|
+ echo ' systemctl start avahi-daemon';
|
|
138
|
+ echo " echo -n \$CURRENT_DATE >> \$LOGFILE";
|
|
139
|
+ echo " echo \" Avahi daemon restarted\" >> \$LOGFILE";
|
|
140
|
+ echo 'fi';
|
|
141
|
+ echo '# End of avahi'; } >> "/usr/bin/$WATCHDOG_SCRIPT_NAME"
|
|
142
|
+ chmod +x "/usr/bin/$WATCHDOG_SCRIPT_NAME"
|
|
143
|
+ fi
|
|
144
|
+}
|
|
145
|
+
|
123
|
146
|
function install_avahi {
|
124
|
147
|
if [ "$INSTALLING_MESH" ]; then
|
125
|
148
|
mesh_avahi
|
|
@@ -150,25 +173,6 @@ function install_avahi {
|
150
|
173
|
sed -i 's|#domain-name=.*|domain-name=local|g' /etc/avahi/avahi-daemon.conf
|
151
|
174
|
sed -i 's|domain-name=.*|domain-name=local|g' /etc/avahi/avahi-daemon.conf
|
152
|
175
|
|
153
|
|
- # keep the daemon running
|
154
|
|
- WATCHDOG_SCRIPT_NAME="keepon"
|
155
|
|
- if [ ! -f "/usr/bin/$WATCHDOG_SCRIPT_NAME" ]; then
|
156
|
|
- { echo '#!/bin/bash';
|
157
|
|
- echo 'LOGFILE=/var/log/keepon.log';
|
158
|
|
- echo "CURRENT_DATE=\$(date)"; } > "/usr/bin/$WATCHDOG_SCRIPT_NAME"
|
159
|
|
- fi
|
160
|
|
-
|
161
|
|
- { echo '';
|
162
|
|
- echo '# keep avahi daemon running';
|
163
|
|
- echo "AVAHI_RUNNING=\$(systemctl is-active avahi-daemon >/dev/null 2>&1 && echo Running)";
|
164
|
|
- echo "if [ ! \$AVAHI_RUNNING ]; then";
|
165
|
|
- echo ' systemctl start avahi-daemon';
|
166
|
|
- echo " echo -n \$CURRENT_DATE >> \$LOGFILE";
|
167
|
|
- echo " echo \" Avahi daemon restarted\" >> \$LOGFILE";
|
168
|
|
- echo 'fi';
|
169
|
|
- echo '# End of avahi'; } >> "/usr/bin/$WATCHDOG_SCRIPT_NAME"
|
170
|
|
- chmod +x "/usr/bin/$WATCHDOG_SCRIPT_NAME"
|
171
|
|
-
|
172
|
176
|
mark_completed "${FUNCNAME[0]}"
|
173
|
177
|
}
|
174
|
178
|
|