# returns OK if $1 contains literal string $2 at the end, and isn't empty
str_ends() { [ "${1%*"$2"}" != "$1" ]; }
-uniq_lines() {
- local -A lines
- while read -r line; do
- if ! [[ ${lines[$line]} ]]; then
- echo "$line"
- lines[$line]=1
- fi
- done
-}
-
# find a binary. If we were not passed the full path directly,
# search in the usual places to find the binary.
find_binary() {
# called by dracut
install() {
local _arch _i _dir
- inst_multiple ip arping dhclient sed
+ inst_multiple ip arping dhclient sed awk
inst_multiple -o ping ping6
inst_multiple -o brctl
inst_multiple -o teamd teamdctl teamnl
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
# set up resolv.conf
[ -e /tmp/net.$netif.resolv.conf ] && \
- uniq_lines < /tmp/net.$netif.resolv.conf > /etc/resolv.conf
+ awk '!array[$0]++' /tmp/net.$netif.resolv.conf > /etc/resolv.conf
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
# add static route