armbian-next: docker: locale-gen + enable all existing extensions before calculating docker hostdeps

- that way all extensions' hostdeps are included in Dockerfile
- also run locale-gen in Dockerfile
This commit is contained in:
Ricardo Pardini
2022-10-25 20:59:05 +02:00
parent 94d451b812
commit b703eb6da3
2 changed files with 34 additions and 1 deletions

View File

@@ -326,7 +326,7 @@ enable_extension() {
stacktrace="${ENABLE_EXTENSION_TRACE_HINT}$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")"
display_alert "Enabling extension" "${extension_name} :: added by ${stacktrace}" "debug"
else
display_alert "Enabling extension" "${extension_name}" ""
[[ "${enable_extension_quiet:-no}" != "yes" ]] && display_alert "Enabling extension" "${extension_name}" ""
fi
# first a check, has the extension manager already initialized? then it is too late to enable_extension(). bail.
@@ -402,6 +402,36 @@ enable_extension() {
}
# This looks up and enables _all_ existing extensions.
# The reasoning is simple: during Dockerfile build, we wanna have all the hostdeps defined, even if we're not gonna use them.
function enable_all_extensions_builtin_and_user() {
declare -a extension_list=()
declare -a ext_dirs=("${SRC}/extensions" "${SRC}/userpatches/extensions")
declare -a ignore_extensions=("sample-extension")
# Extensions are files of the format <dir>/extension_name.sh or <dir>/extension_name/extension_name.sh
for ext_dir in "${ext_dirs[@]}"; do
if [[ -d "${ext_dir}" ]]; then
declare -a ext_list_dir=()
mapfile -t ext_list_dir < <(find "${ext_dir}" -maxdepth 2 -type f -name "*.sh")
extension_list+=("${ext_list_dir[@]}")
fi
done
# loop over the files found; remove the prefix
for extension_file in "${extension_list[@]}"; do
extension_file="${extension_file#${SRC}/}"
extension_file="${extension_file%.sh}"
extension_name="${extension_file##*/}"
# skip, if extension_name is in the ignore_extensions array
if [[ " ${ignore_extensions[*]} " == *" ${extension_name} "* ]]; then
continue
fi
# enable the extensions, quietly.
enable_extension_quiet="yes" enable_extension "${extension_name}"
done
}
# Fancy placeholder for future ideas. allow any core function to be hooked. maybe with "voters" infrastructure?
function do_with_hooks() {
"$@"

View File

@@ -109,6 +109,7 @@ function docker_cli_prepare() {
#############################################################################################################
# Prepare some dependencies; these will be used on the Dockerfile
enable_all_extensions_builtin_and_user
initialize_extension_manager # initialize the extension manager.
declare -a -g host_dependencies=()
early_prepare_host_dependencies
@@ -209,6 +210,8 @@ function docker_cli_prepare() {
RUN echo "--> CACHE MISS IN DOCKERFILE: apt packages." && \
DEBIAN_FRONTEND=noninteractive apt-get -y update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${BASIC_DEPS[@]} ${host_dependencies[@]}
RUN sed -i 's/# en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen
RUN locale-gen
WORKDIR ${DOCKER_ARMBIAN_TARGET_PATH}
ENV ARMBIAN_RUNNING_IN_CONTAINER=yes
ADD . ${DOCKER_ARMBIAN_TARGET_PATH}/