f10e614579
Refactors dhcp-all-interfaces.sh so that if an optional INTERFACE argument (the first argument) is passed to the script it only inspects that single interface. If no argument is passed then the previous default behaviour is used which causes all interfaces to be inspected. To avoid a collision with the previous $1 we move to using $FLOCKED for the exec flock command which runs on distributions using ENI. Also sets PATH so that the commands within the script can all be found if it isn't set properly (/sbin/ip, /bin/cat, etc.) This is a move towards using udev rules to add these types of interfaces automatically. Change-Id: I3ec8fd2cc2071bfc6943c744ca619e31b71146fc
14 lines
508 B
Bash
Executable File
14 lines
508 B
Bash
Executable File
#!/bin/bash
|
|
set -x
|
|
|
|
SCRIPTDIR=$(dirname $0)
|
|
|
|
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.sh /usr/local/sbin/dhcp-all-interfaces.sh
|
|
|
|
DIB_INIT_SYSTEM=$(dib-init-system)
|
|
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
|
|
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.conf /etc/init/dhcp-all-interfaces.conf
|
|
elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
|
|
install -D -g root -o root -m 0644 ${SCRIPTDIR}/udev.rules /etc/udev/rules.d/99-dhcp-all-interfaces.rules
|
|
fi
|