mambawelcome: fix configuring domain with hostnamectl (pass HOSTNAME.DOMAIN as 'hostnamectl set-hostname' option)

This commit is contained in:
Silvan Calarco 2014-07-24 18:06:41 +02:00
parent 9e74f43f42
commit e429fbd4ab

View File

@ -149,13 +149,15 @@ sh -c "echo $INSTALL_ROOT_PASSWORD | passwd --stdin" || {
# set hostname and domain
[[ "$INSTALL_HOSTNAME" ]] && {
if [ "${INSTALL_HOSTNAME/.*}" != "${INSTALL_HOSTNAME}" -o "${INSTALL_DOMAIN}" = "localdomain" ]; then
hostnamectl set-hostname $INSTALL_HOSTNAME
sed -i "s|HOSTNAME=.*|HOSTNAME=$INSTALL_HOSTNAME|" \
/etc/sysconfig/network
[[ "$INSTALL_DOMAIN" ]] || INSTALL_DOMAIN="localdomain"
if [ "${INSTALL_DOMAIN}" != "localdomain" ]; then
sed -i "s|\(127\.0\.0\.1\W*\)\(.*\)|\1 $INSTALL_HOSTNAME.$INSTALL_DOMAIN $INSTALL_HOSTNAME localhost.localdomain localhost|" \
/etc/hosts
fi
elif [ "${INSTALL_DOMAIN}" != "localdomain" ]; then
hostnamectl set-hostname $INSTALL_HOSTNAME.$INSTALL_DOMAIN
fi
}
# set samba configuration file