From 17d41b03de24409a2213badeefe97217d02e113e Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Sat, 25 Jan 2020 16:40:55 -0500 Subject: [PATCH] Grab current hostname instead of assuming --- bootstrap.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bootstrap.sh b/bootstrap.sh index ae72559..2ea3e8c 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -7,6 +7,7 @@ fi DATE=$(date '+%Y%m%d') TMP_DIR=$(mktemp -d) +CUR_HOSTNAME=$(hostname) GIT_LOC="https://github.com/krislamo/bootstrap.git" echo "Enter name server's new hostname:" @@ -29,6 +30,6 @@ apt-get install openssh-server -y hostnamectl set-hostname $NEW_HOSTNAME cp /etc/hosts /etc/hosts.$DATE -sed -i "s/test/$NEW_HOSTNAME/g" /etc/hosts +sed -i "s/$CUR_HOSTNAME/$NEW_HOSTNAME/g" /etc/hosts read -p "Press [enter] to restart this machine" /sbin/shutdown -r now