# /usr/lib/platinum/net_quickstatus.sh
#  Copyright ©2010 Güralp Systems Ltd. Written by Laurence Withers, 
#  <l@lwithers.me.uk>. Released under the GNU GPLv3.
#
#  Functions for creating and maintaining quickstatus files for network
#  interfaces.
#



# net_quickstatus_start()
#  Create a quickstatus file with the current IP addresses of the given
#  interface. Pass the interface name as $1.
net_quickstatus_start() {
    cat > "/var/run/quickstatus/net-$1" <<EOF
Title: IP addresses

`ip addr show dev $1 | grep 'inet' | grep -v 'scope link' | awk '{print $2}'`
EOF
}



# net_quickstatus_stop()
#  Remove the quickstatus file associated with the given interface, $1.
net_quickstatus_stop() {
    rm -f "/var/run/quickstatus/net-$1"
}



# vim: ts=4:sw=4:expandtab
