Skip to content

Commit d5fd3f4

Browse files
authored
Add missing domain to host file if not exists (hestiacp#2688)
hestiacp#2683
1 parent 471d344 commit d5fd3f4

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

bin/v-change-sys-hostname

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,21 @@ else
4949
# Debian/Ubuntu
5050
hostnamectl set-hostname "$domain"
5151
echo "$domain" > /etc/hostname
52+
fi
5253

53-
# Update Roundcube password plugin configuration
54-
if [ -d /etc/roundcube/ ]; then
55-
sed -i "/password_hestia_host/c\$rcmail_config['password_hestia_host'] = '$domain';" /etc/roundcube/plugins/password/config.inc.php
56-
fi
57-
if [ -d /etc/rainloop/ ]; then
58-
sed -i "/hestia_host/c\hestia_host = \"$domain\"" /etc/rainloop/data/_data_/_default_/configs/plugin-hestia-change-password.ini
59-
fi
54+
# Update Roundcube password plugin configuration
55+
if [ -d /etc/roundcube/ ]; then
56+
sed -i "/password_hestia_host/c\$rcmail_config['password_hestia_host'] = '$domain';" /etc/roundcube/plugins/password/config.inc.php
6057
fi
58+
if [ -d /etc/rainloop/ ]; then
59+
sed -i "/hestia_host/c\hestia_host = \"$domain\"" /etc/rainloop/data/_data_/_default_/configs/plugin-hestia-change-password.ini
60+
fi
61+
62+
if [ -f /etc/hosts ];then
63+
if ! cat /etc/hosts | grep $domain > /dev/null ; then
64+
echo "127.0.0.1 $domain" >> /etc/hosts
65+
fi
66+
fi
6167

6268
#----------------------------------------------------------#
6369
# Hestia #

0 commit comments

Comments
 (0)