# strip binaries
if [[ $do_strip = yes ]] ; then
for p in strip grep find; do
- if ! which $p >/dev/null 2>&1; then
+ if ! type -P $p >/dev/null; then
derror "Could not find '$p'. You should run $0 with '--nostrip'."
do_strip=no
fi
Requires: tar
Requires: udev
Requires: util-linux-ng >= 2.16
-Requires: which
%if ! 0%{?with_switch_root}
BuildArch: noarch
dracut_rpm_version=$(cat "$moddir/dracut-version")
inst "$moddir/dracut-version" /$dracut_rpm_version
else
- if rpm -qf $(which $0) &>/dev/null; then
- dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(which $0) | { ver="";while read line;do ver=$line;done;echo $ver;} )
+ if rpm -qf $(type -P $0) &>/dev/null; then
+ dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(type -P $0) | { ver="";while read line;do ver=$line;done;echo $ver;} )
echo $dracut_rpm_version > $initdir/$dracut_rpm_version
fi
fi
. $dracutfunctions
for program in ip arping; do
- which $program >/dev/null 2>&1
- if [ $? -ne 0 ]; then
+ if ! type -P $program >/dev/null; then
dwarning "Could not find program \"$program\" required by network."
exit 1
fi
done
for program in dhclient brctl; do
- which $program >/dev/null 2>&1
- if [ $? -ne 0 ]; then
+ if ! type -P $program >/dev/null; then
dwarning "Could not find program \"$program\" it might be required by network."
fi
done
-
-
exit 255
-
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
-if ldd $(which sh) | grep -q lib64; then
+if ldd $(type -P sh) | grep -q lib64; then
LIBDIR="/lib64"
else
LIBDIR="/lib"
#!/bin/bash
-[[ $1 = -d ]] && which cryptsetup &>/dev/null && echo crypt
+[[ $1 = -d ]] && type -P cryptsetup >/dev/null && echo crypt
[[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
#!/bin/bash
# No Xen-detect? Boo!!
-XENDETECT=$(which xen-detect 2>/dev/null)
+XENDETECT=$(type -P xen-detect)
[ -z "$XENDETECT" ] && [ -d "/usr/lib/xen-default" ] && XENDETECT="/usr/lib/xen-default/bin/xen-detect"
[ -z "$XENDETECT" ] && exit 1
#!/bin/bash
-XENDETECT=$(which xen-detect)
+XENDETECT=$(type -P xen-detect)
[ -z "$XENDETECT" ] && [ -d "/usr/lib/xen-default" ] && XENDETECT="/usr/lib/xen-default/bin/xen-detect"
inst $XENDETECT /sbin/xen-detect
inst_hook pre-udev 40 "$moddir/xen-pre-udev.sh"
# if we don't have btrfs (btrfsctl) installed on the host system,
# no point in trying to support it in the initramfs.
-which btrfsctl >/dev/null 2>&1 || exit 1
+type -P btrfsctl >/dev/null || exit 1
. $dracutfunctions
[[ $debug ]] && set -x
#!/bin/bash
# if cryptsetup is not installed, then we cannot support encrypted devices.
-which cryptsetup >/dev/null 2>&1 || exit 1
-[[ $1 = -d ]] && echo dm
+type -P cryptsetup >/dev/null || exit 1
+
+[ "$1" = "-d" ] && echo dm
. $dracutfunctions
# if we don't have dmraid installed on the host system, no point
# in trying to support it in the initramfs.
-which dmraid >/dev/null 2>&1 || exit 1
+type -P dmraid >/dev/null || exit 1
. $dracutfunctions
[[ $debug ]] && set -x
inst dmeventd
-if ldd $(which dmraid) | grep -q lib64; then
+if ldd $(type -P dmraid) | grep -q lib64; then
LIBDIR="/lib64"
else
LIBDIR="/lib"
fi
inst blockdev
-which checkisomd5 >/dev/null 2>&1 && inst checkisomd5
+type -P checkisomd5 >/dev/null && inst checkisomd5
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh"
inst_hook pre-udev 30 "$moddir/dmsquash-liveiso-genrules.sh"
[ "$1" = "-d" ] && echo dm
# No point trying to support lvm if the binaries are missing
-which lvm >/dev/null 2>&1 || exit 1
+type -P lvm >/dev/null || exit 1
. $dracutfunctions
[[ $debug ]] && set -x
inst_hook cmdline 30 "$moddir/parse-lvm.sh"
-if ldd $(which lvm) | grep -q lib64; then
+if ldd $(type -P lvm) | grep -q lib64; then
LIBDIR="/lib64"
else
LIBDIR="/lib"
#!/bin/bash
# No mdadm? No mdraid support.
-which mdadm >/dev/null 2>&1 || exit 1
+type -P mdadm >/dev/null || exit 1
. $dracutfunctions
[[ $debug ]] && set -x
#!/bin/bash
# if there's no multipath binary, no go.
-which multipath >/dev/null 2>&1 || exit 1
+type -P multipath >/dev/null || exit 1
[[ $1 = -d ]] && exit 0
exit 1
fi
-exit 0
\ No newline at end of file
+exit 0
#!/bin/bash
-if ldd $(which multipath) 2>/dev/null |grep -q lib64; then
+if ldd $(type -P multipath) 2>/dev/null |grep -q lib64; then
LIBDIR="/lib64"
else
LIBDIR="/lib"
[ "$1" = "-d" ] && echo network
# If our prerequisites are not met, fail anyways.
-which iscsistart hostname iscsi-iname >/dev/null 2>&1 || exit 1
+type -P iscsistart hostname iscsi-iname >/dev/null || exit 1
# If hostonly was requested, fail the check if we are not actually
# booting from root.
[ "$1" = "-d" ] && echo network
# If our prerequisites are not met, fail.
-which nbd-client >/dev/null 2>&1 || exit 1
+type -P nbd-client >/dev/null || exit 1
# if an nbd device is not somewhere in the chain of devices root is mounted on,
# fail the hostonly check.
[ "$1" = "-h" ] && ! egrep -q '/ nfs[34 ]' /proc/mounts && exit 1
# If our prerequisites are not met, fail anyways.
-which rpcbind >/dev/null 2>&1 || which portmap >/dev/null 2>&1 || exit 1
-which rpc.statd mount.nfs mount.nfs4 umount >/dev/null 2>&1 || exit 1
+type -P rpcbind >/dev/null || type -P portmap >/dev/null || exit 1
+type -P rpc.statd mount.nfs mount.nfs4 umount >/dev/null || exit 1
exit 0
#!/bin/sh
-which portmap >/dev/null 2>&1 && dracut_install portmap
-which rpcbind >/dev/null 2>&1 && dracut_install rpcbind
+type -P portmap >/dev/null && dracut_install portmap
+type -P rpcbind >/dev/null && dracut_install rpcbind
dracut_install rpc.statd mount.nfs mount.nfs4 umount
[ -f /etc/netconfig ] && dracut_install /etc/netconfig
dracut_install rpc.idmapd /etc/idmapd.conf
dracut_install sed
-if ldd $(which rpc.idmapd) |grep -q lib64; then
+if ldd $(type -P rpc.idmapd) |grep -q lib64; then
LIBDIR="/lib64"
else
LIBDIR="/lib"
egrep '^nfsnobody:' /etc/passwd >> "$initdir/etc/passwd"
egrep '^rpc:' /etc/passwd >> "$initdir/etc/passwd"
egrep '^rpcuser:' /etc/passwd >> "$initdir/etc/passwd"
-#which nologin >/dev/null 2>&1 && dracut_install nologin
+#type -P nologin >/dev/null && dracut_install nologin
# rpc user needs to be able to write to this directory to save the warmstart
# file
#!/bin/sh
-if which rsyslogd >/dev/null; then
+if type -P rsyslogd >/dev/null; then
installs="rsyslogd /usr/lib/rsyslog/lmnet.so /usr/lib/rsyslog/imklog.so /usr/lib/rsyslog/imuxsock.so"
-elif which syslogd >/dev/null; then
+elif type -P syslogd >/dev/null; then
installs="syslogd"
-elif which syslog-ng >/dev/null; then
+elif type -P syslog-ng >/dev/null; then
installs="syslog-ng"
else
dwarn "Could not find any syslog binary although the syslogmodule is selected to be installed. Please check."
inst_simple "$moddir/rsyslogd-stop.sh" /sbin/rsyslogd-stop
mkdir -p ${initdir}/etc/templates
inst_simple "${moddir}/rsyslog.conf" /etc/templates
-fi
\ No newline at end of file
+fi
mkdir -p ${initdir}/initqueue-settled
mkdir -p ${initdir}/tmp
# Bail out if switch_root does not exist
-if which switch_root >/dev/null 2>&1; then
+if type -P switch_root >/dev/null; then
dracut_install switch_root
else
inst "$moddir/switch_root" "/sbin/switch_root" \
/lib/terminfo/l/linux dmesg mkdir cp ping exportfs \
modprobe rpc.nfsd rpc.mountd showmount tcpdump \
/etc/services sleep mount chmod
- which portmap >/dev/null 2>&1 && dracut_install portmap
- which rpcbind >/dev/null 2>&1 && dracut_install rpcbind
+ type -P portmap >/dev/null && dracut_install portmap
+ type -P rpcbind >/dev/null && dracut_install rpcbind
[ -f /etc/netconfig ] && dracut_install /etc/netconfig
- which dhcpd >/dev/null 2>&1 && dracut_install dhcpd
+ type -P dhcpd >/dev/null && dracut_install dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
instmods nfsd sunrpc ipv6
inst ./server-init /sbin/init
inst ./dhcpd.conf /etc/dhcpd.conf
dracut_install /etc/nsswitch.conf /etc/rpc /etc/protocols
dracut_install rpc.idmapd /etc/idmapd.conf
- if ldd $(which rpc.idmapd) |grep -q lib64; then
+ if ldd $(type -P rpc.idmapd) |grep -q lib64; then
LIBDIR="/lib64"
else
LIBDIR="/lib"
instmods iscsi_tcp crc32c ipv6
inst ./targets /etc/iscsi/targets
[ -f /etc/netconfig ] && dracut_install /etc/netconfig
- which dhcpd >/dev/null 2>&1 && dracut_install dhcpd
+ type -P dhcpd >/dev/null && dracut_install dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
inst ./server-init /sbin/init
inst ./hosts /etc/hosts
dracut_install sh ls shutdown poweroff stty cat ps ln ip \
/lib/terminfo/l/linux dmesg mkdir cp ping grep \
sleep nbd-server chmod
- which dhcpd >/dev/null 2>&1 && dracut_install dhcpd
+ type -P dhcpd >/dev/null && dracut_install dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
inst ./server-init /sbin/init
inst ./hosts /etc/hosts
/lib/terminfo/l/linux dmesg mkdir cp ping exportfs \
modprobe rpc.nfsd rpc.mountd showmount tcpdump \
/etc/services sleep mount chmod
- which portmap >/dev/null 2>&1 && dracut_install portmap
- which rpcbind >/dev/null 2>&1 && dracut_install rpcbind
+ type -P portmap >/dev/null && dracut_install portmap
+ type -P rpcbind >/dev/null && dracut_install rpcbind
[ -f /etc/netconfig ] && dracut_install /etc/netconfig
- which dhcpd >/dev/null 2>&1 && dracut_install dhcpd
+ type -P dhcpd >/dev/null && dracut_install dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
instmods nfsd sunrpc ipv6
inst ./server-init /sbin/init
inst ./dhcpd.conf /etc/dhcpd.conf
dracut_install /etc/nsswitch.conf /etc/rpc /etc/protocols
dracut_install rpc.idmapd /etc/idmapd.conf
- if ldd $(which rpc.idmapd) |grep -q lib64; then
+ if ldd $(type -P rpc.idmapd) |grep -q lib64; then
LIBDIR="/lib64"
else
LIBDIR="/lib"