mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
functions: break check_config into its constituent parts; add check_distro
Take the opportunity to cleanup the check_foobar() too. Signed-off-by: Ian Leonard <antonlacon@gmail.com>
This commit is contained in:
parent
0727f4c685
commit
2a12f77b6e
103
config/functions
103
config/functions
@ -457,16 +457,15 @@ init_package_cache() {
|
||||
}
|
||||
|
||||
check_path() {
|
||||
dashes="==========================="
|
||||
local dashes="===========================" path_err_msg
|
||||
if [ "${PWD##/usr}" != "${PWD}" ]; then
|
||||
check_pathmessage="$check_pathmessage\n $dashes$dashes$dashes"
|
||||
check_pathmessage="$check_pathmessage\n ERROR: You try to build inside /usr"
|
||||
check_pathmessage="$check_pathmessage\n $dashes$dashes$dashes"
|
||||
check_pathmessage="$check_pathmessage\n This is not supported with our buildsystem."
|
||||
check_pathmessage="$check_pathmessage\n Please use another dir (for example your \$HOME) to build $DISTRONAME"
|
||||
path_err_msg="\n $dashes$dashes$dashes"
|
||||
path_err_msg="${path_err_msg}\n ERROR: Detected building inside /usr"
|
||||
path_err_msg="${path_err_msg}\n $dashes$dashes$dashes"
|
||||
path_err_msg="${path_err_msg}\n This is not supported with our buildsystem."
|
||||
path_err_msg="${path_err_msg}\n Please use another dir (for example your \$HOME) to build ${DISTRONAME}"
|
||||
|
||||
echo -e $check_pathmessage
|
||||
die
|
||||
die "${path_err_msg}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -487,57 +486,83 @@ save_build_config() {
|
||||
done
|
||||
}
|
||||
|
||||
check_config() {
|
||||
dashes="==========================="
|
||||
if [ ! -d $PROJECT_DIR/$PROJECT ]; then
|
||||
check_project="$check_project\n $dashes$dashes$dashes"
|
||||
check_project="$check_project\n ERROR: Project not found, use a valid project or create a new config"
|
||||
check_project="$check_project\n $dashes$dashes$dashes"
|
||||
check_project="$check_project\n\n Valid projects:"
|
||||
check_distro() {
|
||||
local dashes="===========================" distro_err_msg
|
||||
if [ -z "${DISTRO}" -o ! -d "${DISTRO_DIR}/${DISTRO}" ]; then
|
||||
distro_err_msg="\n $dashes$dashes$dashes"
|
||||
distro_err_msg="${distro_err_msg}\n ERROR: Distro not found, use a valid distro or create a new config"
|
||||
distro_err_msg="${distro_err_msg}\n $dashes$dashes$dashes"
|
||||
distro_err_msg="${distro_err_msg}\n\n Valid distros:"
|
||||
|
||||
for projects in $PROJECT_DIR/*; do
|
||||
check_project="$check_project\n - $(basename $projects)"
|
||||
for distros in ${DISTRO_DIR}/*; do
|
||||
distro_err_msg="${distro_err_msg}\n - ${distros##*/}"
|
||||
done
|
||||
echo -e $check_project
|
||||
die
|
||||
die "${distro_err_msg}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ \( -z "$DEVICE" -a -d "$PROJECT_DIR/$PROJECT/devices" \) -o \( -n "$DEVICE" -a ! -d "$PROJECT_DIR/$PROJECT/devices/$DEVICE" \) ]; then
|
||||
check_device="$check_device\n $dashes$dashes$dashes"
|
||||
check_device="$check_device\n ERROR: You need to specify a valid device for the $PROJECT project"
|
||||
check_device="$check_device\n $dashes$dashes$dashes"
|
||||
check_device="$check_device\n\n Valid devices for project: $PROJECT"
|
||||
check_project() {
|
||||
local dashes="===========================" project_err_msg
|
||||
if [ -z "${PROJECT}" -o ! -d "${PROJECT_DIR}/${PROJECT}" ]; then
|
||||
project_err_msg="\n $dashes$dashes$dashes"
|
||||
project_err_msg="${project_err_msg}\n ERROR: Project not found, use a valid project or create a new config"
|
||||
project_err_msg="${project_err_msg}\n $dashes$dashes$dashes"
|
||||
project_err_msg="${project_err_msg}\n\n Valid projects:"
|
||||
|
||||
for device in $PROJECT_DIR/$PROJECT/devices/*; do
|
||||
check_device="$check_device\n - $(basename $device)"
|
||||
for projects in ${PROJECT_DIR}/*; do
|
||||
project_err_msg="${project_err_msg}\n - ${projects##*/}"
|
||||
done
|
||||
echo -e $check_device
|
||||
die
|
||||
die "${project_err_msg}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -d $PROJECT_DIR/$PROJECT/devices/$DEVICE/linux ]; then
|
||||
linux_config_dir="$PROJECT_DIR/$PROJECT/devices/$DEVICE/linux"
|
||||
check_device() {
|
||||
local dashes="===========================" device_err_msg
|
||||
if [ \( -z "${DEVICE}" -a -d "${PROJECT_DIR}/${PROJECT}/devices" \) -o \
|
||||
\( -n "${DEVICE}" -a ! -d "${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}" \) ]; then
|
||||
device_err_msg="\n $dashes$dashes$dashes"
|
||||
device_err_msg="${device_err_msg}\n ERROR: You need to specify a valid device for the $PROJECT project"
|
||||
device_err_msg="${device_err_msg}\n $dashes$dashes$dashes"
|
||||
device_err_msg="${device_err_msg}\n\n Valid devices for project: ${PROJECT}"
|
||||
|
||||
for device in ${PROJECT_DIR}/${PROJECT}/devices/*; do
|
||||
device_err_msg="${device_err_msg}\n - ${device##*/}"
|
||||
done
|
||||
die "${device_err_msg}"
|
||||
fi
|
||||
}
|
||||
|
||||
check_arch() {
|
||||
local dashes="===========================" arch_err_msg linux_config_dir
|
||||
if [ -d ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/linux ]; then
|
||||
linux_config_dir="${PROJECT_DIR}/${PROJECT}/devices/$DEVICE/linux"
|
||||
else
|
||||
linux_config_dir="$PROJECT_DIR/$PROJECT/linux"
|
||||
linux_config_dir="${PROJECT_DIR}/${PROJECT}/linux"
|
||||
fi
|
||||
|
||||
if [ ! -e $linux_config_dir/linux.${TARGET_PATCH_ARCH:-$TARGET_ARCH}.conf ] &&
|
||||
! ls $linux_config_dir/*/linux.${TARGET_PATCH_ARCH:-$TARGET_ARCH}.conf &>/dev/null; then
|
||||
check_arch="$check_arch\n $dashes$dashes$dashes"
|
||||
check_arch="$check_arch\n ERROR: Architecture not found, use a valid Architecture"
|
||||
check_arch="$check_arch\n for your project or create a new config"
|
||||
check_arch="$check_arch\n $dashes$dashes$dashes"
|
||||
check_arch="$check_arch\n\n Valid Architectures for your project: $PROJECT"
|
||||
arch_err_msg="\n $dashes$dashes$dashes"
|
||||
arch_err_msg="${arch_err_msg}\n ERROR: Architecture not found, use a valid Architecture"
|
||||
arch_err_msg="${arch_err_msg}\n for your project or create a new config"
|
||||
arch_err_msg="${arch_err_msg}\n $dashes$dashes$dashes"
|
||||
arch_err_msg="${arch_err_msg}\n\n Valid Architectures for your project: ${PROJECT}"
|
||||
|
||||
for arch in $linux_config_dir/*.conf $linux_config_dir/*/linux.$TARGET_ARCH.conf; do
|
||||
[[ ${arch} =~ .*\*.* ]] && continue #ignore unexpanded wildcard
|
||||
check_arch="$check_arch\n - $(basename $arch | cut -f2 -d".")"
|
||||
arch_err_msg="${arch_err_msg}\n - $(basename $arch | cut -f2 -d".")"
|
||||
done
|
||||
echo -e $check_arch
|
||||
die
|
||||
die "${arch_err_msg}"
|
||||
fi
|
||||
}
|
||||
|
||||
check_config() {
|
||||
check_distro
|
||||
check_project
|
||||
check_device
|
||||
check_arch
|
||||
}
|
||||
|
||||
do_autoreconf() {
|
||||
export ACLOCAL_DIR=$SYSROOT_PREFIX/usr/share/aclocal
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user