#!/bin/sh #------------------------------------------------------------------------------ # __FLI4LVER__ # /usr/bin/embedded_keyprog # Creation: 17.06.2006 bastard # Last Update: $Id$ #------------------------------------------------------------------------------ usage() { myname=`basename $0` cat <<-EOF Usage: $myname wlan_toggle|reset|online_toggle [debug] EOF } log() { logger -t embedded_keyprog "$1" } case "$#" in 0) usage ;; *) case $1 in wlan_toggle) . /var/run/embedded.conf if [ -n "$embedded_wlan_dev" ] then if ip link show $embedded_wlan_dev 2>/dev/null | grep -q "[<,]UP[,>]" then log "shutting down wlan device $embedded_wlan_dev" ip link set $embedded_wlan_dev down echo "$embedded_wlan_led off" > /var/run/embedded.fifo else log "activation wlan device $embedded_wlan_dev" ip link set $embedded_wlan_dev up echo "$embedded_wlan_led on" > /var/run/embedded.fifo fi fi ;; reset) reboot ;; online_toggle) if [ -f /etc/default-route-interface ] # default route existing? then default_route_interface=`/bin/cat /etc/default-route-interface` else default_route_interface=`ip route show | grep '^default' | sed 's/^default.*dev //g'` case $default_route_interface in ppp0) default_route_interface=pppoe ;; esac fi if [ -f /var/run/online ] then # go offline log "going offline" fli4lctrl hangup $default_route_interface else # go online log "going online" fli4lctrl dial $default_route_interface fi ;; none) ;; esac ;; esac