mirror of
https://github.com/armbian/build.git
synced 2025-09-01 03:41:08 +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`
111 lines
4.5 KiB
Bash
111 lines
4.5 KiB
Bash
# general_cleaning <target>
|
|
|
|
# target: what to clean
|
|
# "make-atf" = make clean for ATF, if it is built.
|
|
# "make-uboot" = make clean for uboot, if it is built.
|
|
# "make-kernel" = make clean for kernel, if it is built. very slow.
|
|
# *important*: "make" by itself has disabled, since Armbian knows how to handle Make timestamping now.
|
|
|
|
# "debs" = delete packages in "./output/debs" for current branch and family. causes rebuilds, hopefully cached.
|
|
# "ubootdebs" - delete output/debs for uboot&board&branch
|
|
# "alldebs" = delete all packages in "./output/debs"
|
|
# "images" = delete "./output/images"
|
|
# "cache" = delete "./output/cache"
|
|
# "sources" = delete "./sources"
|
|
# "oldcache" = remove old cached rootfs except for the newest 8 files
|
|
|
|
function general_cleaning() {
|
|
display_alert "Cleaning" "general_cleaning '$1' - NOT" "warn"
|
|
return 0
|
|
|
|
case $1 in
|
|
debs) # delete ${DEB_STORAGE} for current branch and family
|
|
# @TODO: this is completely obsolete with artifacts?
|
|
if [[ -d "${DEB_STORAGE}" ]]; then
|
|
display_alert "Cleaning ${DEB_STORAGE} for" "$BOARD $BRANCH" "info"
|
|
# easier than dealing with variable expansion and escaping dashes in file names
|
|
find "${DEB_STORAGE}" -name "${CHOSEN_UBOOT}_*.deb" -delete
|
|
find "${DEB_STORAGE}" \( -name "${CHOSEN_KERNEL}_*.deb" -o \
|
|
-name "armbian-*.deb" -o \
|
|
-name "plymouth-theme-armbian_*.deb" -o \
|
|
-name "${CHOSEN_KERNEL/image/dtb}_*.deb" -o \
|
|
-name "${CHOSEN_KERNEL/image/headers}_*.deb" -o \
|
|
-name "${CHOSEN_KERNEL/image/source}_*.deb" -o \
|
|
-name "${CHOSEN_KERNEL/image/firmware-image}_*.deb" \) -delete
|
|
[[ -n $RELEASE ]] && rm -f "${DEB_STORAGE}/${RELEASE}/${CHOSEN_ROOTFS}"_*.deb
|
|
[[ -n $RELEASE ]] && rm -f "${DEB_STORAGE}/${RELEASE}/armbian-desktop-${RELEASE}"_*.deb
|
|
fi
|
|
;;
|
|
|
|
ubootdebs) # delete ${DEB_STORAGE} for uboot, current branch and family
|
|
if [[ -d "${DEB_STORAGE}" ]]; then
|
|
display_alert "Cleaning ${DEB_STORAGE} for u-boot" "$BOARD $BRANCH" "info"
|
|
# easier than dealing with variable expansion and escaping dashes in file names
|
|
find "${DEB_STORAGE}" -name "${CHOSEN_UBOOT}_*.deb" -delete
|
|
fi
|
|
;;
|
|
|
|
extras) # delete ${DEB_STORAGE}/extra/$RELEASE for all architectures
|
|
if [[ -n $RELEASE && -d ${DEB_STORAGE}/extra/$RELEASE ]]; then
|
|
display_alert "Cleaning ${DEB_STORAGE}/extra for" "$RELEASE" "info"
|
|
rm -rf "${DEB_STORAGE}/extra/${RELEASE}"
|
|
fi
|
|
;;
|
|
|
|
alldebs) # delete output/debs
|
|
[[ -d "${DEB_STORAGE}" ]] && display_alert "Cleaning" "${DEB_STORAGE}" "info" && rm -rf "${DEB_STORAGE:?}"/*
|
|
;;
|
|
|
|
cache) # delete output/cache
|
|
[[ -d "${SRC}"/cache/rootfs ]] && display_alert "Cleaning" "rootfs cache (all)" "info" && find "${SRC}"/cache/rootfs -type f -delete
|
|
;;
|
|
|
|
images) # delete output/images
|
|
[[ -d "${DEST}"/images ]] && display_alert "Cleaning" "output/images" "info" && rm -rf "${DEST}"/images/*
|
|
;;
|
|
|
|
sources) # delete cache/sources and output/buildpkg
|
|
[[ -d "${SRC}"/cache/sources ]] && display_alert "Cleaning" "sources" "info" && rm -rf "${SRC}"/cache/sources/* "${DEST}"/buildpkg/*
|
|
;;
|
|
|
|
oldcache) # remove old `cache/rootfs` except for the newest 8 files
|
|
if [[ -d "${SRC}"/cache/rootfs && $(ls -1 "${SRC}"/cache/rootfs/*.zst* 2> /dev/null | wc -l) -gt "${ROOTFS_CACHE_MAX}" ]]; then
|
|
display_alert "Cleaning" "rootfs cache (old)" "info"
|
|
(
|
|
cd "${SRC}"/cache/rootfs
|
|
ls -t *.lz4 | sed -e "1,${ROOTFS_CACHE_MAX}d" | xargs -d '\n' rm -f
|
|
)
|
|
# Remove signatures if they are present. We use them for internal purpose
|
|
(
|
|
cd "${SRC}"/cache/rootfs
|
|
ls -t *.asc | sed -e "1,${ROOTFS_CACHE_MAX}d" | xargs -d '\n' rm -f
|
|
)
|
|
fi
|
|
;;
|
|
|
|
*)
|
|
display_alert "Unknown clean level" "Unknown clean level '${1}'" "warn"
|
|
;;
|
|
esac
|
|
|
|
return 0 # a LOT of shortcircuits above; prevent spurious error messages
|
|
}
|
|
|
|
function clean_deprecated_mountpoints() {
|
|
# Cleaning of old, deprecated mountpoints; only done if not running under Docker.
|
|
# mountpoints under Docker manifest as volumes, and as such can't be cleaned this way.
|
|
if [[ "${ARMBIAN_RUNNING_IN_CONTAINER}" != "yes" ]]; then
|
|
prepare_armbian_mountpoints_description_dict
|
|
local mountpoint=""
|
|
for mountpoint in "${ARMBIAN_MOUNTPOINTS_DEPRECATED[@]}"; do
|
|
local mountpoint_dir="${SRC}/${mountpoint}"
|
|
display_alert "Considering cleaning deprecated mountpoint" "${mountpoint_dir}" "debug"
|
|
if [[ -d "${mountpoint_dir}" ]]; then
|
|
display_alert "Cleaning deprecated mountpoint" "${mountpoint_dir}" "info"
|
|
run_host_command_logged rm -rf "${mountpoint_dir}"
|
|
fi
|
|
done
|
|
fi
|
|
return 0
|
|
}
|