3 # Configures the hostname file based on kernel cmdline or user prompt
4 # Source functions library
5 .
/etc
/init.d
/functions
6 .
/etc
/init.d
/ovirt-functions
8 trap '__st=$?; stop_log; exit $__st' 0
9 trap 'exit $?' 1 2 13 15
11 HOSTNAME_FILE
="/etc/sysconfig/network"
13 function set_hostname
{
16 set /files$HOSTNAME_FILE/HOSTNAME "$1"
23 function remove_hostname
{
26 rm /files$HOSTNAME_FILE/HOSTNAME
33 function prompt_user
{
35 read -p "What is the hostname for this node? "
37 if [ -n "$REPLY" ]; then
38 if set_hostname
$REPLY; then
39 printf "\nHostname has been set\n"
41 printf "\nSetting hostname failed\n"
46 read -p "Enter (Y|y) to blank out the hostname, or (N|n) to skip. "
49 if remove_hostname
; then
50 printf "\nHostname was removed.\n"
53 printf "\nRemoving hostname failed\n"
58 printf "\nNo changes made.\n"
66 # AUTO for auto-install
67 if [ "$1" = "AUTO" ]; then
68 if [ -n "$OVIRT_HOSTNAME" ]; then
69 if set_hostname
$OVIRT_HOSTNAME; then
70 printf "\nHostname has been set\n"
72 printf "\nSetting hostname failed\n"
75 printf "\nHostname not provided. Skipping.\n"
78 printf "\n\n oVirt Node Hostname Configuration\n\n"