diff --git a/files/etc/init.d/local b/files/etc/init.d/local
index 8f2354a4..12255f66 100755
--- a/files/etc/init.d/local
+++ b/files/etc/init.d/local
@@ -75,7 +75,7 @@ boot() {
fi
/usr/local/bin/usb_passthrough "${usbvalue}"
- # package repositorys
+ # package repositories
local repos="core base arednpackages packages luci routing telephony"
set -- $repos
while [ -n "$1" ]; do
@@ -95,4 +95,11 @@ boot() {
fi
shift
done
+
+ # set local alerts if available
+ local alertslocalpath=$(uci -q get aredn.@alerts[0].localpath)
+ if [ -z "$alertslocalpath" ]; then
+ uci -q add aredn alerts
+ uci -q commit aredn
+ fi
}
diff --git a/files/usr/local/bin/aredn_message.sh b/files/usr/local/bin/aredn_message.sh
index 91e297f5..c0d66edc 100755
--- a/files/usr/local/bin/aredn_message.sh
+++ b/files/usr/local/bin/aredn_message.sh
@@ -39,12 +39,12 @@ ping -q -W10 -c1 downloads.arednmesh.org > /dev/null &&
[ -f /tmp/aredn_message ] &&
rm /tmp/aredn_message
+nodename=$(echo "$HOSTNAME" | tr '[:upper:]' '[:lower:]')
if [ $online = "true" ]
then
# fetch node specific message file
# nodename=$(echo "$HOSTNAME" | tr 'A-Z' 'a-z')
- nodename=$(echo "$HOSTNAME" | tr 'A-Z' 'a-z')
wget -q -O aredn_message -P /tmp http://downloads.arednmesh.org/messages/"${nodename}".txt
echo "(${nodename}):"|cat - /tmp/aredn_message > /tmp/out && mv /tmp/out /tmp/aredn_message
if [ $? -ne 0 ] # no node specific file
@@ -62,3 +62,28 @@ then
fi
fi
+# are local alerts enabled? uci: aredn.alerts.localpath != NULL
+#
+alertslocalpath=$(uci -q get aredn.@alerts[0].localpath)
+if [ ! -z "$alertslocalpath" ]; then
+ # fetch node specific message file
+ wget -q -O local_message -P /tmp "${alertslocalpath}/${nodename}".txt
+ echo "(LOCAL ${nodename}):"|cat - /tmp/local_message > /tmp/out && mv /tmp/out /tmp/local_message
+ if [ $? -ne 0 ] # no node specific file
+ then
+ # fetch broadcast message file
+ wget -q -O local_message -P /tmp "${alertslocalpath}/all.txt"
+ echo "(LOCAL QST):"|cat - /tmp/local_message > /tmp/out && mv /tmp/out /tmp/local_message
+ else
+ # need to append to node file
+ wget -q -O local_message_all -P /tmp "${alertslocalpath}/all.txt" &&
+ echo "(LOCAL QST):"|cat - /tmp/local_message_all > /tmp/out && mv /tmp/out /tmp/local_message_all
+ echo "
" >> /tmp/local_message;
+ [ -f /tmp/local_message_all ] &&
+ cat /tmp/local_message_all >> /tmp/local_message &&
+ rm /tmp/local_message_all;
+ fi
+fi
+
+
+
diff --git a/files/www/cgi-bin/advancedconfig b/files/www/cgi-bin/advancedconfig
index 76a5911d..16f8b8d3 100755
--- a/files/www/cgi-bin/advancedconfig
+++ b/files/www/cgi-bin/advancedconfig
@@ -2,7 +2,7 @@
=for comment
Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks
- Copyright (C) 2018 - Darryl Quinn
+ Copyright (C) 2020 - Darryl Quinn
See Contributors file for additional contributors
Copyright (c) 2013 David Rivenburg et al. BroadBand-HamNet
@@ -146,6 +146,12 @@ push @setting, {
desc => "Value doesn't matter. Will attempt to pull any AREDN Alert messages.",
postcallback => "aam_refresh()"
};
+push @setting, {
+ key => "aredn.\@alerts[0].localpath",
+ type => "string",
+ desc => "Specifies the URL of the location from which local AREDN Alerts can be downloaded.",
+ default => ""
+};
# ----------------------------------------
diff --git a/files/www/cgi-bin/perlfunc.pm b/files/www/cgi-bin/perlfunc.pm
index c17470f0..220eaa28 100644
--- a/files/www/cgi-bin/perlfunc.pm
+++ b/files/www/cgi-bin/perlfunc.pm
@@ -1908,6 +1908,7 @@ sub alert_banner
{
# if /tmp/aredn_message file exists, then read and set $aredn_message to contents
$aredn_message = `cat /tmp/aredn_message` if( -f "/tmp/aredn_message");
+ $local_message = `cat /tmp/local_message` if( -f "/tmp/local_message");
print "