diff --git a/dracut-init.sh b/dracut-init.sh index fc35d7b4..b1764218 100644 --- a/dracut-init.sh +++ b/dracut-init.sh @@ -275,71 +275,61 @@ rev_lib_symlinks() { inst_rule_programs() { local _prog _bin - if grep -qE 'PROGRAM==?"[^ "]+' "$1"; then - for _prog in $(grep -E 'PROGRAM==?"[^ "]+' "$1" | sed -r 's/.*PROGRAM==?"([^ "]+).*/\1/'); do - _bin="" - if [ -x ${udevdir}/$_prog ]; then - _bin=${udevdir}/$_prog - elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then - _bin=$(find_binary "$_prog") || { - dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" - continue; - } - fi + for _prog in $(sed -nr 's/.*PROGRAM==?"([^ "]+).*/\1/p'); do + _bin="" + if [ -x ${udevdir}/$_prog ]; then + _bin=${udevdir}/$_prog + elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then + _bin=$(find_binary "$_prog") || { + dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" + continue; + } + fi - [[ $_bin ]] && inst_binary "$_bin" - done - fi - if grep -qE 'RUN[+=]=?"[^ "]+' "$1"; then - for _prog in $(grep -E 'RUN[+=]=?"[^ "]+' "$1" | sed -r 's/.*RUN[+=]=?"([^ "]+).*/\1/'); do - _bin="" - if [ -x ${udevdir}/$_prog ]; then - _bin=${udevdir}/$_prog - elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then - _bin=$(find_binary "$_prog") || { - dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" - continue; - } - fi + [[ $_bin ]] && inst_binary "$_bin" + done + for _prog in $(sed -nr 's/.*RUN[+=]=?"([^ "]+).*/\1/p'); do + _bin="" + if [ -x ${udevdir}/$_prog ]; then + _bin=${udevdir}/$_prog + elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then + _bin=$(find_binary "$_prog") || { + dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" + continue; + } + fi - [[ $_bin ]] && inst_binary "$_bin" - done - fi - if grep -qE 'IMPORT\{program\}==?"[^ "]+' "$1"; then - for _prog in $(grep -E 'IMPORT\{program\}==?"[^ "]+' "$1" | sed -r 's/.*IMPORT\{program\}==?"([^ "]+).*/\1/'); do - _bin="" - if [ -x ${udevdir}/$_prog ]; then - _bin=${udevdir}/$_prog - elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then - _bin=$(find_binary "$_prog") || { - dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" - continue; - } - fi + [[ $_bin ]] && inst_binary "$_bin" + done + for _prog in $(sed -nr 's/.*IMPORT\{program\}==?"([^ "]+).*/\1/p'); do + _bin="" + if [ -x ${udevdir}/$_prog ]; then + _bin=${udevdir}/$_prog + elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then + _bin=$(find_binary "$_prog") || { + dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" + continue; + } + fi - [[ $_bin ]] && dracut_install "$_bin" - done - fi + [[ $_bin ]] && dracut_install "$_bin" + done } # attempt to install any programs specified in a udev rule inst_rule_group_owner() { local i - if grep -qE 'OWNER=?"[^ "]+' "$1"; then - for i in $(grep -E 'OWNER=?"[^ "]+' "$1" | sed -r 's/.*OWNER=?"([^ "]+).*/\1/'); do - if ! egrep -q "^$i:" "$initdir/etc/passwd" 2>/dev/null; then - egrep "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" - fi - done - fi - if grep -qE 'GROUP=?"[^ "]+' "$1"; then - for i in $(grep -E 'GROUP=?"[^ "]+' "$1" | sed -r 's/.*GROUP=?"([^ "]+).*/\1/'); do - if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then - egrep "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group" - fi - done - fi + for i in $(sed -nr 's/.*OWNER=?"([^ "]+).*/\1/p'); do + if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then + grep -E "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" + fi + done + for i in $(sed -nr 's/.*GROUP=?"([^ "]+).*/\1/p' "$1"); do + if ! grep -Eq "^$i:" "$initdir/etc/group" 2>/dev/null; then + grep -E "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group" + fi + done } inst_rule_initqueue() { diff --git a/install/dracut-install.c b/install/dracut-install.c index 8f65d8d1..3b48ba89 100644 --- a/install/dracut-install.c +++ b/install/dracut-install.c @@ -287,7 +287,7 @@ static int library_install(const char *src, const char *lib) /* Also try to install the same library from one directory above. This fixes the case, where only the HWCAP lib would be installed - # ldconfig -p|fgrep libc.so + # ldconfig -p|grep -F libc.so libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6 libc.so.6 (libc6,64bit, hwcap: 0x0000000000000200, OS ABI: Linux 2.6.32) => /lib64/power6x/libc.so.6 libc.so.6 (libc6,64bit, OS ABI: Linux 2.6.32) => /lib64/libc.so.6 diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh index ed59beb7..deb5e06c 100755 --- a/modules.d/00systemd/module-setup.sh +++ b/modules.d/00systemd/module-setup.sh @@ -179,11 +179,11 @@ install() { # install adm user/group for journald inst_multiple nologin - egrep '^systemd-journal:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" - egrep '^adm:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" - egrep '^systemd-journal:' /etc/group >> "$initdir/etc/group" - egrep '^wheel:' /etc/group >> "$initdir/etc/group" - egrep '^adm:' /etc/group >> "$initdir/etc/group" + grep '^systemd-journal:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" + grep '^adm:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" + grep '^systemd-journal:' /etc/group >> "$initdir/etc/group" + grep '^wheel:' /etc/group >> "$initdir/etc/group" + grep '^adm:' /etc/group >> "$initdir/etc/group" ln_r $systemdutildir/systemd "/init" ln_r $systemdutildir/systemd "/sbin/init" diff --git a/modules.d/02systemd-networkd/module-setup.sh b/modules.d/02systemd-networkd/module-setup.sh index 58842c08..b86751ea 100755 --- a/modules.d/02systemd-networkd/module-setup.sh +++ b/modules.d/02systemd-networkd/module-setup.sh @@ -48,10 +48,10 @@ install() { # inst_dir /var/lib/systemd/clock - egrep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" - egrep '^systemd-network:' /etc/group >> "$initdir/etc/group" - # egrep '^systemd-timesync:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" - # egrep '^systemd-timesync:' /etc/group >> "$initdir/etc/group" + grep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" + grep '^systemd-network:' /etc/group >> "$initdir/etc/group" + # grep '^systemd-timesync:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" + # grep '^systemd-timesync:' /etc/group >> "$initdir/etc/group" _arch=$(uname -m) inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \ diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh index 13d2dc2b..94ee9d1e 100755 --- a/modules.d/40network/dhclient-script.sh +++ b/modules.d/40network/dhclient-script.sh @@ -95,7 +95,7 @@ setup_interface6() { [ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname } -function parse_option_121() { +parse_option_121() { while [ $# -ne 0 ]; do mask="$1" shift diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh index 7c179bdb..11855231 100755 --- a/modules.d/40network/ifup.sh +++ b/modules.d/40network/ifup.sh @@ -277,7 +277,7 @@ if [ -z "$NO_TEAM_MASTER" ]; then for slave in $teamslaves ; do ip link set $slave up 2>/dev/null if wait_for_if_up $slave; then - working_slaves+="$slave " + working_slaves="$working_slaves$slave " fi done # Do not add slaves now diff --git a/modules.d/95debug/module-setup.sh b/modules.d/95debug/module-setup.sh index ce5e8e85..97b2a30d 100755 --- a/modules.d/95debug/module-setup.sh +++ b/modules.d/95debug/module-setup.sh @@ -18,6 +18,6 @@ install() { tcpdump cp less hostname mkdir \ fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck - egrep '^tcpdump:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" + grep '^tcpdump:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" } diff --git a/modules.d/95fcoe/fcoe-edd.sh b/modules.d/95fcoe/fcoe-edd.sh index 3b07ad3c..1e002d35 100755 --- a/modules.d/95fcoe/fcoe-edd.sh +++ b/modules.d/95fcoe/fcoe-edd.sh @@ -29,7 +29,7 @@ for disk in /sys/firmware/edd/int13_*; do driver=${driver##*/} fi # i40e uses dev_port 1 for a virtual fcoe function - if [ "${driver}" == "i40e" ]; then + if [ "${driver}" = "i40e" ]; then dev_port=1 fi for nic in "${disk}"/pci_dev/net/*; do diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh index 9b5b8c8f..6f039bdb 100755 --- a/modules.d/95nfs/module-setup.sh +++ b/modules.d/95nfs/module-setup.sh @@ -105,14 +105,14 @@ install() { # Rather than copy the passwd file in, just set a user for rpcbind # We'll save the state and restart the daemon from the root anyway - egrep '^nfsnobody:|^rpc:|^rpcuser:' /etc/passwd >> "$initdir/etc/passwd" - egrep '^nogroup:|^rpc:|^nobody:' /etc/group >> "$initdir/etc/group" + grep -E '^nfsnobody:|^rpc:|^rpcuser:' /etc/passwd >> "$initdir/etc/passwd" + grep -E '^nogroup:|^rpc:|^nobody:' /etc/group >> "$initdir/etc/group" # rpc user needs to be able to write to this directory to save the warmstart # file chmod 770 "$initdir/var/lib/rpcbind" - egrep -q '^rpc:' /etc/passwd \ - && egrep -q '^rpc:' /etc/group \ - && chown rpc.rpc "$initdir/var/lib/rpcbind" + grep -q '^rpc:' /etc/passwd \ + && grep -q '^rpc:' /etc/group \ + && chown rpc:rpc "$initdir/var/lib/rpcbind" dracut_need_initqueue } diff --git a/modules.d/95nfs/nfs-lib.sh b/modules.d/95nfs/nfs-lib.sh index 58aa7e30..67608b19 100755 --- a/modules.d/95nfs/nfs-lib.sh +++ b/modules.d/95nfs/nfs-lib.sh @@ -110,7 +110,7 @@ nfsroot_from_dhcp() { [ -f $f ] && . $f done [ -n "$new_root_path" ] && nfsroot_to_var "$nfs:$new_root_path" - [ -z "$path" ] && [ "$(getarg root=)" == "/dev/nfs" ] && path=/tftpboot/%s + [ -z "$path" ] && [ "$(getarg root=)" = "/dev/nfs" ] && path=/tftpboot/%s [ -z "$server" ] && server=$srv [ -z "$server" ] && server=$new_dhcp_server_identifier [ -z "$server" ] && server=$new_next_server diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh index 6a0625aa..a59eca2a 100755 --- a/modules.d/95udev-rules/module-setup.sh +++ b/modules.d/95udev-rules/module-setup.sh @@ -63,8 +63,8 @@ install() { { for i in cdrom tape dialout floppy; do - if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then - if ! egrep "^$i:" /etc/group 2>/dev/null; then + if ! grep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then + if ! grep "^$i:" /etc/group 2>/dev/null; then case $i in cdrom) echo "$i:x:11:";; dialout) echo "$i:x:18:";; diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh index cc94d005..5fbf6f7d 100755 --- a/modules.d/99base/module-setup.sh +++ b/modules.d/99base/module-setup.sh @@ -27,8 +27,8 @@ install() { fi #add common users in /etc/passwd, it will be used by nfs/ssh currently - egrep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo 'root:x:0:0::/root:/bin/sh' >> "$initdir/etc/passwd" - egrep '^nobody:' /etc/passwd >> "$initdir/etc/passwd" + grep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo 'root:x:0:0::/root:/bin/sh' >> "$initdir/etc/passwd" + grep '^nobody:' /etc/passwd >> "$initdir/etc/passwd" # install our scripts and hooks inst_script "$moddir/init.sh" "/init" diff --git a/test/TEST-04-FULL-SYSTEMD/test.sh b/test/TEST-04-FULL-SYSTEMD/test.sh index f5a9d48c..c7e08bfb 100755 --- a/test/TEST-04-FULL-SYSTEMD/test.sh +++ b/test/TEST-04-FULL-SYSTEMD/test.sh @@ -197,7 +197,7 @@ EOF ln -fs /proc/self/mounts $initdir/etc/mtab # install any Execs from the service files - egrep -ho '^Exec[^ ]*=[^ ]+' $initdir/lib/systemd/system/*.service \ + grep -Eho '^Exec[^ ]*=[^ ]+' $initdir/lib/systemd/system/*.service \ | while read i || [ -n "$i" ]; do i=${i##Exec*=}; i=${i##-} inst_multiple -o $i