Use uname -n instead of hostname(1)

The NAS is a minimal Arch install with no inetutils, so hostname(1) does
not exist and install died on its first line of real work. uname -n is
POSIX and always present. The same assumption was in dots, pkg-snapshot,
pkg-restore and zshenv's fallback.
This commit is contained in:
connor committed 2026-09-14 15:30:13 -04:00
1 parent 8ddbbe240d
commit a96aa4b820
5 files changed
+7 -5

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@
# point: a login banner that always fires is a banner you stop reading.
set -uo pipefail
REPO="${DOTFILES:-$HOME/.dotfiles}"
HOST="${DOTFILES_HOST:-$(hostname | tr '[:upper:]' '[:lower:]')}"
HOST="${DOTFILES_HOST:-$(uname -n | tr '[:upper:]' '[:lower:]')}"
NAG=0; [[ "${1:-}" == "--nag" ]] && NAG=1
cd "$REPO" 2>/dev/null || exit 0
+1 -1
View File
@@ -3,7 +3,7 @@
# apt's own idempotence mean already-installed packages are skipped.
set -euo pipefail
REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
HOST="${DOTFILES_HOST:-$(hostname | tr '[:upper:]' '[:lower:]')}"
HOST="${DOTFILES_HOST:-$(uname -n | tr '[:upper:]' '[:lower:]')}"
P="${REPO}/packages"
if [[ -f "${P}/${HOST}.pacman" ]]; then
+1 -1
View File
@@ -4,7 +4,7 @@
# The diff doubles as a log of what you added and when.
set -euo pipefail
REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
HOST="${DOTFILES_HOST:-$(hostname | tr '[:upper:]' '[:lower:]')}"
HOST="${DOTFILES_HOST:-$(uname -n | tr '[:upper:]' '[:lower:]')}"
OUT="${REPO}/packages"
mkdir -p "$OUT"
+1 -1
View File
@@ -2,7 +2,7 @@
# Keep it cheap: no subshells in the hot path, no vault lookups, no network.
export DOTFILES="${DOTFILES:-$HOME/.dotfiles}"
: ${DOTFILES_HOST:=${(L)${HOST:-$(hostname)}}} # lowercased; SCTFW004 -> sctfw004
: ${DOTFILES_HOST:=${(L)${HOST:-$(uname -n)}}} # lowercased; SCTFW004 -> sctfw004
export DOTFILES_HOST
export EDITOR="nvim"
+3 -1
View File
@@ -7,7 +7,9 @@ set -euo pipefail
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"
HOST="${DOTFILES_HOST:-$(hostname | tr '[:upper:]' '[:lower:]')}"
# uname -n, not hostname(1): the latter comes from inetutils and is absent on
# a minimal Arch install. The NAS had no hostname binary at all.
HOST="${DOTFILES_HOST:-$(uname -n | tr '[:upper:]' '[:lower:]')}"
HOSTCONF="meta/hosts/${HOST}.conf.yaml"
cd "${BASEDIR}"