From 96839a57432d9e80ee3da328c71b1d094e95fbde Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Sat, 30 Nov 2019 10:27:28 -0600 Subject: [PATCH] Remove dependency on `hostname` (#182) --- yadm | 2 +- yadm.1 | 4 ++-- yadm.spec | 5 ----- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/yadm b/yadm index df8d35c..a4ff860 100755 --- a/yadm +++ b/yadm @@ -473,7 +473,7 @@ function set_local_alt_values() { local_host="$(config local.hostname)" if [ -z "$local_host" ] ; then - local_host=$(hostname) + local_host=$(uname -n) local_host=${local_host%%.*} # trim any domain from hostname fi diff --git a/yadm.1 b/yadm.1 index 9008f6f..0e9c49c 100644 --- a/yadm.1 +++ b/yadm.1 @@ -496,7 +496,7 @@ See the CONFIGURATION section for more details about setting .BR hostname , " h Valid if the value matches the short hostname. Hostname is calculated by running -.BR "hostname" , +.BR "uname -n" , and trimming off any domain. .TP .B default @@ -629,7 +629,7 @@ During processing, the following variables are available in the template: ------------- ------------- -------------------------- yadm.class YADM_CLASS Locally defined yadm class yadm.distro YADM_DISTRO lsb_release -si - yadm.hostname YADM_HOSTNAME hostname (without domain) + yadm.hostname YADM_HOSTNAME uname -n (without domain) yadm.os YADM_OS uname -s yadm.user YADM_USER id -u -n yadm.source YADM_SOURCE Template filename diff --git a/yadm.spec b/yadm.spec index f7cd484..bd93c07 100644 --- a/yadm.spec +++ b/yadm.spec @@ -8,11 +8,6 @@ URL: https://yadm.io License: GPL-3.0-only Requires: bash Requires: git -%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} >= 700 -Requires: /usr/bin/hostname -%else -Requires: /bin/hostname -%endif Source: %{name}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build