On 10/1/25 06:27, Alyssa Ross wrote:
This is actually a treewide shfmt run, but I guess nothing outside of scripts/ has any formatting issues.
Signed-off-by: Alyssa Ross <hi@alyssa.is> --- scripts/dist-cloud-hypervisor.sh | 4 +- scripts/format-uuid.sh | 2 +- scripts/make-erofs.sh | 8 +-- scripts/run-qemu.sh | 109 ++++++++++++++++--------------- scripts/update-nixpkgs.sh | 4 +- 5 files changed, 64 insertions(+), 63 deletions(-)
diff --git a/scripts/dist-cloud-hypervisor.sh b/scripts/dist-cloud-hypervisor.sh index 603c2df..22bcbaa 100755 --- a/scripts/dist-cloud-hypervisor.sh +++ b/scripts/dist-cloud-hypervisor.sh @@ -16,6 +16,6 @@ trap 'rm -rf -- "$dir"' EXIT mkdir -p -- "$dir/$name/LICENSES" cp -- LICENSES/Apache-2.0.txt LICENSES/LicenseRef-BSD-3-Clause-Google.txt \ "$dir/$name/LICENSES" -cat pkgs/cloud-hypervisor/*.patch > "$dir/$name/cloud-hypervisor.patch" -cat pkgs/cloud-hypervisor/vhost/*.patch > "$dir/$name/vhost.patch" +cat pkgs/cloud-hypervisor/*.patch >"$dir/$name/cloud-hypervisor.patch" +cat pkgs/cloud-hypervisor/vhost/*.patch >"$dir/$name/vhost.patch" tar -C "$dir" -czf "$name.tar.gz" -- "$name" diff --git a/scripts/format-uuid.sh b/scripts/format-uuid.sh index 497a5f2..3b38278 100755 --- a/scripts/format-uuid.sh +++ b/scripts/format-uuid.sh @@ -4,7 +4,7 @@ # SPDX-FileCopyrightText: 2022 Unikie # SPDX-License-Identifier: EUPL-1.2+
-substr () { +substr() { str=$1 beg=$2 end=$3 diff --git a/scripts/make-erofs.sh b/scripts/make-erofs.sh index ad04844..7e46847 100755 --- a/scripts/make-erofs.sh +++ b/scripts/make-erofs.sh @@ -35,8 +35,8 @@ while read -r arg1; do # a subset of all paths, but this subset includes all of # the ones passed in practice other than /. case $arg2 in - (*/*) parent=${arg2%/*};; - (*) parent=.;; + */*) parent=${arg2%/*} ;; + *) parent=. ;; esac
I *really* don't like introducing mismatched parentheses, as it breaks parentheses matching in editors. Editors know about quoting, but probably not about case statements. Also, at least some shells misparse the form without the extra parentheses when inside $(...).
# Ensure any existing directories we want to write into are writable. @@ -50,8 +50,8 @@ while read -r arg1; do
# shellcheck disable=SC2030 # shadowed on purpose case "$parent" in - */*) parent="${parent%/*}" ;; - *) break ;; + */*) parent="${parent%/*}" ;; + *) break ;; esac done
diff --git a/scripts/run-qemu.sh b/scripts/run-qemu.sh index 64fd292..75ecef4 100755 --- a/scripts/run-qemu.sh +++ b/scripts/run-qemu.sh @@ -6,14 +6,14 @@ # which can't be handled portably in Make language.
case "${ARCH:="$(uname -m)"}" in - aarch64) - machine=virt,accel=kvm:tcg,gic-version=3,iommu=smmuv3 - ;; - x86_64) - append="console=ttyS0${append:+ $append}" - iommu=intel-iommu,intremap=on - machine=q35,accel=kvm:tcg,kernel-irqchip=split - ;; +aarch64) + machine=virt,accel=kvm:tcg,gic-version=3,iommu=smmuv3 + ;; +x86_64) + append="console=ttyS0${append:+ $append}" + iommu=intel-iommu,intremap=on + machine=q35,accel=kvm:tcg,kernel-irqchip=split + ;; esac
i=0 @@ -22,49 +22,50 @@ while [ $i -lt $# ]; do shift
case "$arg" in - -append) - set -- "$@" -append "${append:+$append }$1" - i=$((i + 2)) - shift - continue - ;; - -device) - IFS=, - for opt in $1; do - case "$opt" in - *-iommu) - unset iommu - ;; + -append) + set -- "$@" -append "${append:+$append }$1" + i=$((i + 2)) + shift + continue + ;; + -device) + IFS=, + for opt in $1; do + case "$opt" in + *-iommu) + unset iommu + ;; + esac + break + done + unset IFS + ;; + -machine) + set -- "$@" "$arg" + i=$((i + 1)) + arg= + + IFS=, + for opt in $1; do + case "$opt" in + virtualization=on) + case "$ARCH" in + aarch64) + opt="$opt,accel=tcg" + ;; + *) + continue + ;; esac - break - done - unset IFS - ;; - -machine) - set -- "$@" "$arg" - i=$((i + 1)) - arg= + ;; + esac
- IFS=, - for opt in $1; do - case "$opt" in - virtualization=on) - case "$ARCH" in - aarch64) - opt="$opt,accel=tcg" - ;; - *) - continue - ;; - esac - ;; - esac + arg="$arg${arg:+,}$opt" + done + unset IFS
- arg="$arg${arg:+,}$opt" - done - unset IFS - - shift + shift + ;; esac
set -- "$@" "$arg" @@ -74,12 +75,12 @@ done
for arg; do case "$arg" in - -append) - append= - ;; - -kernel) - kernel=1 - ;; + -append) + append= + ;; + -kernel) + kernel=1 + ;; esac done
diff --git a/scripts/update-nixpkgs.sh b/scripts/update-nixpkgs.sh index dd1b7de..e481eb0 100755 --- a/scripts/update-nixpkgs.sh +++ b/scripts/update-nixpkgs.sh @@ -12,11 +12,11 @@ set -ueo pipefail root="$(dirname "$0")/.." out="$(mktemp -p "$root/lib" -t nixpkgs.default.nix.XXXXXXXXXX)"
-exec > "$out" +exec >"$out"
rev="$( curl -fsLS "https://api.github.com/repos/NixOS/nixpkgs/branches/${1-nixos-unstable}" | - jq -r .commit.sha + jq -r .commit.sha
This seems to be pointless extra indentation.
)" url="https://github.com/NixOS/nixpkgs/archive/$rev.tar.gz"
-- Sincerely, Demi Marie Obenour (she/her/hers)