2018-12-17 18:36:59 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2019-04-14 11:47:14 +00:00
|
|
|
echo_error() {
|
|
|
|
local RED=`tput setaf 1`
|
|
|
|
local RESET=`tput sgr0`
|
|
|
|
echo "${RED}ERROR: ${1}${RESET}"
|
|
|
|
}
|
|
|
|
|
2018-12-17 18:36:59 +00:00
|
|
|
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
|
2019-04-14 11:47:14 +00:00
|
|
|
echo_error 'Unable to find suitable command for realpath.'
|
|
|
|
if [ $(uname) == 'Darwin' ]; then
|
2019-07-30 09:59:30 +00:00
|
|
|
echo 'GNU coreutils are required to build openBalena on macOS. To install with brew, run'
|
2019-04-14 11:47:14 +00:00
|
|
|
echo ''
|
|
|
|
echo ' brew install coreutils'
|
|
|
|
echo ''
|
|
|
|
fi
|
2018-12-17 18:36:59 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
realpath() {
|
|
|
|
echo $(command ${REALPATH} "$@")
|
|
|
|
}
|