aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-05-27 10:56:40 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-05-27 10:56:40 +0300
commit2c9df6a4bfc99559fa741a88b7e3041e2b2f9ee8 (patch)
tree3317441069b359c4f9347ba99458424ccfcc1e8c /lib
parent7a52180ec7a2f8b23f29b9a3094c5d015314acc0 (diff)
downloadarching-kaos-tools-2c9df6a4bfc99559fa741a88b7e3041e2b2f9ee8.tar.gz
arching-kaos-tools-2c9df6a4bfc99559fa741a88b7e3041e2b2f9ee8.tar.bz2
arching-kaos-tools-2c9df6a4bfc99559fa741a88b7e3041e2b2f9ee8.zip
Refactoring
Diffstat (limited to 'lib')
-rwxr-xr-xlib/_ak_fs11
1 files changed, 6 insertions, 5 deletions
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
}