Revert removing setting hostname (#5208)

This commit is contained in:
tiagom62 2018-03-15 13:20:42 -04:00 committed by snipe
parent 53735f2026
commit 9e7d1b3ed8

View file

@ -28,7 +28,9 @@ clear
name="snipeit" name="snipeit"
verbose="false" verbose="false"
hostname="$(hostname)"
fqdn="$(hostname --fqdn)" fqdn="$(hostname --fqdn)"
hosts=/etc/hosts
spin[0]="-" spin[0]="-"
spin[1]="\\" spin[1]="\\"
@ -165,6 +167,11 @@ configureselinux () {
fi fi
} }
sethostfile () {
echo "* Setting up hosts file."
echo >> $hosts "127.0.0.1 $hostname $fqdn"
}
if [[ -f /etc/lsb-release || -f /etc/debian_version ]]; then if [[ -f /etc/lsb-release || -f /etc/debian_version ]]; then
distro="$(lsb_release -s -i)" distro="$(lsb_release -s -i)"
version="$(lsb_release -s -r)" version="$(lsb_release -s -r)"
@ -220,8 +227,12 @@ case $distro in
esac esac
shopt -u nocasematch shopt -u nocasematch
echo "" echo -n " Q. What is the FQDN of your server? ($fqdn): "
read -rsn1 -p " Press any key to continue..." read -r fqdn
if [ -z "$fqdn" ]; then
fqdn="$(hostname --fqdn)"
fi
echo " Setting to $fqdn"
echo "" echo ""
ans=default ans=default
@ -271,6 +282,8 @@ case $distro in
log "a2enmod rewrite" log "a2enmod rewrite"
log "a2ensite $name.conf" log "a2ensite $name.conf"
sethostfile
echo "* Securing MariaDB." echo "* Securing MariaDB."
/usr/bin/mysql_secure_installation /usr/bin/mysql_secure_installation
@ -309,6 +322,8 @@ case $distro in
log "a2enmod rewrite" log "a2enmod rewrite"
log "a2ensite $name.conf" log "a2ensite $name.conf"
sethostfile
echo "* Securing MariaDB." echo "* Securing MariaDB."
/usr/bin/mysql_secure_installation /usr/bin/mysql_secure_installation
@ -351,6 +366,8 @@ case $distro in
log "a2enmod rewrite" log "a2enmod rewrite"
log "a2ensite $name.conf" log "a2ensite $name.conf"
sethostfile
echo "* Starting MariaDB." echo "* Starting MariaDB."
log "service mysql start" log "service mysql start"
@ -392,6 +409,8 @@ case $distro in
log "a2enmod rewrite" log "a2enmod rewrite"
log "a2ensite $name.conf" log "a2ensite $name.conf"
sethostfile
echo "* Starting MariaDB." echo "* Starting MariaDB."
log "service mysql start" log "service mysql start"
@ -443,6 +462,8 @@ case $distro in
log "chkconfig mysql on" log "chkconfig mysql on"
log "/sbin/service mysql start" log "/sbin/service mysql start"
sethostfile
echo "* Securing MariaDB." echo "* Securing MariaDB."
/usr/bin/mysql_secure_installation /usr/bin/mysql_secure_installation
@ -478,6 +499,8 @@ case $distro in
echo "* Configuring Apache." echo "* Configuring Apache."
createvh createvh
sethostfile
echo "* Setting MariaDB to start on boot and starting MariaDB." echo "* Setting MariaDB to start on boot and starting MariaDB."
log "systemctl enable mariadb.service" log "systemctl enable mariadb.service"
log "systemctl start mariadb.service" log "systemctl start mariadb.service"
@ -514,6 +537,8 @@ case $distro in
echo "* Configuring Apache." echo "* Configuring Apache."
createvh createvh
sethostfile
echo "* Setting MariaDB to start on boot and starting MariaDB." echo "* Setting MariaDB to start on boot and starting MariaDB."
log "systemctl enable mariadb.service" log "systemctl enable mariadb.service"
log "systemctl start mariadb.service" log "systemctl start mariadb.service"