From 45e8aacd266490b84619be0f38c30bad1b475107 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Tue, 10 Dec 2024 19:52:25 +0200 Subject: Workaround for du freebsd variant --- lib/_ak_fs | 4 ++-- lib/_ak_zblock | 2 +- lib/_ak_zchain | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/_ak_fs b/lib/_ak_fs index 127e40e..02b789e 100755 --- a/lib/_ak_fs +++ b/lib/_ak_fs @@ -153,7 +153,7 @@ _ak_fs_import(){ # We get the SHA512 hash for the $FILE given CHECKSUM=$(sha512sum "$FILE"|awk '{print $1}') - FILE_SIZE="$(du -b $FILE | awk '{ print $1 }')" + FILE_SIZE="$( (du -b $FILE||du -A $FILE)2>/dev/null | awk '{ print $1 }')" if [ $FILE_SIZE -lt 4097 ] then cp $FILE "$TECHDIR/$(basename "$FILE")-00000000000000000000000000000000000000000000000000.chk" @@ -274,7 +274,7 @@ _ak_fs_find_depth(){ currentNode="$1" #pathToNode="$AK_LEAFSDIR/$(_ak_fs_return_hash_path $currentNode)" pathToNode="$AK_LEAFSDIR/$currentNode" - if [ -f $pathToNode ] && [ "$(du -b $pathToNode | awk '{print $1}')" == "258" ] + if [ -f $pathToNode ] && [ "$( (du -b $pathToNode||du -A $pathToNode)2>/dev/null | awk '{print $1}')" == "258" ] then fileHead="$(head -n 1 $pathToNode)" counter="$(expr $counter + 1)" diff --git a/lib/_ak_zblock b/lib/_ak_zblock index 3dff038..9b38d8f 100755 --- a/lib/_ak_zblock +++ b/lib/_ak_zblock @@ -511,7 +511,7 @@ _ak_zblock_cache(){ if [ ! -z "$1" ] && [ -n "$1" ] then - if [ -f "$AK_ZBLOCKDIR/$1" ] && [ "$(du -b $AK_ZBLOCKDIR/$1 | awk '{ print $1 }')" != "0" ] + if [ -f "$AK_ZBLOCKDIR/$1" ] && [ "$( (du -b $AK_ZBLOCKDIR/$1 || du -A $AK_ZBLOCKDIR/$1)2>/dev/null | awk '{ print $1 }')" != "0" ] then # if [ "$(sha512sum $AK_ZBLOCKDIR/$1 | awk '{ print $1 }')" == "$(_ak_zblock_show $1 | sha512sum | awk '{ print $1 }')" ] if [ ! -f $FZBLOCKSDIR/$1 ] diff --git a/lib/_ak_zchain b/lib/_ak_zchain index b561077..4bc76a0 100755 --- a/lib/_ak_zchain +++ b/lib/_ak_zchain @@ -157,7 +157,7 @@ _ak_zchain_calculate_size(){ if [ "$p" != "" ] then _ak_ipfs_get $p - num="$(du -bs --apparent-size $p | cut -d $'\t' -f 1)" + num="$( (du -b $p || du -A $p)2>/dev/null | cut -d $'\t' -f 1)" else num=0 fi -- cgit v1.2.3