#!/bin/sh ### # # FreeWLAN Addons - http://www.freewlan.info # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA # # http://www.gnu.org/copyleft/gpl.html # ### if [ ! -f /etc/debug ]; then exit 0 fi . /etc/functions.sh config_load mailservice config_get fonupdatecheck mail fonupdatecheck config_get to mail to SEND=0 CLEAR=0 if enabled $fonupdatecheck;then updatefiles="$(ls /www/updates/thinclient* 2>/dev/null)" if [ -n "$updatefiles" ]; then touch /tmp/.fonupdatecheckmail for file in $updatefiles ; do filename=${file##*/} filesize=$(ls -l $file | tr -s " " | cut -d " " -f 5) liststring=$liststring"\n"$filename"\t"$filesize" bytes"; if ! grep $filename /tmp/.fonupdatecheckmail > /dev/null; then SEND=1 fi done if [ "$SEND" = "1" ]; then . /tmp/network-config MAIL_TO="$to"; ipaddress=`ifconfig $wan_ifname |grep inet|cut -d":" -f2|cut -d" " -f1`; echo -e " There are Updates from FON available. Here is the list: $liststring To verify and execute these updates use the URL: http://$ipaddress/cgi-bin/webif/fonupdate.sh " |mail "Fonera: ($(cat /etc/hostname)) fonUpdateCheck" "$MAIL_TO" fi fi # list clearing by simply create a new list ls /www/updates/thinclient* 2>/dev/null | while read s;do echo ${s##*/}; # faster than basename done > /tmp/.fonupdatecheckmail fi