mirror of
https://github.com/balena-io/open-balena.git
synced 2025-01-18 02:40:09 +00:00
25 lines
403 B
Plaintext
25 lines
403 B
Plaintext
|
#!/bin/bash -e
|
||
|
|
||
|
REALPATH=
|
||
|
REALPATHS=(
|
||
|
'realpath'
|
||
|
'grealpath'
|
||
|
'greadlink -f'
|
||
|
)
|
||
|
for cmd in "${REALPATHS[@]}"; do
|
||
|
if command -v "${cmd%% *}" &>/dev/null; then
|
||
|
REALPATH="${cmd}"
|
||
|
break
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
if [ -z "${REALPATH}" ]; then
|
||
|
local RED=`tput setaf 1`
|
||
|
echo "${RED}ERROR: Unable to find suitable command for realpath."
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
realpath() {
|
||
|
echo $(command ${REALPATH} "$@")
|
||
|
}
|