Skip to content

Commit

Permalink
Format bash scripts with shfmt
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Krieger <[email protected]>
  • Loading branch information
ben-krieger authored and nckrss committed Nov 19, 2024
1 parent f1986f6 commit 3ff33eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/plugins/download_device.bash
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function yield() {
fi

local bytecount
bytecount="$(wc -c <"$file"|tr -d '[:space:]')"
bytecount="$(wc -c <"$file" | tr -d '[:space:]')"
if [ "$bytecount" -lt "$length" ]; then
# continue to wait for data
return
Expand Down Expand Up @@ -109,7 +109,7 @@ function handle() {
if [[ "${next::1}" != "2" ]]; then
error "expected byte array value after key $key"
fi
checksum="$(openssl base64 -d <<<"${next:1}"| xxd -p -c 0|tr -d '\n')"
checksum="$(openssl base64 -d <<<"${next:1}" | xxd -p -c 0 | tr -d '\n')"
;;

"data")
Expand Down
8 changes: 4 additions & 4 deletions examples/plugins/download_owner.bash
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function produce() {
b64 "3" "$filename"

b64 "K" "length"
echo "1$(wc -c <"$file"|tr -d '[:space:]')"
echo "1$(wc -c <"$file" | tr -d '[:space:]')"

b64 "K" "sha-384"
b64x "2" "$(openssl dgst -sha384 -r "$file" | cut -d' ' -f1)"
Expand All @@ -64,8 +64,8 @@ function produce() {
fi

local chunk
chunk="$(dd if="$file" skip="$index" bs=1 count="$CHUNKSIZE" 2>/dev/null|openssl base64 -A)"
((index += $(echo -n "$chunk"|openssl base64 -A -d|wc -c)))
chunk="$(dd if="$file" skip="$index" bs=1 count="$CHUNKSIZE" 2>/dev/null | openssl base64 -A)"
((index += $(echo -n "$chunk" | openssl base64 -A -d | wc -c)))

if [ "$chunk" ]; then
b64 "K" "data"
Expand Down Expand Up @@ -105,7 +105,7 @@ function handle() {

local got expected
got="${next:1}"
expected="$(wc -c <"$file"|tr -d '[:space:]')"
expected="$(wc -c <"$file" | tr -d '[:space:]')"
if [ "$got" -ne "$expected" ]; then
error "expected device to read $expected bytes, got $got"
fi
Expand Down

0 comments on commit 3ff33eb

Please sign in to comment.