Skip to content

Commit

Permalink
Bugfix USERPATCHES not working properly
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik committed Dec 29, 2023
1 parent 55128ff commit 08dc5b5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ runs:
ENABLE_EXTENSIONS="${{ inputs.armbian_extensions }}" \
COMPRESS_OUTPUTIMAGE="${{ inputs.armbian_compress }}" \
SHARE_LOG="yes" \
EXPERT="yes"
EXPERT="yes" \
PREFER_DOCKER="no"
# save path
echo "ARMBIAN_SCRIPT_PATH=${GITHUB_ACTION_PATH}" >> $GITHUB_ENV
Expand Down
3 changes: 2 additions & 1 deletion lib/functions/cli/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ function cli_entrypoint() {
# Also form here, UUID will be generated, output created, logging enabled, etc.

# Init basic dirs.
declare -g -r DEST="${SRC}/output" USERPATCHES_PATH="${SRC}"/userpatches # DEST is the main output dir, and USERPATCHES_PATH is the userpatches dir. read-only.
declare -g -r DEST="${SRC}/output" # DEST is the main output dir
[[ -z ${USERPATCHES_PATH} ]] && USERPATCHES_PATH="${SRC}"/userpatches # USERPATCHES_PATH is the userpatches dir. read-only.
mkdir -p "${DEST}" "${USERPATCHES_PATH}" # Create output and userpatches directory if not already there
display_alert "Output directory created! DEST:" "${DEST}" "debug"

Expand Down
11 changes: 6 additions & 5 deletions lib/functions/general/extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ function write_hook_point_metadata() {
# can be called by board, family, config or user to make sure an extension is included.
# single argument is the extension name.
# will look for it in /userpatches/extensions first.
# will look for it in ${USERPATCHES_PATH}/extensions first.
# if not found there will look in /extensions
# if not found will exit 17
function enable_extension() {
Expand All @@ -442,9 +442,9 @@ function enable_extension() {
if [[ "${SHOW_DEBUG}" == "yes" ]]; then
stacktrace="${ENABLE_EXTENSION_TRACE_HINT}$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")"
display_alert "Enabling extension" "${extension_name} :: added by ${stacktrace}" "debug"
display_alert "Enabling extension $USERPATCHES_PATH sd" "${extension_name} :: added by ${stacktrace}" "debug"
else
[[ "${enable_extension_quiet:-no}" != "yes" ]] && display_alert "Enabling extension" "${extension_name}" ""
[[ "${enable_extension_quiet:-no}" != "yes" ]] && display_alert "Enabling extension ddf $USERPATCHES_PATH" "${extension_name}" ""
fi
# first a check, has the extension manager already initialized? then it is too late to enable_extension(). bail.
Expand All @@ -464,7 +464,7 @@ function enable_extension() {
enable_extension_recurse_counter=$((enable_extension_recurse_counter + 1))
# there are many opportunities here. too many, actually. let userpatches override just some functions, etc.
for extension_base_path in "${SRC}/userpatches/extensions" "${SRC}/extensions"; do
for extension_base_path in "${USERPATCHES_PATH}/extensions" "${SRC}/extensions"; do
extension_dir="${extension_base_path}/${extension_name}"
extension_file_in_dir="${extension_dir}/${extension_name}.sh"
extension_floating_file="${extension_base_path}/${extension_name}.sh"
Expand Down Expand Up @@ -526,7 +526,7 @@ function enable_extension() {
# 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 ext_dirs=("${SRC}/extensions" "${USERPATCHES_PATH}/extensions")
declare -a ignore_extensions=("sample-extension")
# Extensions are files of the format <dir>/extension_name.sh or <dir>/extension_name/extension_name.sh
Expand All @@ -541,6 +541,7 @@ function enable_all_extensions_builtin_and_user() {
# loop over the files found; remove the prefix
for extension_file in "${extension_list[@]}"; do
extension_file="${extension_file#${SRC}/}"
extension_file="${extension_file#${USERPATCHES_PATH}/}"
extension_file="${extension_file%.sh}"
extension_name="${extension_file##*/}"
# skip, if extension_name is in the ignore_extensions array
Expand Down

0 comments on commit 08dc5b5

Please sign in to comment.