diff --git a/conf/explorer/hostname b/conf/explorer/hostname index a3ae4e15..2ae23759 100755 --- a/conf/explorer/hostname +++ b/conf/explorer/hostname @@ -1,6 +1,7 @@ #!/bin/sh # # 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2012 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -19,4 +20,6 @@ # # -hostname +if command -v hostname; then + hostname +fi diff --git a/conf/explorer/interfaces b/conf/explorer/interfaces index 76ff32bb..6804f2db 100755 --- a/conf/explorer/interfaces +++ b/conf/explorer/interfaces @@ -24,11 +24,16 @@ # # Use ip, if available -if which ip >/dev/null 2>&1; then +if command -v ip; then ip -o link show | sed -n 's/^[0-9]\+: \(.\+\): <.*/\1/p' exit 0 fi +if ! command -v ifconfig; then + # no ifconfig, nothing we could do + exit 0 +fi + uname_s="$(uname -s)" REGEXP='s/^(.*)(:[[:space:]]*flags=|Link encap).*/\1/p' diff --git a/conf/explorer/lsb_codename b/conf/explorer/lsb_codename index 22b6d51e..eebd3e0f 100755 --- a/conf/explorer/lsb_codename +++ b/conf/explorer/lsb_codename @@ -25,7 +25,7 @@ case "$($__explorer/os)" in (. /etc/openwrt_release && echo "$DISTRIB_CODENAME") ;; *) - lsb_release=$(which lsb_release 2>/dev/null) + lsb_release=$(command -v lsb_release) if [ -x "$lsb_release" ]; then $lsb_release --short --codename fi diff --git a/conf/explorer/lsb_description b/conf/explorer/lsb_description index 48aff30d..23f45421 100755 --- a/conf/explorer/lsb_description +++ b/conf/explorer/lsb_description @@ -25,7 +25,7 @@ case "$($__explorer/os)" in (. /etc/openwrt_release && echo "$DISTRIB_DESCRIPTION") ;; *) - lsb_release=$(which lsb_release 2>/dev/null) + lsb_release=$(command -v lsb_release) if [ -x "$lsb_release" ]; then $lsb_release --short --description fi diff --git a/conf/explorer/lsb_id b/conf/explorer/lsb_id index 0dd0f9f4..9754eb63 100755 --- a/conf/explorer/lsb_id +++ b/conf/explorer/lsb_id @@ -25,7 +25,7 @@ case "$($__explorer/os)" in (. /etc/openwrt_release && echo "$DISTRIB_ID") ;; *) - lsb_release=$(which lsb_release 2>/dev/null) + lsb_release=$(command -v lsb_release) if [ -x "$lsb_release" ]; then $lsb_release --short --id fi diff --git a/conf/explorer/lsb_release b/conf/explorer/lsb_release index 8266171a..35b5547c 100755 --- a/conf/explorer/lsb_release +++ b/conf/explorer/lsb_release @@ -25,7 +25,7 @@ case "$($__explorer/os)" in (. /etc/openwrt_release && echo "$DISTRIB_RELEASE") ;; *) - lsb_release=$(which lsb_release 2>/dev/null) + lsb_release=$(command -v lsb_release) if [ -x "$lsb_release" ]; then $lsb_release --short --release fi diff --git a/conf/explorer/machine b/conf/explorer/machine index 25fc76a9..bb6e0beb 100755 --- a/conf/explorer/machine +++ b/conf/explorer/machine @@ -22,4 +22,6 @@ # # -uname -m +if command -v uname; then + uname -m +fi diff --git a/conf/explorer/runlevel b/conf/explorer/runlevel index 7cdd81ef..02d3a245 100755 --- a/conf/explorer/runlevel +++ b/conf/explorer/runlevel @@ -20,7 +20,7 @@ # set +e -executable=$(which runlevel 2>/dev/null) +executable=$(command -v runlevel) if [ -x "$executable" ]; then "$executable" | awk '{ print $2 }' fi