base-files: preinit: get rid of /dev/null redirections and use grep -q where applicable
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 1 Feb 2010 00:32:46 +0000 (00:32 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 1 Feb 2010 00:32:46 +0000 (00:32 +0000)
SVN-Revision: 19478

package/base-files/files/lib/network/config.sh
package/base-files/files/lib/preinit/10_check_for_mtd
package/base-files/files/lib/preinit/10_indicate_preinit
package/base-files/files/lib/preinit/30_device_fs_daemons
package/base-files/files/lib/preinit/50_choose_console

index 12b08a29ff49bb2fa7a5ca2a9145d4c1f45d0ea6..6337643779ba929cce5182fb812d6b8eed96e0d9 100755 (executable)
@@ -161,6 +161,10 @@ setup_interface_none() {
        env -i ACTION="ifup" INTERFACE="$2" DEVICE="$1" PROTO=none /sbin/hotplug-call "iface" &
 }
 
+stop_interface_none() {
+       env -i ACTION="ifdown" INTERFACE="$2" DEVICE="$1" PROTO=none /sbin/hotplug-call "iface" &
+}
+
 setup_interface_static() {
        local iface="$1"
        local config="$2"
index e1f3c07a2a55f00788eea51adb4507d80d6f63e2..66f185e1af2b7f2a97c96fc5b4e3bd63f8f92f85 100644 (file)
@@ -10,7 +10,7 @@ mount_no_mtd() {
 
 check_for_mtd() {
     check_skip || {
-       grep rootfs_data /proc/mtd >/dev/null 2>/dev/null || {
+       grep -qs rootfs_data /proc/mtd || {
            mount_no_mtd && pi_mount_skip_next=true
        }
     }
index cd3ca5571a021f64858a049b5d69cea48380d2aa..ab693051808e54da45ad039d3731c110c9d38e04 100644 (file)
@@ -9,19 +9,19 @@ preinit_ip() {
        pi_ifname=$ifname    
     fi
 
-    [ -n "$pi_ifname" ] && grep "$pi_ifname" /proc/net/dev >/dev/null && {
+    [ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
        ifconfig $pi_ifname $pi_ip netmask $pi_netmask broadcast $pi_broadcast up
     }
 }
 
 preinit_ip_deconfig() {
-    [ -n "$pi_ifname" ] && grep "$pi_ifname" /proc/net/dev >/dev/null && {
+    [ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
        ifconfig $pi_ifname 0.0.0.0 down
     }
 }
 
 preinit_net_echo() {
-       [ -n "$pi_ifname" ] && grep "$pi_ifname" /proc/net/dev >/dev/null && {
+       [ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
                { 
                        [ "$pi_preinit_net_messages" = "y" ] || {
                                [ "$pi_failsafe_net_message"  = "true" ] && 
index 5a3aaf3d6477c07a0db59ca5601d0ae3fa4a081e..5b3e2ad00021c30de3291a79bf22e367eb807a41 100644 (file)
@@ -23,7 +23,7 @@ init_udev() {
 
 init_device_fs() {
     HOTPLUG=
-    if grep devfs /proc/filesystems > /dev/null; then
+    if grep -q devfs /proc/filesystems; then
        init_devfs
     elif [ -x /sbin/hotplug2 ]; then
        init_hotplug2
index 346479640e9d8efa4d10c59b5b81a70f2f1a4374..ecbc2eaf42b47284bade3e0090563fe7bd4ff0a3 100644 (file)
@@ -7,7 +7,7 @@ choose_console() {
     # that's why we use /dev/pty/m0 and m1 (or equivalent) as replacement
     # for /dev/console if there's no serial console available
 
-    if grep devfs /proc/filesystems > /dev/null; then
+    if grep -q devfs /proc/filesystems; then
        M0=/dev/pty/m0
        M1=/dev/pty/m1
        M2=/dev/pty/m1