mirror of
https://github.com/dracutdevs/dracut.git
synced 2024-10-28 18:55:32 +03:00
Get rid of cat and grep
This commit is contained in:
parent
3273c0a536
commit
07b2fbb183
@ -100,7 +100,8 @@ if [ -z "$ip" ]; then
|
|||||||
do_dhcp;
|
do_dhcp;
|
||||||
else
|
else
|
||||||
# spin through the kernel command line, looking for ip= lines
|
# spin through the kernel command line, looking for ip= lines
|
||||||
for p in $(cat /proc/cmdline); do
|
[ "$CMDLINE" ] || read CMDLINE </proc/cmdline;
|
||||||
|
for p in $CMDLINE; do
|
||||||
[ -n "${p%ip=*}" ] && continue
|
[ -n "${p%ip=*}" ] && continue
|
||||||
ip_to_var ${p#ip=}
|
ip_to_var ${p#ip=}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
dracut_install ip dhclient hostname cat
|
dracut_install ip dhclient hostname
|
||||||
# Include wired net drivers, excluding wireless
|
# Include wired net drivers, excluding wireless
|
||||||
for modname in `find "/lib/modules/$kernel/kernel/drivers" -name '*.ko'`; do
|
for modname in `find "/lib/modules/$kernel/kernel/drivers" -name '*.ko'`; do
|
||||||
if nm -uPA $modname | grep -q eth_type_trans; then
|
if nm -uPA $modname | grep -q eth_type_trans; then
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
for f in /tmp/dhclient.*.pid; do
|
for f in /tmp/dhclient.*.pid; do
|
||||||
[ "$f" != "/tmp/dhclient.*.pid" ] && kill $(cat $f)
|
[ -e $f ] || continue
|
||||||
|
read PID < $f;
|
||||||
|
kill $PID;
|
||||||
done
|
done
|
||||||
|
@ -71,17 +71,7 @@ getarg ro && nbdrw=ro
|
|||||||
getarg rw && nbdrw=rw
|
getarg rw && nbdrw=rw
|
||||||
fsopts=${fsopts+$fsopts,}${nbdrw}
|
fsopts=${fsopts+$fsopts,}${nbdrw}
|
||||||
|
|
||||||
if [ ! -e /tmp/nbd.present ]; then
|
incol2 /proc/devices nbd || modprobe nbd || exit 1
|
||||||
cat /proc/devices | while read t1 devt; do
|
|
||||||
if [ "$devt" = "nbd" ]; then
|
|
||||||
>/tmp/nfs.present
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
if [ ! -e /tmp/nbd.present ]; then
|
|
||||||
modprobe nbd || exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# XXX better way to wait for the device to be made?
|
# XXX better way to wait for the device to be made?
|
||||||
i=0
|
i=0
|
||||||
|
@ -46,16 +46,8 @@ getarg rw && nfsrw=rw
|
|||||||
nfsflags=${nfsflags+$nfsflags,}${nfsrw}
|
nfsflags=${nfsflags+$nfsflags,}${nfsrw}
|
||||||
|
|
||||||
# Load the modules so the filesystem type is there
|
# Load the modules so the filesystem type is there
|
||||||
if [ ! -e /tmp/nfs.present ]; then
|
incol2 /proc/filesystems nfs || modprobe nfs || exit 1
|
||||||
cat /proc/filesystems | while read t1 fst; do
|
incol2 /proc/filesystems nfs4 || modprobe nfs || exit 1
|
||||||
case "$fst" in
|
|
||||||
nfs|nfs4) >/tmp/nfs.present; break ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
if [ ! -e /tmp/nfs.present ]; then
|
|
||||||
modprobe nfs || exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# XXX don't forget to move /var/lib/nfs/rpc_pipefs to new /
|
# XXX don't forget to move /var/lib/nfs/rpc_pipefs to new /
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ pid=$(pidof rpc.statd)
|
|||||||
pid=$(pidof rpcbind)
|
pid=$(pidof rpcbind)
|
||||||
[ -n "$pid" ] && kill $pid
|
[ -n "$pid" ] && kill $pid
|
||||||
|
|
||||||
if grep -q rpc_pipefs /proc/mounts; then
|
if incol2 /proc/mounts /var/lib/nfs/rpc_pipefs; then
|
||||||
# try to create the destination directory
|
# try to create the destination directory
|
||||||
[ -d $NEWROOT/var/lib/nfs/rpc_pipefs ] || mkdir -p $NEWROOT/var/lib/nfs/rpc_pipefs 2>/dev/null
|
[ -d $NEWROOT/var/lib/nfs/rpc_pipefs ] || mkdir -p $NEWROOT/var/lib/nfs/rpc_pipefs 2>/dev/null
|
||||||
|
|
||||||
|
@ -36,3 +36,17 @@ check_occurances() {
|
|||||||
|
|
||||||
[ $count -eq $expected ]
|
[ $count -eq $expected ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
incol2() {
|
||||||
|
local dummy check;
|
||||||
|
local file="$1";
|
||||||
|
local str="$2";
|
||||||
|
|
||||||
|
[ -z "$file" ] && return;
|
||||||
|
[ -z "$str" ] && return;
|
||||||
|
|
||||||
|
while read dummy check restofline; do
|
||||||
|
[ "$check" = "$str" ] && return 0
|
||||||
|
done < $file
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user