aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/ak-fs-add8
-rwxr-xr-xbin/ak-sm-hash-to-path8
-rwxr-xr-xlib/_ak_fs11
3 files changed, 14 insertions, 13 deletions
diff --git a/bin/ak-fs-add b/bin/ak-fs-add
index 0011faf..f22432b 100755
--- a/bin/ak-fs-add
+++ b/bin/ak-fs-add
@@ -183,16 +183,16 @@ do
sed -n "$a"p "$workingIndex" | awk '{ print $1 }' >> level.$c.pair.$a-$b
sed -n "$b"p "$workingIndex" | awk '{ print $1 }' >> level.$c.pair.$a-$b
shaSum="$(sha512sum level.$c.pair.$a-$b | awk '{ print $1 }')"
- mkdir -p $MERKLEDIR/$(_ak_return_hash_dir $shaSum)
- cp level.$c.pair.$a-$b $MERKLEDIR/$(_ak_return_hash_path $shaSum)
+ mkdir -p $MERKLEDIR/$(_ak_fs_return_hash_dir $shaSum)
+ cp level.$c.pair.$a-$b $MERKLEDIR/$(_ak_fs_return_hash_path $shaSum)
sha512sum level.$c.pair.$a-$b | awk '{ print $1 }' >> level.$c.map
a=`expr "$a" + 2`
done
workingIndex="level.$c.map"
appendLastIfNotEven "$workingIndex"
shaSum=`sha512sum $workingIndex | awk '{ print $1 }'`
- mkdir -p $MERKLEDIR/$(_ak_return_hash_dir $shaSum)
- cp $workingIndex $MERKLEDIR/$(_ak_return_hash_path $shaSum)
+ mkdir -p $MERKLEDIR/$(_ak_fs_return_hash_dir $shaSum)
+ cp $workingIndex $MERKLEDIR/$(_ak_fs_return_hash_path $shaSum)
# cp $workingIndex $MERKLEDIR/$shaSum
totalChunks=`cat $workingIndex | wc -l`
c=`expr $c - 1`
diff --git a/bin/ak-sm-hash-to-path b/bin/ak-sm-hash-to-path
index f08d4d4..b114b1b 100755
--- a/bin/ak-sm-hash-to-path
+++ b/bin/ak-sm-hash-to-path
@@ -23,13 +23,13 @@ case "$1" in
exit 1
;;
-d | --dir)
- _ak_verify_input_is_hash $2
- _ak_return_hash_dir $2
+ _ak_fs_verify_input_is_hash $2
+ _ak_fs_return_hash_dir $2
exit 0
;;
-p | --path)
- _ak_verify_input_is_hash $2
- _ak_return_hash_path $2
+ _ak_fs_verify_input_is_hash $2
+ _ak_fs_return_hash_path $2
exit 0
;;
*)
diff --git a/lib/_ak_fs b/lib/_ak_fs
index 20c6979..527a78b 100755
--- a/lib/_ak_fs
+++ b/lib/_ak_fs
@@ -1,16 +1,16 @@
#!/bin/bash
-_ak_return_hash_path(){
+_ak_fs_return_hash_path(){
hashpath="$(echo -n "$1" |sed 's/./&\//g;s/\/$//g')"
echo -n "$hashpath"
}
-_ak_return_hash_dir(){
+_ak_fs_return_hash_dir(){
hashdir="$(echo -n "$1" | sed -e 's/./&\//g' | grep '\(./\)\{128\}' | sed -e 's/..$//')"
echo -n "$hashdir"
}
-_ak_verify_input_is_hash(){
+_ak_fs_verify_input_is_hash(){
if [ ! -z "$1" ] && echo "$1" | grep '[0123456789abcdef]\{128\}' > /dev/null 2>&1
then
return 0
@@ -20,9 +20,10 @@ _ak_verify_input_is_hash(){
fi
}
-_ak_create_dir_for_hash(){
+_ak_fs_create_dir_for_hash(){
+ _ak_fs_verify_input_is_hash $2
if [ ! -z $1 ] && [ ! -z $2 ] && [ -n "$1" ] && [ -n "$2" ]
then
- mkdir -p "$1/$(_ak_return_hash_dir $2)"
+ mkdir -p "$1/$(_ak_fs_return_hash_dir $2)"
fi
}