From: Frank Brehm Date: Wed, 28 Mar 2018 09:31:50 +0000 (+0200) Subject: Setting hostname and disabling IPv6 in bin/postinst X-Git-Tag: 0.1.1~80 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=385836c78b95cbf7904ab7e79c358f1c8b447e8b;p=pixelpark%2Fcreate-vmware-tpl.git Setting hostname and disabling IPv6 in bin/postinst --- diff --git a/bin/postinst b/bin/postinst index 8ae3883..daff7ac 100644 --- a/bin/postinst +++ b/bin/postinst @@ -101,12 +101,37 @@ create_etc_hosts() { } +#----------------------------------------------------------- +set_hostname() { + echo + log "Setting hostname ${hostname} ..." + hostnamectl set-hostname --static "${hostname}" + hostname > /etc/hostname + echo "Hostname normal: $(hostname)" + echo "Hostname simple: $(hostname -s)" + echo "Hostname FQDN: $(hostname -f)" +} + +#----------------------------------------------------------- +disable_ipv6() { + local sysctl_file="/etc/sysctl.d/99-disable-ipv6.conf" + echo + log "Disabling IPv6 in '${sysctl_file}' ..." + mkdir -pv /etc/sysctl.d + echo "#disable ipv6" | tee -a "${sysctl_file}" + echo "net.ipv6.conf.all.disable_ipv6 = 1" | tee -a "${sysctl_file}" + echo "net.ipv6.conf.default.disable_ipv6 = 1" | tee -a "${sysctl_file}" + echo "net.ipv6.conf.lo.disable_ipv6 = 1" | tee -a "${sysctl_file}" +} + #----------------------------------------------------------- main() { create_authkeys import_ssh_hostkeys create_etc_hosts + set_hostname + disable_ipv6 }