ソースを参照

shellfmt/.editorconfig: enable trim whitespaces, run shellfmt, no actual code changes (#4849)

- shellfmt: bump to 3.6.0 (run with `bash lib/tools/shellfmt.sh`)
- .editorconfig: rationalize, remove duplicated logic
Ricardo Pardini 2 年 前
コミット
2f7423d0e4

+ 8 - 15
.editorconfig

@@ -8,9 +8,12 @@ charset = utf-8
 end_of_line = lf
 indent_style = tab
 indent_size = 8
-trim_trailing_whitespace = false
+trim_trailing_whitespace = true
 insert_final_newline = true
 
+[*.patch]
+trim_trailing_whitespace = false
+
 [*.md]
 indent_style = space
 indent_size = 4
@@ -19,12 +22,9 @@ insert_final_newline = false
 [*.json]
 indent_style = space
 indent_size = 4
-trim_trailing_whitespace = false
-insert_final_newline = true
 
 # Custom Armbian formatting for bash sources and configuration
 [*.{sh,inc,conf,eos,wip,tvb,csc}]
-indent_style = tab
 indent_size = 4
 shell_variant = bash
 binary_next_line = false
@@ -33,18 +33,11 @@ space_redirects = true
 keep_padding = false
 function_next_line = false
 
-# C coding style based on Linux kernel.
-# https://www.kernel.org/doc/html/v5.0/process/coding-style.html
-
-[*.c]
-indent_style = tab
-indent_size = 8
-
-[*.h]
-indent_style = tab
-indent_size = 8
-
 [*.{yaml,yml}]
 indent_style = space
 indent_size = 2
 insert_final_newline = false
+
+[*.py]
+indent_size = 4
+max_line_length = 150

+ 1 - 1
compile.sh

@@ -7,7 +7,7 @@
 # warranty of any kind, whether express or implied.
 #
 # This file is a part of the Armbian build script
-# https://github.com/armbian/build/  
+# https://github.com/armbian/build/
 
 # DO NOT EDIT THIS FILE
 # use configuration files like config-default.conf to set the build configuration

+ 1 - 2
config/sources/families/starfive.conf

@@ -11,6 +11,5 @@ case "${BRANCH}" in
 		;;
 
 esac
- 
-KERNELPATCHDIR="archive/starfive-${KERNEL_MAJOR_MINOR}" # Don't use symlinks.
 
+KERNELPATCHDIR="archive/starfive-${KERNEL_MAJOR_MINOR}" # Don't use symlinks.

+ 1 - 1
extensions/flash-kernel.sh

@@ -15,7 +15,7 @@ function extension_prepare_config__prepare_flash_kernel() {
 	export BOOTSIZE=0                                                           # No separate /boot, flash-kernel will "flash" the kernel+initrd to the firmware part.
 	export UEFI_MOUNT_POINT="/boot/firmware"                                    # mount uefi partition at /boot/firmware
 	export CLOUD_INIT_CONFIG_LOCATION="/boot/firmware"                          # use /boot/firmware for cloud-init as well
-	export IMAGE_INSTALLED_KERNEL_VERSION="${FK__PUBLISHED_KERNEL_VERSION}"                                # For the VERSION
+	export IMAGE_INSTALLED_KERNEL_VERSION="${FK__PUBLISHED_KERNEL_VERSION}"     # For the VERSION
 	export EXTRA_BSP_NAME="${EXTRA_BSP_NAME}-fk${FK__PUBLISHED_KERNEL_VERSION}" # Unique bsp name.
 }
 

+ 1 - 1
lib/functions/artifacts/artifacts-registry.sh

@@ -3,7 +3,7 @@ function armbian_register_artifacts() {
 	declare -g -A ARMBIAN_ARTIFACTS_TO_HANDLERS_DICT=(
 		# deb-tar
 		["kernel"]="kernel"
-		
+
 		# deb
 		["u-boot"]="uboot"
 		["uboot"]="uboot"

+ 0 - 1
lib/functions/compilation/kernel-git-bundle.sh

@@ -38,7 +38,6 @@ function download_git_kernel_bundle() {
 	return 0
 }
 
-
 function kernel_download_bundle_with_axel() {
 	display_alert "Downloading Kernel bundle" "${bundle_type}; this might take a long time" "info"
 	declare -a verbose_params=()

+ 1 - 1
lib/functions/compilation/packages/armbian-config-deb.sh

@@ -50,6 +50,6 @@ compile_armbian-config() {
 
 	run_host_command_logged rsync --remove-source-files -r "${tmp_dir}/${armbian_config_dir}.deb" "${DEB_STORAGE}/"
 
-	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
 
 }

+ 21 - 38
lib/functions/compilation/patch/drivers_network.sh

@@ -10,8 +10,7 @@ function driver_generic_bring_back_ipx() {
 	fi
 }
 
-driver_rtl8152_rtl8153()
-{
+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 ] && [ "$EXTRAWIFI" == yes ]; then
 
@@ -26,8 +25,7 @@ driver_rtl8152_rtl8153()
 	fi
 }
 
-driver_rtl8189ES()
-{
+driver_rtl8189ES() {
 	# Wireless drivers for Realtek 8189ES chipsets
 
 	if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
@@ -66,9 +64,7 @@ driver_rtl8189ES()
 	fi
 }
 
-driver_rtl8189FS()
-{
-
+driver_rtl8189FS() {
 
 	# Wireless drivers for Realtek 8189FS chipsets
 
@@ -109,8 +105,7 @@ driver_rtl8189FS()
 
 }
 
-driver_rtl8192EU()
-{
+driver_rtl8192EU() {
 
 	# Wireless drivers for Realtek 8192EU chipsets
 
@@ -149,8 +144,7 @@ driver_rtl8192EU()
 	fi
 }
 
-driver_rtl8811_rtl8812_rtl8814_rtl8821()
-{
+driver_rtl8811_rtl8812_rtl8814_rtl8821() {
 
 	# Wireless drivers for Realtek 8811, 8812, 8814 and 8821 chipsets
 
@@ -185,8 +179,7 @@ driver_rtl8811_rtl8812_rtl8814_rtl8821()
 
 }
 
-driver_xradio_xr819()
-{
+driver_xradio_xr819() {
 
 	# Wireless drivers for Xradio XR819 chipsets
 	if linux-version compare "${version}" ge 4.19 && linux-version compare "${version}" le 5.19 &&
@@ -228,8 +221,7 @@ driver_xradio_xr819()
 
 }
 
-driver_rtl8811CU_rtl8821C()
-{
+driver_rtl8811CU_rtl8821C() {
 	# Wireless drivers for Realtek RTL8811CU and RTL8821C chipsets
 
 	if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
@@ -276,8 +268,7 @@ driver_rtl8811CU_rtl8821C()
 
 }
 
-driver_rtl8188EU_rtl8188ETV()
-{
+driver_rtl8188EU_rtl8188ETV() {
 
 	# Wireless drivers for Realtek 8188EU 8188EUS and 8188ETV chipsets
 
@@ -326,8 +317,7 @@ driver_rtl8188EU_rtl8188ETV()
 	fi
 }
 
-driver_rtl88x2bu()
-{
+driver_rtl88x2bu() {
 
 	# Wireless drivers for Realtek 88x2bu chipsets
 
@@ -371,12 +361,11 @@ driver_rtl88x2bu()
 
 }
 
-driver_rtl88x2cs()
-{
+driver_rtl88x2cs() {
 
 	# Wireless drivers for Realtek 88x2cs chipsets
 
-	if linux-version compare "${version}" ge 5.9 && [ "$EXTRAWIFI" == yes ] ; then
+	if linux-version compare "${version}" ge 5.9 && [ "$EXTRAWIFI" == yes ]; then
 
 		# attach to specifics tag or branch
 		local rtl88x2csver="branch:tune_for_jethub"
@@ -417,8 +406,7 @@ driver_rtl88x2cs()
 	fi
 }
 #_bt for blueteeth
-driver_rtl8822cs_bt()
-{
+driver_rtl8822cs_bt() {
 	# Bluetooth support for Realtek 8822CS (hci_ver 0x8) chipsets
 	# For sunxi, these two patches are applied in a series.
 	if linux-version compare "${version}" ge 5.11 && [[ "$LINUXFAMILY" != sunxi* ]]; then
@@ -431,8 +419,7 @@ driver_rtl8822cs_bt()
 	fi
 }
 
-driver_rtl8723DS()
-{
+driver_rtl8723DS() {
 	# Wireless drivers for Realtek 8723DS chipsets
 
 	if linux-version compare "${version}" ge 5.0 && [[ "$EXTRAWIFI" == yes ]]; then
@@ -474,8 +461,7 @@ driver_rtl8723DS()
 	fi
 }
 
-driver_rtl8723DU()
-{
+driver_rtl8723DU() {
 
 	# Wireless drivers for Realtek 8723DU chipsets
 
@@ -514,8 +500,7 @@ driver_rtl8723DU()
 	fi
 }
 
-driver_rtl8822BS()
-{
+driver_rtl8822BS() {
 	# Wireless drivers for Realtek 8822BS chipsets
 
 	if linux-version compare "${version}" ge 4.4 && linux-version compare "${version}" le 5.16 && [ "$EXTRAWIFI" == yes ]; then
@@ -555,8 +540,7 @@ driver_rtl8822BS()
 
 }
 
-driver_uwe5622_allwinner()
-{
+driver_uwe5622_allwinner() {
 	# Unisoc uwe5622 wireless Support
 	if linux-version compare "${version}" ge 4.4 && linux-version compare "${version}" le 6.2 && [[ "$LINUXFAMILY" == sunxi* || "$LINUXFAMILY" == rockchip64 ]]; then
 		display_alert "Adding" "Drivers for Unisoc uwe5622 found on some Allwinner and Rockchip boards" "info"
@@ -565,13 +549,13 @@ driver_uwe5622_allwinner()
 		process_patch_file "${SRC}/patch/misc/wireless-driver-for-uwe5622-allwinner-bugfix.patch" "applying"
 		process_patch_file "${SRC}/patch/misc/wireless-driver-for-uwe5622-warnings.patch" "applying"
 
-                # Add to section Makefile
-                echo "obj-\$(CONFIG_SPARD_WLAN_SUPPORT) += uwe5622/" >> "$kerneldir/drivers/net/wireless/Makefile"
+		# Add to section Makefile
+		echo "obj-\$(CONFIG_SPARD_WLAN_SUPPORT) += uwe5622/" >> "$kerneldir/drivers/net/wireless/Makefile"
 
 		if linux-version compare "${version}" lt 6.1; then
 			process_patch_file "${SRC}/patch/misc/wireless-driver-for-uwe5622-park-link-pre-v6.1.patch" "applying"
 		fi
-		
+
 		if linux-version compare "${version}" ge 6.1; then
 			process_patch_file "${SRC}/patch/misc/wireless-driver-for-uwe5622-park-link-v6.1-post.patch" "applying"
 			process_patch_file "${SRC}/patch/misc/wireless-driver-for-uwe5622-v6.1.patch" "applying"
@@ -579,10 +563,9 @@ driver_uwe5622_allwinner()
 	fi
 }
 
-patch_drivers_network()
-{
+patch_drivers_network() {
 	display_alert "Patching network related drivers"
-	
+
 	driver_generic_bring_back_ipx
 	driver_rtl8152_rtl8153
 	driver_rtl8189ES

+ 3 - 4
lib/functions/compilation/patch/kernel-drivers.sh

@@ -1,7 +1,7 @@
-# @TODO: armbian-next: THIS IS DEAD CODE. no-one calls it. a JIRA for volunteers to fix it, or it will be removed. 
+# @TODO: armbian-next: THIS IS DEAD CODE. no-one calls it. a JIRA for volunteers to fix it, or it will be removed.
 
 function prepare_extra_kernel_drivers() {
-	
+
 	source ${SRC}/lib/functions/compilation/patch/drivers_network.sh
 
 	# Packaging patch for modern kernels should be one for all.
@@ -181,7 +181,6 @@ function prepare_extra_kernel_drivers() {
 		if linux-version compare "${version}" ge 5.15.41 && linux-version compare "${version}" le 5.16; then aufstag="5.15.41"; fi
 		if linux-version compare "${version}" ge 5.17.3 && linux-version compare "${version}" le 5.18; then aufstag="5.17.3"; fi
 
-
 		# check if Mr. Okajima already made a branch for this version
 		improved_git ls-remote --exit-code --heads $GITHUB_SOURCE/sfjro/aufs5-standalone "aufs${aufstag}" > /dev/null
 
@@ -235,7 +234,7 @@ function prepare_extra_kernel_drivers() {
 			"$kerneldir/scripts/package/builddeb"
 
 	fi
-		
+
 	patch_drivers_network
 
 	# Exfat driver

+ 3 - 3
lib/functions/host/apt-cacher-ng.sh

@@ -1,8 +1,8 @@
 # Management of apt-cacher-ng aka acng
 
 function acng_configure_and_restart_acng() {
-	if ! armbian_is_host_running_systemd; then return 0; fi                   # do nothing if host is not running systemd
-	[[ "${MANAGE_ACNG}" != "yes" ]] && return 0                               # don't if told not to. NO_something=yes is very confusing, but kept for historical reasons
+	if ! armbian_is_host_running_systemd; then return 0; fi # do nothing if host is not running systemd
+	[[ "${MANAGE_ACNG}" != "yes" ]] && return 0             # don't if told not to. NO_something=yes is very confusing, but kept for historical reasons
 
 	display_alert "Preparing acng configuration" "apt-cacher-ng" "info"
 
@@ -54,7 +54,7 @@ function acng_configure_and_restart_acng() {
 }
 
 function acng_check_status_or_restart() {
-	[[ "${MANAGE_ACNG}" != "yes" ]] && return 0                               # don't if told not to
+	[[ "${MANAGE_ACNG}" != "yes" ]] && return 0 # don't if told not to
 
 	if ! systemctl -q is-active apt-cacher-ng.service; then
 		display_alert "ACNG systemd service is not active" "restarting apt-cacher-ng" "warn"

+ 1 - 1
lib/functions/image/compress-checksum.sh

@@ -20,7 +20,7 @@ function output_images_compress_and_checksum() {
 		[[ -L "${uncompressed_file}" ]] && continue
 		# if image is not a file, skip it
 		[[ ! -f "${uncompressed_file}" ]] && continue
-		
+
 		# get just the filename, sans path
 		declare uncompressed_file_basename
 		uncompressed_file_basename=$(basename "${uncompressed_file}")

+ 1 - 1
lib/functions/logging/export-logs.sh

@@ -181,7 +181,7 @@ function export_raw_logs() {
 		display_alert "No target file specified for export_raw_logs()" "${target_file}" "err"
 		return 0
 	fi
-	
+
 	# Just tar the logs directory into target_file
 	tar -C "${LOGDIR}" -cf "${target_file}" .
 }

+ 0 - 1
lib/functions/logging/traps.sh

@@ -186,4 +186,3 @@ function exit_with_error() {
 
 	exit 43
 }
-

+ 0 - 1
lib/functions/main/config-interactive.sh

@@ -24,4 +24,3 @@ function config_possibly_interactive_branch_release_desktop_minimal() {
 
 	return 0 # protect against eventual shortcircuit above
 }
-

+ 1 - 1
lib/functions/rootfs/distro-specific.sh

@@ -136,7 +136,7 @@ function create_sources_list() {
 			cat <<- EOF > "${basedir}"/etc/apt/sources.list
 				deb http://${DEBIAN_MIRROR} $release main contrib non-free
 				#deb-src http://${DEBIAN_MIRROR} $release main contrib non-free
-				
+
 				deb http://${DEBIAN_MIRROR} unstable main contrib non-free
 				#deb-src http://${DEBIAN_MIRROR} unstable main contrib non-free
 			EOF

+ 1 - 1
lib/functions/rootfs/rootfs-desktop.sh

@@ -7,7 +7,7 @@ function desktop_postinstall() {
 	disable_systemd_service_sdcard lightdm.service
 	disable_systemd_service_sdcard gdm3.service
 
-	# @TODO: why? 
+	# @TODO: why?
 	display_alert "Updating package lists" "for desktop" "info"
 	do_with_retries 3 chroot_sdcard_apt_get_update
 

+ 0 - 1
lib/library-functions.sh

@@ -1045,7 +1045,6 @@ set -o errexit  ## set -e : exit the script if any statement returns a non-true
 # shellcheck source=lib/functions/rootfs/trap-rootfs.sh
 source "${SRC}"/lib/functions/rootfs/trap-rootfs.sh
 
-
 # no errors tolerated. one last time for the win!
 #set -o pipefail  # trace ERR through pipes - will be enabled "soon"
 #set -o nounset   ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled

+ 1 - 1
lib/tools/shellfmt.sh

@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-SHELLFMT_VERSION=${SHELLFMT_VERSION:-3.5.1} # https://github.com/mvdan/sh/releases/
+SHELLFMT_VERSION=${SHELLFMT_VERSION:-3.6.0} # https://github.com/mvdan/sh/releases/
 
 SRC="$(
 	cd "$(dirname "$0")/../.."