forked from ungleich-public/cdist
/which/command -v/
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
2856684e51
commit
d13a201cd0
8 changed files with 9 additions and 9 deletions
|
@ -20,6 +20,6 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
if which hostname >/dev/null 2>&1; then
|
if command -v hostname; then
|
||||||
hostname
|
hostname
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -24,12 +24,12 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
# Use ip, if available
|
# 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'
|
ip -o link show | sed -n 's/^[0-9]\+: \(.\+\): <.*/\1/p'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! which ifconfig >/dev/null 2>&1; then
|
if ! command -v ifconfig; then
|
||||||
# no ifconfig, nothing we could do
|
# no ifconfig, nothing we could do
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -25,7 +25,7 @@ case "$($__explorer/os)" in
|
||||||
(. /etc/openwrt_release && echo "$DISTRIB_CODENAME")
|
(. /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
|
if [ -x "$lsb_release" ]; then
|
||||||
$lsb_release --short --codename
|
$lsb_release --short --codename
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -25,7 +25,7 @@ case "$($__explorer/os)" in
|
||||||
(. /etc/openwrt_release && echo "$DISTRIB_DESCRIPTION")
|
(. /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
|
if [ -x "$lsb_release" ]; then
|
||||||
$lsb_release --short --description
|
$lsb_release --short --description
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -25,7 +25,7 @@ case "$($__explorer/os)" in
|
||||||
(. /etc/openwrt_release && echo "$DISTRIB_ID")
|
(. /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
|
if [ -x "$lsb_release" ]; then
|
||||||
$lsb_release --short --id
|
$lsb_release --short --id
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -25,7 +25,7 @@ case "$($__explorer/os)" in
|
||||||
(. /etc/openwrt_release && echo "$DISTRIB_RELEASE")
|
(. /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
|
if [ -x "$lsb_release" ]; then
|
||||||
$lsb_release --short --release
|
$lsb_release --short --release
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -22,6 +22,6 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
if which uname >/dev/null 2>&1; then
|
if command -v uname; then
|
||||||
uname -m
|
uname -m
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
executable=$(which runlevel 2>/dev/null)
|
executable=$(command -v runlevel)
|
||||||
if [ -x "$executable" ]; then
|
if [ -x "$executable" ]; then
|
||||||
"$executable" | awk '{ print $2 }'
|
"$executable" | awk '{ print $2 }'
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue