Print this page
NEX-16134 HostName change using API is not persistent through a reboot
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>

@@ -25,11 +25,11 @@
 #
 #
 # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident "%Z%%M% %I%     %E% SMI"
+# Copyright 2018 Nexenta Systems Inc. 
 
 . /lib/svc/share/smf_include.sh
 . /lib/svc/share/net_include.sh
 
 # Make sure that the libraries essential to this stage of booting can be found.

@@ -52,11 +52,16 @@
 #
 
 smf_netstrategy
 
 case "$_INIT_NET_STRATEGY" in
-        "dhcp") hostname=`/sbin/dhcpinfo Hostname` ;;
+        "dhcp") if [ -s /etc/nodename ]; then
+                        hostname=`shcat /etc/nodename 2>/dev/null`
+                else
+                        hostname=`/sbin/dhcpinfo Hostname`
+                fi
+                        ;;
         "rarp") hostname=`/sbin/hostconfig -h -p bootparams`
                 trap 'intr=1' 2 3
                 while [ -z "$hostname" -a ! -f /etc/.UNCONFIGURED -a \
                     -z "$intr" ]; do
                         echo "re-trying host configuration..."