diff options
-rwxr-xr-x | bin/ak-fs | 13 | ||||
-rwxr-xr-x | lib/_ak_fs | 12 |
2 files changed, 17 insertions, 8 deletions
@@ -5,30 +5,29 @@ ## Usage: ## ## -h, --help Prints this help message -## ## --add, --import <file> Adds/Imports a file to the AKFS system -## ## --get, --export <hash> <output file> Exports a file from the AKFS system -## ## --cat <hash> Concatenates from given hash +## --list Lists names and roots available ## fullprogrampath="$(realpath $0)" PROGRAM=$(basename $0) descriptionString="AKFS tools" -# At least these source $AK_LIBDIR/_ak_log source $AK_LIBDIR/_ak_script source $AK_LIBDIR/_ak_fs -# Flags to run -if [ ! -z $1 ]; then +if [ ! -z $1 ] +then case $1 in -h | --help) _ak_usage; exit;; --add|--import) _ak_fs_import $2; exit;; --get|--export) _ak_fs_export $2 $3; exit;; --cat) _ak_fs_cat $2; exit;; + --list) _ak_fs_list; exit;; * ) _ak_usage;; esac -else _ak_usage +else + _ak_usage fi @@ -1,5 +1,7 @@ #!/bin/bash +source $AK_LIBDIR/_ak_log + _ak_fs_return_hash_path(){ hashpath="$(echo -n "$1" |sed 's/./&\//g;s/\/$//g')" echo -n "$hashpath" @@ -15,7 +17,7 @@ _ak_fs_verify_input_is_hash(){ then return 0 else - echo "no hash?!" >&2 + _ak_log_error "no hash?!" exit 1 fi } @@ -377,3 +379,11 @@ _ak_fs_export(){ fi _ak_fs_export "$1" > $outputFilename } + +_ak_fs_list(){ + FILEMAPSDIR="$AK_WORKDIR/fmp" + find $FILEMAPSDIR -type f | while read fina + do + cat $fina | tr $'\n' ' ' | awk '{ print $2 " " $3 }' + done +} |