Changeset 31030 for trunk


Ignore:
Timestamp:
2012-03-19T21:37:12+01:00 (4 years ago)
Author:
jow
Message:

[rdc] base-files: gracefully handle empty variables in preinit (#11155)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/rdc/base-files/lib/preinit/05_set_ether_mac_rdc

    r29039 r31030  
    11#!/bin/sh 
    2 # Copyright (C) 2009 OpenWrt.org 
     2# Copyright (C) 2009-2012 OpenWrt.org 
    33 
    44. /lib/functions/boot.sh 
     
    1414set_ether_mac() { 
    1515        kernel=$(grep firmware /proc/mtd | awk -F: '{print $1}') 
    16         [ -n $kernel ] && hdr=$(dd if=/dev/$kernel count=4 bs=1 2> /dev/null) 
     16        [ -n "$kernel" ] && hdr=$(dd if=/dev/$kernel count=4 bs=1 2> /dev/null) 
    1717        [ "$hdr" = "CSYS" ] && config=$(find_mtd_part config) 
    1818        if [ -n "$config" ]; then 
     
    2222                [ "$mac1" = "FF:FF:FF:FF:FF:FF" -o "$mac0" = "0:0:0:0:0:0" ] && unset mac1 
    2323        fi 
    24         if [ -n $mac0 ]; then 
     24        if [ -n "$mac0" ]; then 
    2525                logger -t kernel -p user.info "r6040: Setting MAC for eth0 to $mac0" 
    26                 ifconfig eth0 hw ether $mac0 
     26                ifconfig eth0 hw ether "$mac0" 
    2727        fi 
    28         if [ -n $mac1 ]; then 
     28        if [ -n "$mac1" ]; then 
    2929                logger -t kernel -p user.info "r6040: Setting MAC for eth1 to $mac1" 
    30                 ifconfig eth1 hw ether $mac1 
     30                ifconfig eth1 hw ether "$mac1" 
    3131        fi 
    3232} 
Note: See TracChangeset for help on using the changeset viewer.