From 9c3049c02c6142e166c9472237f1f60d86153682 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Thu, 17 Sep 2009 00:38:39 +0300 Subject: [PATCH] kbuild: fix warning when domainname is not available Otherwise we get: "dnsdomainname: Unknown host" Signed-off-by: Felipe Contreras Acked-by: WANG Cong Signed-off-by: Sam Ravnborg --- scripts/mkcompile_h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 6a12dd9f1181..f060763c0c6a 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -66,9 +66,13 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" if [ -x /bin/dnsdomainname ]; then - echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname | $UTS_TRUNCATE`\" + domain=`dnsdomainname 2> /dev/null` elif [ -x /bin/domainname ]; then - echo \#define LINUX_COMPILE_DOMAIN \"`domainname | $UTS_TRUNCATE`\" + domain=`domainname 2> /dev/null` + fi + + if [ -n "$domain" ]; then + echo \#define LINUX_COMPILE_DOMAIN \"`echo $domain | $UTS_TRUNCATE`\" else echo \#define LINUX_COMPILE_DOMAIN fi -- 2.30.2