mirror of
https://github.com/armbian/build.git
synced 2026-01-06 09:58:46 -08:00
Ubuntu 25.04+ replaced GNU coreutils with uutils coreutils, a Rust-based reimplementation of Unix core utilities. These are different projects with the same package name: - GNU coreutils 9.x (C) - Ubuntu ≤24.04 - uutils coreutils 0.x (Rust) - Ubuntu ≥25.04 The uutils comm doesn't recognize sort output as sorted, causing "comm: file is not in sorted order" errors. Replace comm patterns with: - grep -vxFf for set difference (lines in B but not in A) - sort | uniq -d for finding duplicates These alternatives don't depend on comm, ensuring compatibility with both GNU and uutils coreutils.
34 lines
1.2 KiB
Bash
34 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Copyright (c) 2013-2026 Igor Pecovnik, igor@armbian.com
|
|
#
|
|
# This file is a part of the Armbian Build Framework
|
|
# https://github.com/armbian/build/
|
|
|
|
function do_capturing_defs() {
|
|
# make sure to local with a value, otherwise they will appear in the list...
|
|
declare pre_exec_vars="" post_exec_vars="" new_vars_list="" onevar="" all_vars_array=()
|
|
pre_exec_vars="$(compgen -A variable)"
|
|
|
|
# run parameters passed. if this fails, so will we, immediately, and not capture anything correctly.
|
|
# if you ever find stacks referring here, please look at the caller and $1
|
|
"$@"
|
|
|
|
post_exec_vars="$(compgen -A variable)"
|
|
|
|
# Avoid comm for uutils coreutils compatibility
|
|
new_vars_list="$(grep -vxFf <(echo "$pre_exec_vars" | grep -E '[[:upper:]]+' | grep -v -e "^BASH_") <(echo "${post_exec_vars}" | grep -E '[[:upper:]]+' | grep -v -e "^BASH_") || true)"
|
|
|
|
for onevar in ${new_vars_list}; do
|
|
all_vars_array+=("$(declare -p "${onevar}")")
|
|
done
|
|
|
|
declare -g CAPTURED_VARS_NAMES="${new_vars_list}"
|
|
declare -ga CAPTURED_VARS_ARRAY=("${all_vars_array[@]}")
|
|
unset all_vars_array post_exec_vars new_vars_list pre_exec_vars onevar
|
|
|
|
return 0 # return success explicitly , preemptively preventing short-circuit problems.
|
|
}
|