Make /etc/network/if-up.d/dad POSIX complaint
Package Information
- Package name: busybox-ifupdown (
/etc/network/if-up.d/dad
) - Package version: 1.36.1
- Alpine version: 3.19.1
- Alpine architecture: x86_64
Summary
The script: /etc/network/if-up.d/dad
is not POSIX complaint. When replacing /bin/sh -> /bin/busybox
with /bin/sh -> /usr/bin/dash
, the following error message is shown when booting the system:
/etc/network/if-up.d/dad: 11: arithmetic expression: expecting primary: " counter-- "
I didn't test this yet, but maybe the following could do the trick:
#!/bin/sh
# Block ifup until DAD completion
# Copyright (c) 2016-2018 Kaarle Ritvanen
has_flag() {
ip address show dev "$IFACE" up | grep -q " $1 "
}
counter=100
while [ "$counter" -gt 0 ] &&
has_flag tentative &&
! has_flag dadfailed; do
sleep 0.2
counter=$((counter - 1))
done
Steps to reproduce
- Install
dash
:apk add dash
- Link
sh
todash
:ln -sfn /usr/bin/dash /bin/sh
- Reboot the system