Changeset 35678


Ignore:
Timestamp:
2013-02-19T18:01:34+01:00 (5 years ago)
Author:
zioproto
Message:

[packages] olsrd: use system-logger instead of dumping to stdout

packages: olsrd: use system-logger instead of dumping to stdout,
which is cleaner and also seen if not interactive called. minor
cleanups in some messages, also show function-name in messages.
by using 'logger -s' we can see the message on screen and in logs.

Signed-off-by: Bastian Bittorf <bittorf@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • packages/net/olsrd/files/olsrd.init

    r31966 r35678  
    2020N=' 
    2121' 
     22 
     23log() 
     24{ 
     25        logger -t olsrd -p daemon.info -s "$1" 
     26} 
    2227 
    2328validate_varname() { 
     
    7681 
    7782warning_invalid_value() { 
     83        local funcname="warning_invalid_value" 
    7884        local package="$1" 
    7985        validate_varname "$package" || package= 
     
    8389        validate_varname "$option" || option= 
    8490 
    85         echo -n "Warning: Invalid value" 1>&2 
    86  
    8791        if [ -n "$package" -a -n "$config" ]; then 
    88                 echo -n " in option '$package.$config${option:+.}$option'" 1>&2 
    89         fi 
    90  
    91         echo ", skipped" 1>&2 
     92                log "$funcname() in option '$package.$config${option:+.}$option', skipped" 
     93        else 
     94                log "$funcname() skipped" 
     95        fi 
    9296 
    9397        return 0 
     
    128132 
    129133olsrd_write_plparam() { 
     134        local funcname="olsrd_write_plparam" 
    130135        local param="$1" 
    131136        local cfg="$2" 
     
    164169                if validate_varname "$value"; then 
    165170                        if network_get_device ifname "$value"; then 
    166                                 echo "Info: mdns Interface '$value' ifname '$ifname' found" 1>&2 
     171                                log "$funcname() Info: mdns Interface '$value' ifname '$ifname' found" 
    167172                        else 
    168                                 echo "Warning: mdns Interface '$value' not found, skipped" 1>&2 
     173                                log "$funcname() Warning: mdns Interface '$value' not found, skipped" 
    169174                        fi 
    170175                else 
     
    400405 
    401406olsrd_write_loadplugin() { 
     407        local funcname="olsrd_write_loadplugin" 
    402408        local cfg="$1" 
    403409        validate_varname "$cfg" || return 0 
     
    418424        fi 
    419425        if ! [ -x "/lib/$library" -o -x "/usr/lib/$library" -o -x "/usr/local/lib/$library" ]; then 
    420                 echo "Warning: Plugin library '$library' not found, skipped" 1>&2 
     426                log "$funcname() Warning: Plugin library '$library' not found, skipped" 
    421427                return 0 
    422428        fi 
     
    463469 
    464470olsrd_write_interface() { 
     471        local funcname="olsrd_write_interface" 
    465472        local cfg="$1" 
    466473        validate_varname "$cfg" || return 0 
     
    481488                                ifsglobal="$ifsglobal $IFNAME" 
    482489                        else 
    483                                 echo "Warning: Interface '$interface' not found, skipped" 1>&2 
     490                                log "$funcname() Warning: Interface '$interface' not found, skipped" 
    484491                        fi 
    485492                else 
     
    553560 
    554561olsrd_setup_smartgw_rules() { 
     562        local funcname="olsrd_setup_smartgw_rules" 
    555563        # Check if ipip is installed 
    556         [ ! -e /etc/modules.d/[0-9]*-ipip ] && echo "Warning: kmod-ipip is missing. SmartGateway will not work until you install it." 
     564        [ -e /etc/modules.d/[0-9]*-ipip ] || { 
     565                log "$funcname() Warning: kmod-ipip is missing. SmartGateway will not work until you install it." 
     566        } 
    557567 
    558568        wanifnames=$(ip r l e 0/0 t all | sed -e 's/^.* dev //' |cut -d " " -f 1 | sort | uniq) 
     
    578588 
    579589        if [ "$smartgateway" == "yes" ]; then 
    580                 echo "Notice: Inserting firewall rules for SmartGateway" 
     590                log "$funcname() Notice: Inserting firewall rules for SmartGateway" 
    581591                if [ ! "$smartgatewayuplink" == "none" ]; then 
    582592                        if [ "$smartgatewayuplink" == "ipv4" ]; then 
     
    623633 
    624634error() { 
    625         echo "${initscript}:" "$@" 1>&2 
     635        log "error() ${initscript}: $@" 
    626636} 
    627637 
     
    675685                SERVICE_PID_FILE="$PID6" 
    676686                if service_check /usr/sbin/olsrd; then 
    677                         error "there already is an IPv6 instance of olsrd running ($(cat $PID6)), not starting." 
     687                        error "there is already an IPv6 instance of olsrd running (pid: '$(cat $PID6)'), not starting." 
    678688                else 
    679689                        service_start /usr/sbin/olsrd -f /var/etc/olsrd.conf.ipv6 -nofork 
     
    682692                SERVICE_PID_FILE="$PID" 
    683693                if service_check /usr/sbin/olsrd; then 
    684                         error "there already is an IPv4 instance of olsrd running ($(cat $PID)), not starting." 
     694                        error "there is already an IPv4 instance of olsrd running (pid: '$(cat $PID)'), not starting." 
    685695                else 
    686696                        service_start /usr/sbin/olsrd -f /var/etc/olsrd.conf.ipv4 -nofork 
     
    698708                SERVICE_PID_FILE="$PID" 
    699709                if service_check /usr/sbin/olsrd; then 
    700                         error "there already is an IPv4 instance of olsrd running ($(cat $PID)), not starting." 
     710                        error "there is already an IPv4 instance of olsrd running (pid: '$(cat $PID)'), not starting." 
    701711                        return 1 
    702712                else 
Note: See TracChangeset for help on using the changeset viewer.