mirror of
https://github.com/balena-io/open-balena.git
synced 2025-01-31 00:23:54 +00:00
e1bfb7f7b0
For convenience, also add instructions what to install. Tha change also addresses invalid usage of 'local' outside of a function. Change-type: patch Signed-off-by: Roman Mazur <mazur.roman@gmail.com>
36 lines
696 B
Bash
36 lines
696 B
Bash
#!/bin/bash -e
|
|
|
|
echo_error() {
|
|
local RED=`tput setaf 1`
|
|
local RESET=`tput sgr0`
|
|
echo "${RED}ERROR: ${1}${RESET}"
|
|
}
|
|
|
|
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
|
|
echo_error 'Unable to find suitable command for realpath.'
|
|
if [ $(uname) == 'Darwin' ]; then
|
|
echo 'GNU coreutils are required to build openBalena on MacOS. To install with brew, run'
|
|
echo ''
|
|
echo ' brew install coreutils'
|
|
echo ''
|
|
fi
|
|
exit 1
|
|
fi
|
|
|
|
realpath() {
|
|
echo $(command ${REALPATH} "$@")
|
|
}
|