- Timestamp:
- Jul 18, 2006, 2:56:53 PM (19 years ago)
- Branches:
- freewrt_1_0, freewrt_2_0
- Children:
- ce3d5c7
- Parents:
- 042eeb3
- File:
-
- 1 edited
-
package/base-files/default/etc/functions.sh (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
package/base-files/default/etc/functions.sh
r042eeb3 r76b8726 4 4 5 5 # valid interface? 6 if_valid () (6 if_valid() ( 7 7 ifconfig "$1" >&- 2>&- || 8 [ "${1%%[0-9]}" = "br"] || {9 [ "${1%%[0-9]}" = "vlan"] && (8 [ "${1%%[0-9]}" = br ] || { 9 [ "${1%%[0-9]}" = vlan ] && ( 10 10 i=${1#vlan} 11 11 hwname=$(nvram get vlan${i}hwname) … … 26 26 if_proto=$(nvram get ${2}_proto) 27 27 if=$(nvram get ${2}_ifname) 28 [ "${if%%[0-9]}" = "ppp"] && if=$(nvram get ${2}_device)28 [ "${if%%[0-9]}" = ppp ] && if=$(nvram get ${2}_device) 29 29 30 30 pidfile=/var/run/${if}.pid 31 [ -f $pidfile ] && $DEBUG kill $( cat$pidfile)31 [ -f $pidfile ] && $DEBUG kill $(<$pidfile) 32 32 33 33 case $1 in … … 42 42 ${gateway:+$DEBUG route add default gw $gateway} 43 43 44 [ -n "$static_route" ] && { 45 for route in $static_route; do { 44 [ -n "$static_route" ] && for route in $static_route; do 46 45 eval "set $(echo $route | sed 's/:/ /g')" 47 if [ "$2" = "255.255.255.255" ]; then 48 opt="-host" 49 fi 50 $DEBUG route add ${opt:-"-net"} $1 netmask $2 gw $3 metric $4 51 } done 52 } 46 [ "$2" = "255.255.255.255" ] && opt=-host 47 $DEBUG route add ${opt:-"-net"} $1 netmask $2 gw $3 metric $4 48 done 53 49 54 50 [ -f /etc/resolv.conf ] || { … … 59 55 } 60 56 61 env -i ACTION= "ifup" INTERFACE="${2}" PROTO=static /sbin/hotplug "iface"&62 ;;57 env -i ACTION=ifup INTERFACE="${2}" PROTO=static /sbin/hotplug iface & 58 ;; 63 59 dhcp) 64 60 DHCP_IP=$(nvram get ${2}_ipaddr) … … 71 67 DHCP_HOSTNAME=${DHCP_HOSTNAME%%.*} 72 68 [ -z $DHCP_HOSTNAME ] || DHCP_ARGS="$DHCP_ARGS -H $DHCP_HOSTNAME" 73 [ "$if_proto" = "pptp"] && DHCP_ARGS="$DHCP_ARGS -n -q" || DHCP_ARGS="$DHCP_ARGS -R &"74 [ -r $pidfile ] && oldpid=$( cat $pidfile 2>&-)69 [ "$if_proto" = pptp ] && DHCP_ARGS="$DHCP_ARGS -n -q" || DHCP_ARGS="$DHCP_ARGS -R &" 70 [ -r $pidfile ] && oldpid=$(<$pidfile) 75 71 ${DEBUG:-eval} "udhcpc $DHCP_ARGS" 76 72 [ -n "$oldpid" ] && pidof udhcpc | grep "$oldpid" >&- 2>&- && { … … 79 75 } 80 76 # hotplug events are handled by /usr/share/udhcpc/default.script 81 ;;77 ;; 82 78 none|"") 83 ;;79 ;; 84 80 *) 85 81 [ -x "/sbin/ifup.$1" ] && { $DEBUG /sbin/ifup.$1 ${2}; exit; } 86 82 echo "### ifup ${2}: ignored ${2}_proto=\"$1\" (not supported)" 87 ;;83 ;; 88 84 esac 89 85 } … … 139 135 140 136 get_next_uid() { 141 uid=$(cat $IPKG_INSTROOT/etc/passwd | grep -v ^nobody \ 142 | grep -v ^admin | \ 143 tail -n 1 | awk -F : '{ print $3 }') 144 let uid=$uid+1 145 echo $uid 137 uid=$(grep -v -e ^nobody: -e ^admin: $IPKG_INSTROOT/etc/passwd | \ 138 tail -n 1 | awk -F : '{ print $3 }') 139 echo $((uid+1)) 146 140 } 147 141 148 142 get_next_gid() { 149 gid=$(cat $IPKG_INSTROOT/etc/group | grep -v ^nogroup \ 150 | grep -v ^admin | \ 151 tail -n 1 | awk -F : '{ print $3 }') 152 let gid=$gid+1 153 echo $gid 143 gid=$(grep -v -e ^nogroup: -e ^admin: $IPKG_INSTROOT/etc/group | \ 144 tail -n 1 | awk -F : '{ print $3 }') 145 echo $((gid+1)) 154 146 }
Note:
See TracChangeset
for help on using the changeset viewer.
