2015-12-02 20:33:32 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
|
|
|
|
#
|
|
|
|
# This file is licensed under the terms of the GNU General Public
|
|
|
|
# License version 2. This program is licensed "as is" without any
|
|
|
|
# warranty of any kind, whether express or implied.
|
|
|
|
#
|
2017-08-01 12:51:10 +03:00
|
|
|
# This file is a part of the Armbian build script
|
|
|
|
# https://github.com/armbian/build/
|
2015-12-02 20:33:32 +01:00
|
|
|
|
2017-08-06 17:11:16 +03:00
|
|
|
# DO NOT EDIT THIS FILE
|
|
|
|
# use configuration files like config-default.conf to set the build configuration
|
|
|
|
# check Armbian documentation for more info
|
|
|
|
|
2017-09-14 03:13:26 -07:00
|
|
|
SRC="$(dirname "$(realpath "${BASH_SOURCE}")")"
|
2017-07-11 12:39:32 +03:00
|
|
|
# fallback for Trusty
|
2017-09-14 03:13:26 -07:00
|
|
|
[[ -z "${SRC}" ]] && SRC="$(pwd)"
|
2017-09-13 12:59:03 +02:00
|
|
|
|
|
|
|
# check for whitespace in $SRC and exit for safety reasons
|
2017-09-14 03:13:26 -07:00
|
|
|
grep -q "[[:space:]]" <<<"${SRC}" && { echo "\"${SRC}\" contains whitespace. Not supported. Aborting." >&2 ; exit 1 ; }
|
2017-09-13 12:59:03 +02:00
|
|
|
|
2017-07-11 12:39:32 +03:00
|
|
|
cd $SRC
|
2015-12-02 20:33:32 +01:00
|
|
|
|
2017-07-11 12:46:08 +03:00
|
|
|
if [[ -f $SRC/lib/general.sh && -L $SRC/main.sh ]]; then
|
2017-07-11 12:39:32 +03:00
|
|
|
source $SRC/lib/general.sh
|
|
|
|
else
|
|
|
|
echo "Error: missing build directory structure"
|
|
|
|
echo "Please clone the full repository https://github.com/armbian/build/"
|
2016-07-27 13:37:23 +03:00
|
|
|
exit -1
|
2015-12-02 20:33:32 +01:00
|
|
|
fi
|
|
|
|
|
2017-07-11 12:46:08 +03:00
|
|
|
# copy default config from the template
|
|
|
|
[[ ! -f $SRC/config-default.conf ]] && cp $SRC/config/templates/config-example.conf $SRC/config-default.conf
|
|
|
|
|
|
|
|
# source build configuration file
|
|
|
|
if [[ -n $1 && -f $SRC/config-$1.conf ]]; then
|
|
|
|
display_alert "Using config file" "config-$1.conf" "info"
|
|
|
|
source $SRC/config-$1.conf
|
|
|
|
else
|
|
|
|
display_alert "Using config file" "config-default.conf" "info"
|
|
|
|
source $SRC/config-default.conf
|
|
|
|
fi
|
|
|
|
|
2015-12-29 21:26:14 +03:00
|
|
|
if [[ $EUID != 0 ]]; then
|
2017-07-11 12:39:32 +03:00
|
|
|
display_alert "This script requires root privileges, trying to use sudo" "" "wrn"
|
|
|
|
sudo "$SRC/compile.sh" "$@"
|
2016-07-27 13:37:23 +03:00
|
|
|
exit $?
|
2015-12-07 16:55:53 +03:00
|
|
|
fi
|
2015-12-02 20:33:32 +01:00
|
|
|
|
2016-03-22 17:32:53 +03:00
|
|
|
if [[ ! -f $SRC/.ignore_changes ]]; then
|
|
|
|
echo -e "[\e[0;32m o.k. \x1B[0m] This script will try to update"
|
|
|
|
git pull
|
|
|
|
CHANGED_FILES=$(git diff --name-only)
|
|
|
|
if [[ -n $CHANGED_FILES ]]; then
|
2016-07-27 13:37:23 +03:00
|
|
|
echo -e "[\e[0;35m warn \x1B[0m] Can't update since you made changes to: \e[0;32m\n${CHANGED_FILES}\x1B[0m"
|
2016-03-22 17:32:53 +03:00
|
|
|
echo -e "Press \e[0;33m<Ctrl-C>\x1B[0m to abort compilation, \e[0;33m<Enter>\x1B[0m to ignore and continue"
|
|
|
|
read
|
|
|
|
else
|
|
|
|
git checkout ${LIB_TAG:- master}
|
|
|
|
fi
|
2016-03-19 08:54:56 +01:00
|
|
|
fi
|
2016-07-27 13:37:23 +03:00
|
|
|
|
2016-04-16 21:42:53 +03:00
|
|
|
if [[ $BUILD_ALL == yes || $BUILD_ALL == demo ]]; then
|
2015-12-02 20:33:32 +01:00
|
|
|
source $SRC/lib/build-all.sh
|
|
|
|
else
|
|
|
|
source $SRC/lib/main.sh
|
|
|
|
fi
|