integ/base/dhcp/centos/files/dhclient-ipv6-conditionally...

38 lines
1.1 KiB
Diff

From 04e5bef0d9bb0e1b3c8bbecccf11228ae809dfd2 Mon Sep 17 00:00:00 2001
From: Scott Little <scott.little@windriver.com>
Date: Mon, 2 Oct 2017 15:25:21 -0400
Subject: [PATCH 4/7] WRS: Patch104:
dhclient-ipv6-conditionally-set-hostname.patch
---
client/scripts/linux | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/client/scripts/linux b/client/scripts/linux
index 14655f0..59e764f 100755
--- a/client/scripts/linux
+++ b/client/scripts/linux
@@ -254,6 +254,19 @@ if [ x$reason = xPREINIT6 ] ; then
exit_with_hooks 0
fi
+if [ x$reason = xBOUND6 ] || [ x$reason = xRENEW6 ] || \
+ [ x$reason = xREBIND6 ] || [ x$reason = xREBOOT6 ]; then
+ current_hostname=`hostname`
+ if [ x$current_hostname = x ] || \
+ [ x$current_hostname = "x(none)" ] || \
+ [ x$current_hostname = xlocalhost ] || \
+ [ x$current_hostname = x$old_fqdn_hostname ]; then
+ if [ x$new_fqdn_hostname != x$old_fqdn_hostname ]; then
+ hostname "$new_fqdn_hostname"
+ fi
+ fi
+fi
+
if [ x${old_ip6_prefix} != x ] || [ x${new_ip6_prefix} != x ] ; then
echo Prefix ${reason} old=${old_ip6_prefix} new=${new_ip6_prefix}
--
1.9.1