dhcp-all-interfaces: support Centos/RHEL 6

On Centos and RHEL 6 the init system is upsart but but networking is using
sysv compatabiliy and a code path the handle this situation.

We can't use DISTRO_NAME because the centos-minimal element sets it to
centos for CentOS 7 but the centos element sets it to centos for CentOS 6.

Change-Id: Ib8e33ed78b3d6a5737eb7449bccef2d33f72b131
Closes-Bug: #1638527
This commit is contained in:
Derek Higgins 2016-11-02 11:01:15 +00:00
parent db4a88642e
commit d5225055ef
2 changed files with 8 additions and 1 deletions

View File

@ -15,7 +15,13 @@ fi
DIB_INIT_SYSTEM=$(dib-init-system)
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
if [ -e "/etc/redhat-release" ] ; then
# the init system is upstart but networking is using sysv compatabiliy (i.e. Centos/RHEL 6)
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.init /etc/init.d/dhcp-all-interfaces
chkconfig dhcp-all-interfaces on
else
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.conf /etc/init/dhcp-all-interfaces.conf
fi
elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-interface@.service /usr/lib/systemd/system/dhcp-interface@.service
install -D -g root -o root -m 0644 ${SCRIPTDIR}/dhcp-all-interfaces-udev.rules /etc/udev/rules.d/99-dhcp-all-interfaces.rules

View File

@ -6,6 +6,7 @@
# Default-Start: S
# Default-Stop: 0 6
# X-Start-Before: networking
# chkconfig: 3 9 50
# Short-Description: Autodetect network interfaces
# Description: Autodetect network interfaces during boot and configure them for DHCP
### END INIT INFO