mirror of
https://github.com/armbian/build.git
synced 2025-08-11 21:56:58 +02:00
- artifacts: introduce `ARTIFACT_IGNORE_CACHE=yes` - artifacts: introduce `DONT_BUILD_ARTIFACTS`, list of artifacts that if not found cached, fail the build - kernel_package_source() is no more - a long dissertation about kernels, families, and the universe - artifacts: actually use rootfs artifact for image build - artifacts: detangle via artifact_base_dir - artifacts: rootfs: use folders in artifact_name; include cache_type - artifacts: some cleanups / validations - rootfs artifact; drop old rootfs cli - artifacts: new CLI shortcuts; remove old firmware CLI - artifacts: full firmware & usage - use firmware artifacts in image build and install its debs - kernel artifact sans legacy; use tmpdir for .deb target for all packages - legacy artifact versions is no more; pack/unpack now in common obtain; - artifacts: uboot: cleanup legacy renaming, use artifact version directly - artifacts: add firmware (small) artifact - deploy uboot to loop from artifact; allow tty to artifact; todos for cleaning - fixes, kernel dtb/headers conditional; remove `.git` from Makefile url; use mapfile for finding files to hash - completely remove KERNEL_HAS_WORKING_HEADERS_FULL_SOURCE and `kernel_package_callback_linux_headers_full_source()` - don't use realpath for artifact_file_relative - curb some warnings - fix: only install headers & dtbs if such exist - kernel .config hook modification hash versioning - OCI_TARGET_BASE vs per-artifact defaults; only deploy to remote from CLI with OTB - artifact revolver & installing into image - add artifact_map_packages and artifact_map_debs dicts - revolver accumulates all info - REPOSITORY_INSTALL is no more (for uboot/kernel, later others) - rename `VER` to `IMAGE_INSTALLED_KERNEL_VERSION`
56 lines
2.0 KiB
Bash
56 lines
2.0 KiB
Bash
function calculate_hash_for_all_files_in_dirs() {
|
|
declare -a dirs_to_hash=("$@")
|
|
declare -a files_to_hash=()
|
|
for dir in "${dirs_to_hash[@]}"; do
|
|
# skip if dir doesn't exist...
|
|
if [[ ! -d "${dir}" ]]; then
|
|
display_alert "calculate_hash_for_all_files_in_dirs" "skipping non-existent dir \"${dir}\"" "debug"
|
|
continue
|
|
fi
|
|
mapfile -t files_in_dir < <(find -L "${dir}" -type f)
|
|
if [[ ${#files_in_dir[@]} -eq 0 ]]; then
|
|
display_alert "calculate_hash_for_all_files_in_dirs" "empty dir \"${dir}\"" "debug"
|
|
continue
|
|
fi
|
|
files_to_hash+=("${files_in_dir[@]}")
|
|
done
|
|
|
|
calculate_hash_for_files "${files_to_hash[@]}"
|
|
}
|
|
|
|
function calculate_hash_for_files() {
|
|
hash_files="undetermined" # outer scope
|
|
|
|
# relativize the files to SRC
|
|
declare -a files_to_hash=("$@")
|
|
declare -a files_to_hash_relativized=()
|
|
for file in "${files_to_hash[@]}"; do
|
|
# remove the SRC/ from the file name
|
|
file="${file#${SRC}/}"
|
|
files_to_hash_relativized+=("${file}")
|
|
done
|
|
|
|
# sort the array files_to_hash; use sort and readfile
|
|
declare -a files_to_hash_sorted
|
|
mapfile -t files_to_hash_sorted < <(for one in "${files_to_hash_relativized[@]}"; do echo "${one}"; done | LC_ALL=C sort -h) # "human" sorting
|
|
|
|
display_alert "calculate_hash_for_files:" "files_to_hash_sorted: ${files_to_hash_sorted[*]}" "debug"
|
|
|
|
# if the array is empty, then there is nothing to hash. return 16 zeros
|
|
if [[ ${#files_to_hash_sorted[@]} -eq 0 ]]; then
|
|
display_alert "calculate_hash_for_files:" "files_to_hash_sorted is empty" "debug"
|
|
hash_files="0000000000000000"
|
|
return 0
|
|
fi
|
|
|
|
declare full_hash
|
|
full_hash="$(cd "${SRC}" && sha256sum "${files_to_hash_sorted[@]}")"
|
|
hash_files="$(echo "${full_hash}" | sha256sum | cut -d' ' -f1)" # hash of hashes
|
|
hash_files="${hash_files:0:16}" # shorten it to 16 characters
|
|
|
|
if [[ "${SHOW_DEBUG}" == "yes" ]]; then
|
|
display_alert "Hash for files:" "$hash_files" "debug"
|
|
display_alert "Full hash input for files:" "\n${full_hash}\n" "debug"
|
|
fi
|
|
}
|