aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-sm-hash-to-path
blob: b114b1bd37cf59fc75f3f22f0d1429983c450421 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
##
## With this tool you give a SHA512 and take the following:
##
##     -h, --help                       This help message
##
##     -d, --dir <base path> <hash>     Directory that the hashed file would be
##                                      hosted
##
##     -p, --path <base path> <hash>    Full path that the hashed file would be
##                                      saved
##

fullprogrampath="$(realpath $0)"
PROGRAM="$(basename $0)"
descriptionString="Simple driver for hashes/chunks/branches"
source $AK_LIBDIR/_ak_fs
source $AK_LIBDIR/_ak_script

case "$1" in
    -h | --help)
        _ak_usage
        exit 1
        ;;
    -d | --dir)
        _ak_fs_verify_input_is_hash $2
        _ak_fs_return_hash_dir $2
        exit 0
        ;;
    -p | --path)
        _ak_fs_verify_input_is_hash $2
        _ak_fs_return_hash_path $2
        exit 0
        ;;
    *)
        echo "no option?!" >&2
        exit 1
        ;;
esac

exit 0