config/lib/exts: run shellfmt

- `bash lib/tools/shellfmt.sh`
- mostly spacing changes that accumulated over time
This commit is contained in:
Ricardo Pardini
2023-08-22 13:32:09 +02:00
parent 1d6a779ed1
commit 11df81403d
17 changed files with 57 additions and 59 deletions

View File

@@ -46,8 +46,8 @@ function add_host_dependencies__k3_python3_dep() {
function compile_k3_bootgen() {
# Source code checkout
( fetch_from_repo "https://git.ti.com/cgit/processor-firmware/ti-linux-firmware" "ti-linux-firmware" "branch:ti-linux-firmware" )
( fetch_from_repo "https://git.ti.com/cgit/ti-u-boot/ti-u-boot" "ti-u-boot" "branch:ti-u-boot-2023.04" )
(fetch_from_repo "https://git.ti.com/cgit/processor-firmware/ti-linux-firmware" "ti-linux-firmware" "branch:ti-linux-firmware")
(fetch_from_repo "https://git.ti.com/cgit/ti-u-boot/ti-u-boot" "ti-u-boot" "branch:ti-u-boot-2023.04")
pushd ${SRC}/cache/sources/ti-u-boot || exit

View File

@@ -80,22 +80,22 @@ function post_uboot_custom_postprocess__build_fip() {
return 0
}
function pre_package_kernel_image__copy_meson_s4t7_overlays(){
display_alert "Copy meson s4t7 overlays"
declare dtbo_destination="${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}"/amlogic
function pre_package_kernel_image__copy_meson_s4t7_overlays() {
display_alert "Copy meson s4t7 overlays"
declare dtbo_destination="${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}"/amlogic
run_host_command_logged cp -r ${SRC}/patch/kernel/${KERNELPATCHDIR}/overlay ${dtbo_destination}/
run_host_command_logged cp -r ${SRC}/patch/kernel/${KERNELPATCHDIR}/overlay ${dtbo_destination}/
display_alert "Enable Device Tree Overlays"
run_host_command_logged ln -sf amlogic/overlay "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}"/overlay
display_alert "Enable Device Tree Overlays"
run_host_command_logged ln -sf amlogic/overlay "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}"/overlay
}
function post_family_tweaks_bsp__disable_uinitrd_generation(){
if [[ -f "${destination}"/etc/initramfs/post-update.d/99-uboot ]] ; then
function post_family_tweaks_bsp__disable_uinitrd_generation() {
if [[ -f "${destination}"/etc/initramfs/post-update.d/99-uboot ]]; then
run_host_command_logged rm "${destination}"/etc/initramfs/post-update.d/99-uboot
fi
}
function pre_update_initramfs__change_initrd_compression(){
run_host_command_logged sed -i 's/COMPRESS=.*/COMPRESS=xz/g' $MOUNT/etc/initramfs-tools/initramfs.conf
}
function pre_update_initramfs__change_initrd_compression() {
run_host_command_logged sed -i 's/COMPRESS=.*/COMPRESS=xz/g' $MOUNT/etc/initramfs-tools/initramfs.conf
}

View File

@@ -27,7 +27,7 @@ case $BRANCH in
;;
current|edge)
current | edge)
SKIP_BOOTSPLASH="yes"
;;

View File

@@ -28,11 +28,11 @@ case "${BRANCH}" in
KERNELPATCHDIR="thead-${BRANCH}"
LINUXCONFIG="linux-thead-${BRANCH}"
;;
;;
esac
write_uboot_platform() {
echo "Please manually use fastboot to write u-boot."
echo "Please manually use fastboot to write u-boot."
}

View File

@@ -22,7 +22,7 @@ function pre_install_kernel_debs__adjust_dropbear_configuration() {
declare dropbear_dir="${SDCARD}/etc/dropbear-initramfs"
declare dropbear_config="config"
if [[ -d "${SDCARD}/etc/dropbear/initramfs" ]] ; then
if [[ -d "${SDCARD}/etc/dropbear/initramfs" ]]; then
dropbear_dir="${SDCARD}/etc/dropbear/initramfs"
dropbear_config="dropbear.conf"
fi

View File

@@ -15,4 +15,3 @@ function pre_update_initramfs__add_module_into_initramfs_config() {
echo "nilfs2" >> "$MOUNT"/etc/initramfs-tools/modules
return 0
}

View File

@@ -94,7 +94,7 @@ function cli_entrypoint() {
if [[ "${ARMBIAN_BUILD_UUID}" != "" ]]; then
display_alert "Using passed-in ARMBIAN_BUILD_UUID" "${ARMBIAN_BUILD_UUID}" "debug"
else
if command -v uuidgen 1>/dev/null; then
if command -v uuidgen 1> /dev/null; then
ARMBIAN_BUILD_UUID="$(uuidgen)"
else
display_alert "uuidgen not found" "uuidgen not installed yet" "info"

View File

@@ -39,7 +39,7 @@ function run_kernel_make_internal() {
"${DISTCC_MAKE_J_PARALLEL[@]}" # Parallel compile, "-j X" for X cpus; determined by distcc, or is just "$CTHREADS" if distcc is not enabled.
"ARCH=${ARCHITECTURE}" # Key param. Everything depends on this.
"ARCH=${ARCHITECTURE}" # Key param. Everything depends on this.
"LOCALVERSION=-${BRANCH}-${LINUXFAMILY}" # Change the internal kernel version to include the family. Changing this causes recompiles # @TODO change hack at .config; that might handles mtime better
"CROSS_COMPILE=${CCACHE} ${DISTCC_CROSS_COMPILE_PREFIX[@]} ${KERNEL_COMPILER}" # added as prefix to every compiler invocation by make

View File

@@ -146,7 +146,7 @@ function kernel_prepare_build_and_package() {
LOG_SECTION="kernel_package" do_with_logging do_with_hooks kernel_package
done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early
done_with_temp_dir "${cleanup_id}" # changes cwd to "${SRC}" and fires the cleanup function early
}
function kernel_build() {
@@ -168,4 +168,3 @@ function kernel_package() {
prepare_kernel_packaging_debs "${kernel_work_dir}" "${kernel_dest_install_dir}" "${version}" kernel_install_dirs
display_alert "Kernel packaged in" "$((SECONDS - ts)) seconds - ${version}-${LINUXFAMILY}" "info"
}

View File

@@ -110,7 +110,7 @@ function fakeroot_dpkg_deb_build() {
deb_final_dir=$(dirname "${deb_final_filename}")
mkdir -p "${deb_final_dir}"
display_alert "Building package, this might take a while.." "${deb_final_filename/*\//}" info
display_alert "Building package, this might take a while.." "${deb_final_filename/*\//}" info
run_host_command_logged_raw fakeroot dpkg-deb -b "-Z${DEB_COMPRESS}" "${package_directory}" "${deb_final_filename}"
}

View File

@@ -11,7 +11,7 @@ function driver_generic_bring_back_ipx() {
#
# Returning headers needed for some wireless drivers
#
if linux-version compare "${version}" ge 5.4 ; then
if linux-version compare "${version}" ge 5.4; then
display_alert "Reverting upstream-removed" "IPX stuff needed for Wireless Drivers" "info"
process_patch_file "${SRC}/patch/misc/wireless-bring-back-headers.patch" "applying"
fi
@@ -20,14 +20,14 @@ function driver_generic_bring_back_ipx() {
driver_mt7921u_add_pids() {
# Add two popular cheap USB devices to the table
if linux-version compare "${version}" ge 6.1 && linux-version compare "${version}" lt 6.2; then
display_alert "Mediatek MT7921u" "Add Comfast CF952A and Netgear AXE3000" "info"
process_patch_file "${SRC}/patch/misc/wireless-mt7921u-add-pids.patch" "applying"
fi
display_alert "Mediatek MT7921u" "Add Comfast CF952A and Netgear AXE3000" "info"
process_patch_file "${SRC}/patch/misc/wireless-mt7921u-add-pids.patch" "applying"
fi
}
driver_rtl8152_rtl8153() {
# Updated USB network drivers for RTL8152/RTL8153 based dongles that also support 2.5Gbs variants
if linux-version compare "${version}" ge 5.4 && linux-version compare "${version}" le 5.12 && [ "$LINUXFAMILY" != mvebu64 ] && [ "$LINUXFAMILY" != rk322x ] && [ "$LINUXFAMILY" != odroidxu4 ] ; then
if linux-version compare "${version}" ge 5.4 && linux-version compare "${version}" le 5.12 && [ "$LINUXFAMILY" != mvebu64 ] && [ "$LINUXFAMILY" != rk322x ] && [ "$LINUXFAMILY" != odroidxu4 ]; then
# attach to specifics tag or branch
local rtl8152ver="branch:master"
@@ -43,7 +43,7 @@ driver_rtl8152_rtl8153() {
driver_rtl8189ES() {
# Wireless drivers for Realtek 8189ES chipsets
if linux-version compare "${version}" ge 3.14 ; then
if linux-version compare "${version}" ge 3.14; then
# attach to specifics tag or branch
local rtl8189esver="branch:master"
@@ -90,7 +90,7 @@ driver_rtl8189FS() {
# Wireless drivers for Realtek 8189FS chipsets
if linux-version compare "${version}" ge 3.14 ; then
if linux-version compare "${version}" ge 3.14; then
# attach to specifics tag or branch
local rtl8189fsver="branch:rtl8189fs"
@@ -138,7 +138,7 @@ driver_rtl8192EU() {
# Wireless drivers for Realtek 8192EU chipsets
if linux-version compare "${version}" ge 3.14 ; then
if linux-version compare "${version}" ge 3.14; then
# attach to specifics tag or branch
local rtl8192euver="branch:realtek-4.4.x"
@@ -180,7 +180,7 @@ driver_rtl8811_rtl8812_rtl8814_rtl8821() {
# Wireless drivers for Realtek 8811, 8812, 8814 and 8821 chipsets
if linux-version compare "${version}" ge 3.14 ; then
if linux-version compare "${version}" ge 3.14; then
# attach to specifics tag or branch
local rtl8812auver="commit:450db78f7bd23f0c611553eb475fa5b5731d6497"
@@ -230,7 +230,7 @@ driver_xradio_xr819() {
# Wireless drivers for Xradio XR819 chipsets
if linux-version compare "${version}" ge 4.19 && linux-version compare "${version}" le 5.19 &&
[[ "$LINUXFAMILY" == sunxi* ]] ; then
[[ "$LINUXFAMILY" == sunxi* ]]; then
display_alert "Adding" "Wireless drivers for Xradio XR819 chipsets" "info"
@@ -271,7 +271,7 @@ driver_xradio_xr819() {
driver_rtl8811CU_rtl8821C() {
# Wireless drivers for Realtek RTL8811CU and RTL8821C chipsets
if linux-version compare "${version}" ge 3.14 ; then
if linux-version compare "${version}" ge 3.14; then
# attach to specifics tag or branch
local rtl8811cuver="commit:69c903b75bde36293c66b25c051916a74dbadf58"
@@ -324,7 +324,7 @@ driver_rtl8188EU_rtl8188ETV() {
# Wireless drivers for Realtek 8188EU 8188EUS and 8188ETV chipsets
if linux-version compare "${version}" ge 3.14 &&
linux-version compare "${version}" lt 5.15 ; then
linux-version compare "${version}" lt 5.15; then
# attach to specifics tag or branch
local rtl8188euver="branch:v5.7.6.1"
@@ -371,7 +371,7 @@ driver_rtl88x2bu() {
# Wireless drivers for Realtek 88x2bu chipsets
if linux-version compare "${version}" ge 5.0 ; then
if linux-version compare "${version}" ge 5.0; then
# attach to specifics tag or branch
local rtl88x2buver="commit:2590672d717e2516dd2e96ed66f1037a6815bced"
@@ -422,7 +422,7 @@ driver_rtw88() {
# Quite a few kernel families have KERNEL_DRIVERS_SKIP listing this driver. If so, this won't even be called.
# Upstream wireless RTW88 drivers (wireless-next-2023-06-22)
if [[ "$version" == "6.1" || "$version" == "6.2" || "$version" == "6.3" || "$version" == "6.4" ]] ; then
if [[ "$version" == "6.1" || "$version" == "6.2" || "$version" == "6.3" || "$version" == "6.4" ]]; then
display_alert "Adding" "Upstream wireless RTW88 drivers" "info"
process_patch_file "${SRC}/patch/misc/rtw88/${version}/001-drivers-net-wireless-realtek-rtw88-upstream-wireless.patch" "applying"
process_patch_file "${SRC}/patch/misc/rtw88/${version}/002-drivers-net-wireless-realtek-rtw88-upstream-wireless.patch" "applying"
@@ -436,7 +436,7 @@ driver_rtl88x2cs() {
# Wireless drivers for Realtek 88x2cs chipsets
if linux-version compare "${version}" ge 5.9 && linux-version compare "${version}" lt 6.1 ; then
if linux-version compare "${version}" ge 5.9 && linux-version compare "${version}" lt 6.1; then
# attach to specifics tag or branch
local rtl88x2csver="branch:tune_for_jethub"
@@ -480,7 +480,7 @@ driver_rtl88x2cs() {
driver_rtl8822cs_bt() {
# Bluetooth support for Realtek 8822CS (hci_ver 0x8) chipsets
# both of these patches were upstreamed in 5.18
if linux-version compare "${version}" ge 5.11 && linux-version compare "${version}" lt 5.18 ; then
if linux-version compare "${version}" ge 5.11 && linux-version compare "${version}" lt 5.18; then
display_alert "Adding" "Bluetooth support for Realtek 8822CS (hci_ver 0x8) chipsets" "info"
@@ -493,7 +493,7 @@ driver_rtl8822cs_bt() {
driver_rtl8723DS() {
# Wireless drivers for Realtek 8723DS chipsets
if linux-version compare "${version}" ge 5.0 ; then
if linux-version compare "${version}" ge 5.0; then
# attach to specifics tag or branch
local rtl8723dsver="branch:master"
@@ -536,7 +536,7 @@ driver_rtl8723DU() {
# Wireless drivers for Realtek 8723DU chipsets
if linux-version compare "${version}" ge 5.0 ; then
if linux-version compare "${version}" ge 5.0; then
local rtl8723duver="branch:master"
@@ -578,7 +578,7 @@ driver_rtl8723DU() {
driver_rtl8822BS() {
# Wireless drivers for Realtek 8822BS chipsets
if linux-version compare "${version}" ge 4.4 && linux-version compare "${version}" le 5.16 ; then
if linux-version compare "${version}" ge 4.4 && linux-version compare "${version}" le 5.16; then
# attach to specifics tag or branch
display_alert "Adding" "Wireless drivers for Realtek 8822BS chipsets ${rtl8822bsver}" "info"

View File

@@ -46,7 +46,7 @@ function apt_find_upstream_package_version_and_download_url() {
declare package_info_download_url_file
package_info_download_url_file="$(mktemp)"
curl --silent --show-error --max-time 10 "${package_info_download_url}" > "${package_info_download_url_file}" || true # don't fail
declare package_info_download_url_file_package_name # grep the file for the package name. parse "<kbd>name</kbd>"
declare package_info_download_url_file_package_name # grep the file for the package name. parse "<kbd>name</kbd>"
package_info_download_url_file_package_name="$(grep -oP '(?<=<kbd>)[^<]+' "${package_info_download_url_file}" | grep "^${sought_package_name}_" | head -n 1)"
rm -f "${package_info_download_url_file}"

View File

@@ -29,10 +29,10 @@ function prepare_armbian_mountpoints_description_dict() {
)
declare -A -g ARMBIAN_MOUNTPOINTS_DESC_DICT=(
[".tmp"]="docker_kind_linux=anonymous docker_kind_darwin=anonymous" # tmpfs, discard, anonymous; whatever you wanna call it. It just needs to be 100% local to the container, and there's very little value in being able to look at it from the host.
["output"]="docker_kind_linux=bind docker_kind_darwin=bind" # catch-all output. specific subdirs are mounted below. it's a bind mount by default on both Linux and Darwin.
["output/images"]="docker_kind_linux=bind docker_kind_darwin=bind" # 99% of users want this as the result of their build, no matter if it's slow or not. bind on both.
["output/debs"]="docker_kind_linux=bind docker_kind_darwin=bind" # generated output .deb files. most people are interested in this, to update kernels or dtbs after initial build. bind on both Linux and Darwin.
[".tmp"]="docker_kind_linux=anonymous docker_kind_darwin=anonymous" # tmpfs, discard, anonymous; whatever you wanna call it. It just needs to be 100% local to the container, and there's very little value in being able to look at it from the host.
["output"]="docker_kind_linux=bind docker_kind_darwin=bind" # catch-all output. specific subdirs are mounted below. it's a bind mount by default on both Linux and Darwin.
["output/images"]="docker_kind_linux=bind docker_kind_darwin=bind" # 99% of users want this as the result of their build, no matter if it's slow or not. bind on both.
["output/debs"]="docker_kind_linux=bind docker_kind_darwin=bind" # generated output .deb files. most people are interested in this, to update kernels or dtbs after initial build. bind on both Linux and Darwin.
# output/debs-beta ... ! not needed cos "output" is fully mapped above.
["output/logs"]="docker_kind_linux=bind docker_kind_darwin=bind" # log files produced. 100% of users want this. Bind on both Linux and Darwin. Is used to integrate launcher and actual-build logs, so must exist and work otherwise confusion ensues.
["cache"]="docker_kind_linux=bind docker_kind_darwin=namedvolume" # catch-all cache, could be bind-mounted or a volume. On Darwin it's too slow to bind-mount, so it's a volume by default. On Linux, it's a bind-mount by default.

View File

@@ -321,7 +321,7 @@ function adaptative_prepare_host_dependencies() {
fi
if [[ "${wanted_arch}" == "riscv64" || "${wanted_arch}" == "all" ]]; then
host_dependencies+=("gcc-riscv64-linux-gnu") # crossbuild-essential-riscv64 is not even available "yet"
host_dependencies+=("gcc-riscv64-linux-gnu") # crossbuild-essential-riscv64 is not even available "yet"
host_dependencies+=("debian-archive-keyring")
fi

View File

@@ -52,13 +52,13 @@ update_initramfs() {
mkdir -p "${SRC}/cache/initrd"
initrd_cache_current_manifest_filepath="${WORKDIR}/initrd.img-${initrd_kern_ver}.${ARMBIAN_BUILD_UUID}.manifest"
initrd_cache_last_manifest_filepath="${SRC}/cache/initrd/initrd.manifest-${initrd_kern_ver}.last.manifest"
initrd_files_to_hash=( "${chroot_target}/usr/bin/bash" "${chroot_target}/etc/initramfs" )
initrd_files_to_hash+=( "${chroot_target}/etc/initramfs-tools" "${chroot_target}/usr/share/initramfs-tools/" )
initrd_files_to_hash=("${chroot_target}/usr/bin/bash" "${chroot_target}/etc/initramfs")
initrd_files_to_hash+=("${chroot_target}/etc/initramfs-tools" "${chroot_target}/usr/share/initramfs-tools/")
if [[ $CRYPTROOT_ENABLE == yes ]]; then
if [[ $CRYPTROOT_SSH_UNLOCK == yes ]]; then
[[ -d "${chroot_target}/etc/dropbear-initramfs/" ]] && initrd_files_to_hash+=( "${chroot_target}/etc/dropbear-initramfs/" )
[[ -d "${chroot_target}/etc/dropbear/initramfs/" ]] && initrd_files_to_hash+=( "${chroot_target}/etc/dropbear/initramfs/" )
[[ -d "${chroot_target}/etc/dropbear-initramfs/" ]] && initrd_files_to_hash+=("${chroot_target}/etc/dropbear-initramfs/")
[[ -d "${chroot_target}/etc/dropbear/initramfs/" ]] && initrd_files_to_hash+=("${chroot_target}/etc/dropbear/initramfs/")
fi
fi
@@ -80,7 +80,7 @@ update_initramfs() {
if [[ -f "${initrd_cache_file_path}" ]]; then
display_alert "initrd cache hit" "${initrd_cache_key}" "cachehit"
run_host_command_logged cp -v "${initrd_cache_file_path}" "${initrd_file}" # don't (-p)reserve, otherwise fat32 /boot gags
touch "${initrd_cache_file_path}" # touch cached file timestamp; LRU bump.
touch "${initrd_cache_file_path}" # touch cached file timestamp; LRU bump.
if [[ -f "${initrd_cache_last_manifest_filepath}" ]]; then
touch "${initrd_cache_last_manifest_filepath}" # touch the manifest file timestamp; LRU bump.
fi

View File

@@ -16,7 +16,7 @@ function display_alert() {
poor_man_profiler
fi
echo -e "${extra_profiler}${3}::${1} ${2}" | sed 's/\x1b\[[0-9;]*m//g' | sed -z 's|\n|\\n|g' >&2 # remove ANSI colors and newlines
echo "" >&2 # newline
echo "" >&2 # newline
return 0
fi

View File

@@ -160,11 +160,11 @@ function create_sources_list_and_deploy_repo_key() {
#deb-src http://${DEBIAN_MIRROR} unstable main contrib non-free non-free-firmware
EOF
# Exception: with riscv64 not everything was moved from ports
# https://lists.debian.org/debian-riscv/2023/07/msg00053.html
if [[ "${ARCH}" == riscv64 ]]; then
echo "deb http://deb.debian.org/debian-ports/ sid main " >> "${basedir}"/etc/apt/sources.list
fi
# Exception: with riscv64 not everything was moved from ports
# https://lists.debian.org/debian-riscv/2023/07/msg00053.html
if [[ "${ARCH}" == riscv64 ]]; then
echo "deb http://deb.debian.org/debian-ports/ sid main " >> "${basedir}"/etc/apt/sources.list
fi
;;
focal | jammy | kinetic | lunar)