config/options: general cleanup

brackets around variable names
shell builtin for inserting values into empty variables
line indent
variable quotes

Signed-off-by: Ian Leonard <antonlacon@gmail.com>
This commit is contained in:
Ian Leonard 2018-10-25 20:35:28 +00:00
parent ae29226181
commit 8d8ca6cee7

View File

@ -1,5 +1,5 @@
# Do not build as root. Ever. # Do not build as root. Ever.
if [[ $EUID -eq 0 ]]; then if [[ "${EUID}" -eq 0 ]]; then
echo "Building as the root user is NOT supported. Use a regular user account for the build." 1>&2 echo "Building as the root user is NOT supported. Use a regular user account for the build." 1>&2
exit 1 exit 1
fi fi
@ -9,32 +9,18 @@ fi
# set default independent variables # set default independent variables
ROOT="${PWD}" ROOT="${PWD}"
DISTRO_DIR="$ROOT/distributions" DISTRO_DIR="${ROOT}/distributions"
PROJECT_DIR="$ROOT/projects" PROJECT_DIR="${ROOT}/projects"
# determines DISTRO, if not forced by user # determines DISTRO, if not forced by user
# default is LibreELEC DISTRO="${DISTRO:-LibreELEC}"
if [ -z "$DISTRO" ]; then
DISTRO="LibreELEC"
else
DISTRO="$DISTRO"
fi
# determines PROJECT, if not forced by user # determines PROJECT, if not forced by user
# default is Generic PROJECT="${PROJECT:-Generic}"
if [ -z "$PROJECT" ]; then
PROJECT="Generic"
else
PROJECT="$PROJECT"
fi
# determines TARGET_ARCH, if not forced by user (x86_64 / arm) # determines TARGET_ARCH, if not forced by user
# default is x86_64 ARCH="${ARCH:-x86_64}"
if [ -z "$ARCH" ]; then TARGET_ARCH="${ARCH}"
TARGET_ARCH="x86_64"
else
TARGET_ARCH="$ARCH"
fi
# include helper functions # include helper functions
. config/functions . config/functions
@ -42,38 +28,38 @@ fi
# include versioning # include versioning
. config/version . config/version
# read distro versioning if available # read DISTRO versioning if available
if [ -f "$DISTRO_DIR/$DISTRO/version" ]; then if [ -f "${DISTRO_DIR}/${DISTRO}/version" ]; then
. $DISTRO_DIR/$DISTRO/version . "${DISTRO_DIR}/${DISTRO}/version"
fi fi
# read distro options if available # read DISTRO options if available
if [ -f "$DISTRO_DIR/$DISTRO/options" ]; then if [ -f "${DISTRO_DIR}/${DISTRO}/options" ]; then
. $DISTRO_DIR/$DISTRO/options . "${DISTRO_DIR}/${DISTRO}/options"
fi fi
# read project options if available # read PROJECT options if available
if [ -f "$PROJECT_DIR/$PROJECT/options" ]; then if [ -f "${PROJECT_DIR}/${PROJECT}/options" ]; then
. $PROJECT_DIR/$PROJECT/options . "${PROJECT_DIR}/${PROJECT}/options"
fi fi
# read board options if available # read DEVICE options if available
if [ -f "$PROJECT_DIR/$PROJECT/devices/$DEVICE/options" ]; then if [ -f "${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options" ]; then
. $PROJECT_DIR/$PROJECT/devices/$DEVICE/options . "${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options"
fi fi
# projects can set KERNEL_NAME (kernel.img) # projects can set KERNEL_NAME (kernel.img)
[ -z "$KERNEL_NAME" ] && KERNEL_NAME="KERNEL" KERNEL_NAME="${KERNEL_NAME:-KERNEL}"
LINUX_DEPENDS="$PROJECT_DIR/$PROJECT/linux $PROJECT_DIR/$PROJECT/patches/linux $PROJECT_DIR/$PROJECT/packages/linux $ROOT/packages/linux" LINUX_DEPENDS="${PROJECT_DIR}/${PROJECT}/linux ${PROJECT_DIR}/${PROJECT}/patches/linux ${PROJECT_DIR}/${PROJECT}/packages/linux ${ROOT}/packages/linux"
[ -n "$DEVICE" ] && LINUX_DEPENDS+=" $PROJECT_DIR/$PROJECT/devices/$DEVICE/linux $PROJECT_DIR/$PROJECT/devices/$DEVICE/patches/linux $PROJECT_DIR/$PROJECT/devices/$DEVICE/packages/linux" [ -n "${DEVICE}" ] && LINUX_DEPENDS+=" ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/linux ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/patches/linux ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/packages/linux"
[ "$TARGET_ARCH" = "x86_64" ] && LINUX_DEPENDS+=" $ROOT/packages/linux-firmware/intel-ucode $ROOT/packages/linux-firmware/kernel-firmware" [ "${TARGET_ARCH}" = "x86_64" ] && LINUX_DEPENDS+=" ${ROOT}/packages/linux-firmware/intel-ucode ${ROOT}/packages/linux-firmware/kernel-firmware"
# Need to point to your actual cc # Need to point to your actual cc
# If you have ccache installed, take care that LOCAL_CC does not point to it # If you have ccache installed, take care that LOCAL_CC does not point to it
[ -z "${LOCAL_CC}" ] && export LOCAL_CC="$(command -v gcc)" [ -z "${LOCAL_CC}" ] && export LOCAL_CC="$(command -v gcc)"
if [ -z "$LOCAL_CC" ] ; then if [ -z "${LOCAL_CC}" ]; then
die "***** Please install gcc *****" "127" die "***** Please install gcc *****" "127"
fi fi
@ -98,19 +84,19 @@ fi
CCACHE_CACHE_SIZE="10G" CCACHE_CACHE_SIZE="10G"
# read options from $HOME if available # read options from $HOME if available
if [ -f "$HOME/.libreelec/options" ]; then if [ -f "${HOME}/.libreelec/options" ]; then
. $HOME/.libreelec/options . "${HOME}/.libreelec/options"
fi fi
# overwrite OEM_SUPPORT via commandline # overwrite OEM_SUPPORT via commandline
if [ "$OEM" = yes -o "$OEM" = no ]; then if [ "${OEM}" = "yes" -o "${OEM}" = "no" ]; then
OEM_SUPPORT=$OEM OEM_SUPPORT="${OEM}"
fi fi
[ -z ${_DEBUG_DEPENDS_LIST+x} ] && set_debug_depends [ -z "${_DEBUG_DEPENDS_LIST+x}" ] && set_debug_depends
check_path >&2 check_path
check_config >&2 check_config
. config/graphic . config/graphic
. config/path $1 . config/path $1