File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -465,24 +465,30 @@ detect_ip () {
465
465
466
466
# Set the hostname
467
467
set_hostname () {
468
- i=0
468
+ local i=0
469
469
local forcehostname
470
470
if [ ! -z " $1 " ]; then
471
471
forcehostname=$1
472
472
fi
473
- while [ $i -eq 0 ]; do
473
+ while [ $i -le 3 ]; do
474
474
if [ -z " $forcehostname " ]; then
475
475
local name
476
476
name=$( hostname -f)
477
477
log_error " Your system hostname $name is not fully qualified."
478
478
printf " Please enter a fully qualified hostname (e.g.: host.example.com): "
479
+ stty echo
479
480
read -r line
481
+ stty -echo
480
482
else
481
483
log_debug " Setting hostname to $forcehostname "
482
484
line=$forcehostname
483
485
fi
484
486
if ! is_fully_qualified " $line " ; then
487
+ i=$(( i + 1 ))
485
488
log_warning " Hostname $line is not fully qualified."
489
+ if [ " $i " = " 4" ]; then
490
+ fatal " Unable to set fully qualified hostname."
491
+ fi
486
492
else
487
493
hostname " $line "
488
494
echo " $line " > /etc/hostname
@@ -496,7 +502,7 @@ set_hostname () {
496
502
log_debug " Adding new entry for hostname $line on $address to /etc/hosts."
497
503
printf " %s\\ t%s\\ t%s\\ n" " $address " " $line " " $shortname " >> /etc/hosts
498
504
fi
499
- i=1
505
+ i=4
500
506
fi
501
507
done
502
508
}
You can’t perform that action at this time.
0 commit comments