Skip to content

Commit d4cb6ae

Browse files
committed
added support for RHEL7/Fedora15+
1 parent a3e9358 commit d4cb6ae

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

hypervm/bin/xen-dists/scripts/redhat-set_hostname.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,15 @@ function set_hostname()
5050
local val=$3
5151

5252
[ -z "${val}" ] && return 0
53-
put_param "${cfgfile}" "${var}" "${val}"
53+
if [ -f /etc/hostname ]; then
54+
# New style: RHEL7/Fedora15+
55+
# Note hostname(5) says it should NOT be FQDN
56+
val=${val%%.*}
57+
echo "$val" > /etc/hostname
58+
else
59+
# "Classic" style
60+
put_param "${cfgfile}" "${var}" "${val}"
61+
fi
5462

5563
#hostname "${val}"
5664
}

0 commit comments

Comments
 (0)