{bash,zsh}rc: check for existence of hostname{,ctl} as apparently Arch Linux doesn't ship it

This commit is contained in:
Aminda Suomalainen 2024-08-10 07:11:56 +03:00
parent fab94cc0a0
commit 98976e793d
Signed by: Mikaela
SSH Key Fingerprint: SHA256:CXLULpqNBdUKB6E6fLA1b/4SzG0HvKD19PbIePU175Q
2 changed files with 12 additions and 10 deletions

View File

@ -134,8 +134,12 @@ fi
if hash lsb_release 2> /dev/null; then
(
export LC_ALL="en_DK.UTF-8"
if hash hostname 2> /dev/null; then
hostname --all-fqdns &
hostname --all-ip-addresses
hostname --all-ip-addresses &
elif hash hostnamectl 2> /dev/null; then
hostnamectl hostname &
fi
printf "\n"
printf "$(uptime --pretty)\t$(uptime)\n"
printf "\nPresent:\n"
@ -254,9 +258,6 @@ fi
#export CLICOLOR=1
#export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
# znc uses this variable for figuring out hostname
#export HOSTNAME=$(hostname --fqdn)
# Ensure not leaking queries to upstream nameservers (resolv.conf)
export LOCALDOMAIN=.
# Secureish resolv.conf options (except trust-ad, but systemd also sets it

View File

@ -31,8 +31,12 @@ fi
if hash lsb_release 2> /dev/null; then
(
export LC_ALL="en_DK.UTF-8"
if hash hostname 2> /dev/null; then
hostname --all-fqdns &
hostname --all-ip-addresses
hostname --all-ip-addresses &
elif hash hostnamectl 2> /dev/null; then
hostnamectl hostname &
fi
printf "\n"
printf "$(uptime --pretty)\t$(uptime)\n"
printf "\nPresent:\n"
@ -215,9 +219,6 @@ fi
#export CLICOLOR=1
#export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
# znc uses this variable for figuring out hostname
#export HOSTNAME=$(hostname --fqdn)
# Ensure not leaking queries to upstream nameservers (resolv.conf)
export LOCALDOMAIN=.
# Secureish resolv.conf options (except trust-ad, but systemd also sets it