# Distributed under the GPLv3 software license, see the accompanying
# Distributed under the GPLv3 software license, see the accompanying
# file LICENSE or https://www.gnu.org/licenses/gpl-3.0.en.html
# file LICENSE or https://www.gnu.org/licenses/gpl-3.0.en.html
#
#
# Purpose: Script to build the ARM or aarch64 architecture,
# Purpose: Script to build the ARM or aarch64 architecture,
# which is what the PinePhone boards are running
# which is what the PinePhone boards are running
# Check if go is installed on system...
v=`go version |{read _ _ v _;echo${v#go};}`
function version {echo"$@"| awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }';}
# Check if go is installed on system and exits if it is not
# Check if go is installed on system and exits if it is not
if ! [ -x "$(command -v go)"];then
if ! [ -x "$(command -v go)"];then
echo'Error: go is not installed. Install go and try again.' >&2
echo'Error: go is not installed. Install go and try again.' >&2
exit1
exit1
# If go is installed, then check system for at least version 1.13.0
elif[$(version $v) -lt $(version "1.13.0")];then
echo'Error: the go version you have installed requires at least version 1.13, which your system does not have installed. Install a newer version of go and try again.' >&2
echo''
echo"Try out gobrew to install a newer version than what your OS package manager supplies."