aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.com>2022-02-11 07:52:48 +0200
committerkaotisk <kaotisk@arching-kaos.com>2022-02-11 07:52:48 +0200
commit57f0f016a6c9947c19cc4ebab0c50193f17935b5 (patch)
treeff4b7f9dd23a580c777199da9e7ffed911a19892
parent3008ae73a432f19ee369fe05ee72a0199d663b30 (diff)
downloadarching-kaos-tools-57f0f016a6c9947c19cc4ebab0c50193f17935b5.tar.gz
arching-kaos-tools-57f0f016a6c9947c19cc4ebab0c50193f17935b5.tar.bz2
arching-kaos-tools-57f0f016a6c9947c19cc4ebab0c50193f17935b5.zip
Better written I suppose
-rwxr-xr-xbin/ak-files44
1 files changed, 37 insertions, 7 deletions
diff --git a/bin/ak-files b/bin/ak-files
index f830e17..f698290 100755
--- a/bin/ak-files
+++ b/bin/ak-files
@@ -1,12 +1,43 @@
#!/bin/bash
# The following creates a mixtape data message
# We can extend it by calling the pack_z_block.sh mixtape/add data
+ZFILESDIR="$WORKDIR/files"
+TEMP="/tmp/aktmp"
+if [ ! -d $ZFILESDIR ]; then
+ mkdir $ZFILESDIR
+ cd $ZFILESDIR
+ git init
+else
+ logthis "error $ZFILESDIR not found"
+fi
+tempassin(){
+ if [ ! -z $1 ];
+ then
+ TEMPASSIN="$1"
+ else
+ TIMESTAMP="$(date -u +%s)"
+ TEMPASSIN="/tmp/aktmp_$TIMESTAMP"
+ fi
+ if [ ! -d $TEMPASSIN ]; then
+ mkdir $TEMPASSIN
+ fi
+ cd $TEMPASSIN
+ echo "$TEMPASSIN"
+
+}
usage(){
title
echo "$0 - file"
}
+add(){
+ PWD="$(pwd)"
+ FILE="$PWD/$1"
+ main
+ cat $PWD/data | json_pp
+ pack_z_block file/add $PWD/data
+}
main(){
echo "Adding $FILE"
@@ -34,12 +65,11 @@ title(){
}
-if [ ! -z $1 ];
-then
- PWD="$(pwd)"
- FILE="$PWD/$1"
- main
- cat $PWD/data | json_pp
- pack_z_block file/add $PWD/data
+if [ ! -z $1 ]; then
+ case $1 in
+ help) usage; exit;;
+ add) add $2; exit;;
+ *) usage; exit;;
+ esac
else usage
fi