1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-22 18:55:29 +03:00
aports/community/cloud-init/02-hosts-template-fix.patch
Dermot Bradley 4749dce063 community/cloud-init: correct template file, add notes, reduce dependencies
Correct template file for /etc/hosts to order short hostnames first.

Add extra usage notes to README file.

Remove py3-oauthlib and util-linux dependencies.
2020-11-26 09:18:08 +00:00

35 lines
1.3 KiB
Diff

From: Dermot Bradley <dermot_bradley@yahoo.com>
Date: Sat, 21 Nov 2020 16:52 +0000
Subject: [PATCH] cloud-init: Change order of entries in /etc/hosts
The Alpine /etc/hosts template results in a file where the long form of
names (including localhost) come before the short form. This means that
when running tools like 'netstat' and 'ss' which convert IP address to
names that their output will show 'localhost.localdomain' rather than
'localhost.' This patch swaps the order of the short and long form names
so such utils will show the short form name.
---
diff -aur a/templates/hosts.alpine.tmpl b/templates/hosts.alpine.tmpl
--- a/templates/hosts.alpine.tmpl
+++ b/templates/hosts.alpine.tmpl
@@ -13,13 +13,13 @@
# /etc/cloud/cloud.cfg or cloud-config from user-data
#
# The following lines are desirable for IPv4 capable hosts
-127.0.1.1 {{fqdn}} {{hostname}}
-127.0.0.1 localhost.localdomain localhost
-127.0.0.1 localhost4.localdomain4 localhost4
+127.0.1.1 {{hostname}} {{fqdn}}
+127.0.0.1 localhost localhost.localdomain
+127.0.0.1 localhost4 localhost4.localdomain4
# The following lines are desirable for IPv6 capable hosts
-::1 {{fqdn}} {{hostname}}
-::1 localhost6.localdomain6 localhost6
+::1 {{hostname}} {{fqdn}}
+::1 localhost6 localhost6.localdomain6
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix