diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-03-18 03:26:43 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-03-18 03:26:43 +0200 |
commit | 5ad0e143e7f76c740defe6d983e4c54007a23b25 (patch) | |
tree | 9b945bad968f887a29db6a64c307363d5b8fc22a | |
parent | fcea005489c37f84003959c9b29bacb584e3a42f (diff) | |
download | arching-kaos-tools-5ad0e143e7f76c740defe6d983e4c54007a23b25.tar.gz arching-kaos-tools-5ad0e143e7f76c740defe6d983e4c54007a23b25.tar.bz2 arching-kaos-tools-5ad0e143e7f76c740defe6d983e4c54007a23b25.zip |
Introduced dynamic splitting to keep chunks<250
-rwxr-xr-x | bin/ak-fs-add | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/bin/ak-fs-add b/bin/ak-fs-add index 37fe43b..b422d25 100755 --- a/bin/ak-fs-add +++ b/bin/ak-fs-add @@ -123,10 +123,17 @@ CHECKSUM=$(sha512sum "$FILE"|awk '{print $1}') FILE_SIZE="$(du -b $FILE | awk '{ print $1 }')" if [ $FILE_SIZE -lt 4097 ] then - cp $FILE "$TECHDIR$(basename "$FILE")-00000000000000000000000000000000000000000000000000.chk" + cp $FILE "$TECHDIR/$(basename "$FILE")-00000000000000000000000000000000000000000000000000.chk" else + FACTOR=1024 + while [ $(( $FILE_SIZE / $FACTOR )) -gt 250 ] + do + FACTOR=$(( $FACTOR * 2 )) + done + logit "INFO" "Gonna split in $FACTOR size" + sleep 30 # We split the file into 4*1024 bytes and output the chunks into TECHDIR - split -a 50 -b 4096 --additional-suffix ".chk" -d "$FILE" "$TECHDIR$(basename "$FILE")-" + split -a 50 -b $FACTOR --additional-suffix ".chk" -d "$FILE" "$TECHDIR/$(basename "$FILE")-" fi # We go over there... |