base-files: preinit: get rid of /dev/null redirections and use grep -q where applicable

SVN-Revision: 19478
This commit is contained in:
Jo-Philipp Wich 2010-02-01 00:32:46 +00:00
parent 34c0c72a6e
commit e367f5434a
5 changed files with 10 additions and 6 deletions

View file

@ -161,6 +161,10 @@ setup_interface_none() {
env -i ACTION="ifup" INTERFACE="$2" DEVICE="$1" PROTO=none /sbin/hotplug-call "iface" & 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() { setup_interface_static() {
local iface="$1" local iface="$1"
local config="$2" local config="$2"

View file

@ -10,7 +10,7 @@ mount_no_mtd() {
check_for_mtd() { check_for_mtd() {
check_skip || { 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 mount_no_mtd && pi_mount_skip_next=true
} }
} }

View file

@ -9,19 +9,19 @@ preinit_ip() {
pi_ifname=$ifname pi_ifname=$ifname
fi 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 ifconfig $pi_ifname $pi_ip netmask $pi_netmask broadcast $pi_broadcast up
} }
} }
preinit_ip_deconfig() { 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 ifconfig $pi_ifname 0.0.0.0 down
} }
} }
preinit_net_echo() { 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_preinit_net_messages" = "y" ] || {
[ "$pi_failsafe_net_message" = "true" ] && [ "$pi_failsafe_net_message" = "true" ] &&

View file

@ -23,7 +23,7 @@ init_udev() {
init_device_fs() { init_device_fs() {
HOTPLUG= HOTPLUG=
if grep devfs /proc/filesystems > /dev/null; then if grep -q devfs /proc/filesystems; then
init_devfs init_devfs
elif [ -x /sbin/hotplug2 ]; then elif [ -x /sbin/hotplug2 ]; then
init_hotplug2 init_hotplug2

View file

@ -7,7 +7,7 @@ choose_console() {
# that's why we use /dev/pty/m0 and m1 (or equivalent) as replacement # that's why we use /dev/pty/m0 and m1 (or equivalent) as replacement
# for /dev/console if there's no serial console available # 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 M0=/dev/pty/m0
M1=/dev/pty/m1 M1=/dev/pty/m1
M2=/dev/pty/m1 M2=/dev/pty/m1