From 0d9d72ad99381669a08bdb316c74af915535d343 Mon Sep 17 00:00:00 2001 From: Dashamir Hoxha Date: Sat, 11 Oct 2014 05:42:29 +0200 Subject: [PATCH] Update domain. --- install/config/domain.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/install/config/domain.sh b/install/config/domain.sh index 42cd8c4..49b66df 100755 --- a/install/config/domain.sh +++ b/install/config/domain.sh @@ -14,20 +14,24 @@ It will modify the files: 5) /var/www/bcl*/sites/default/settings.php " +### get the old domain +old_domain=$(head -n 1 /etc/hosts.conf | cut -d' ' -f2) +old_domain=${old_domain:-example.org} + +### get the new domain if [ -z "${domain+xxx}" -o "$domain" = '' ] then - domain='example.org' - read -p "Enter the domain name for btr_client [$domain]: " input - domain=${input:-$domain} + read -p "Enter the domain name for btr_client [$old_domain]: " input + domain=${input:-$old_domain} fi +### update /etc/hostname and /etc/hosts echo $domain > /etc/hostname -old_domain=$(head -n 1 /etc/hosts.conf | cut -d' ' -f2) sed -i /etc/hosts.conf \ -e "s/$old_domain/$domain/g" /etc/hosts_update.sh -### change config files +### update config files for file in $(ls /etc/nginx/sites-available/bcl*) do sed -i $file -e "/server_name/ s/$old_domain/$domain/"