diff options
author | Lukas Bestle <mail@lukasbestle.com> | 2021-07-09 22:48:26 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2021-11-16 11:31:51 +0000 |
commit | 861b70fc2fefc7717cd7de1dafb118176aca846b (patch) | |
tree | 4a13b9d36298d2ca743c34ce62151018f146f4d9 /libalpine.sh.in | |
parent | c38223ed80efed2a5e91134250868f6cc6c93499 (diff) | |
download | alpine-conf-861b70fc2fefc7717cd7de1dafb118176aca846b.zip |
setup-dns: Use FQDN from hostname as domain
Diffstat (limited to 'libalpine.sh.in')
-rw-r--r-- | libalpine.sh.in | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libalpine.sh.in b/libalpine.sh.in index 3185b55..80193dd 100644 --- a/libalpine.sh.in +++ b/libalpine.sh.in @@ -297,3 +297,13 @@ find_modloop_media() { test -n "$modloop_media" || return echo "$modloop_media" } + +# Extract fully qualified domain name from current hostname. If none is +# currently set, use the provided fallback. +get_fqdn() { + local _dn + _dn=$(hostname -f 2>/dev/null) + _dn=${_dn#$(hostname -s 2>/dev/null)} + _dn=${_dn#.} + echo "${_dn:=$1}" +} |