dustin
/
jenkinsagent
Archived
1
0
Fork 0
This repository has been archived on 2023-11-14. You can view files and clone it, but cannot push or open issues/pull-requests.
jenkinsagent/initramfs/overlay/usr/share/udhcpc/default.script

40 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
case "$1" in
deconfig|nak)
;;
renew|bound)
if [ -n "${ip}" ]; then
# shellcheck disable=SC2154 # interface is is an environment variable
ip addr add "${ip}"/"${mask:-32}" dev "${interface}"
fi
if [ -n "${staticroutes}" ]; then
# shellcheck disable=SC2086 # we WANT word splitting here!
set -- ${staticroutes}
ip route add "$1" via "$2" dev "${interface}"
elif [ -n "${router}" ]; then
for gw in ${router}; do
ip route add default via "${gw}" dev "${interface}"
done
fi
: > /etc/resolv.conf
if [ -n "${search}" ]; then
printf 'search %s\n' "${search}" >> /etc/resolv.conf
elif [ -n "${domain}" ]; then
printf 'search %s\n' "${domain}" >> /etc/resolv.conf
fi
if [ -n "${dns}" ]; then
for ns in ${dns}; do
printf 'nameserver %s\n' "${ns}" >> /etc/resolv.conf
done
fi
if [ -n "${ntpsrv}" ] && [ -x /usr/sbin/ntpd ]; then
for ts in ${ntpsrv}; do
/usr/sbin/ntpd -n -q -p "${ts}" || continue
break
done
fi
;;
esac