Skip to content

Commit

Permalink
Revert removing setting hostname (#5208)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagom62 authored and snipe committed Mar 22, 2018
1 parent 1c77788 commit 735840a
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions snipeit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ clear

name="snipeit"
verbose="false"
hostname="$(hostname)"
fqdn="$(hostname --fqdn)"
hosts=/etc/hosts

spin[0]="-"
spin[1]="\\"
Expand Down Expand Up @@ -165,6 +167,11 @@ configureselinux () {
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
distro="$(lsb_release -s -i)"
version="$(lsb_release -s -r)"
Expand Down Expand Up @@ -220,8 +227,12 @@ case $distro in
esac
shopt -u nocasematch

echo ""
read -rsn1 -p " Press any key to continue..."
echo -n " Q. What is the FQDN of your server? ($fqdn): "
read -r fqdn
if [ -z "$fqdn" ]; then
fqdn="$(hostname --fqdn)"
fi
echo " Setting to $fqdn"
echo ""

ans=default
Expand Down Expand Up @@ -271,6 +282,8 @@ case $distro in
log "a2enmod rewrite"
log "a2ensite $name.conf"

sethostfile

echo "* Securing MariaDB."
/usr/bin/mysql_secure_installation

Expand Down Expand Up @@ -309,6 +322,8 @@ case $distro in
log "a2enmod rewrite"
log "a2ensite $name.conf"

sethostfile

echo "* Securing MariaDB."
/usr/bin/mysql_secure_installation

Expand Down Expand Up @@ -351,6 +366,8 @@ case $distro in
log "a2enmod rewrite"
log "a2ensite $name.conf"

sethostfile

echo "* Starting MariaDB."
log "service mysql start"

Expand Down Expand Up @@ -392,6 +409,8 @@ case $distro in
log "a2enmod rewrite"
log "a2ensite $name.conf"

sethostfile

echo "* Starting MariaDB."
log "service mysql start"

Expand Down Expand Up @@ -443,6 +462,8 @@ case $distro in
log "chkconfig mysql on"
log "/sbin/service mysql start"

sethostfile

echo "* Securing MariaDB."
/usr/bin/mysql_secure_installation

Expand Down Expand Up @@ -478,6 +499,8 @@ case $distro in
echo "* Configuring Apache."
createvh

sethostfile

echo "* Setting MariaDB to start on boot and starting MariaDB."
log "systemctl enable mariadb.service"
log "systemctl start mariadb.service"
Expand Down Expand Up @@ -514,6 +537,8 @@ case $distro in
echo "* Configuring Apache."
createvh

sethostfile

echo "* Setting MariaDB to start on boot and starting MariaDB."
log "systemctl enable mariadb.service"
log "systemctl start mariadb.service"
Expand Down

0 comments on commit 735840a

Please sign in to comment.