diff options
author | kaotisk <kaotisk@arching-kaos.com> | 2022-02-11 07:39:21 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.com> | 2022-02-11 07:39:21 +0200 |
commit | c96e3709d1b019dd1217c921b2070f6221db2943 (patch) | |
tree | 76b702114f050a3fd893d57e7d16e7d2d1bb0b2a /bin/ak-files | |
parent | d5f9085737874dcef201a8ddbdc0b8cb32d969b1 (diff) | |
download | arching-kaos-tools-c96e3709d1b019dd1217c921b2070f6221db2943.tar.gz arching-kaos-tools-c96e3709d1b019dd1217c921b2070f6221db2943.tar.bz2 arching-kaos-tools-c96e3709d1b019dd1217c921b2070f6221db2943.zip |
[module] ak-files
Diffstat (limited to 'bin/ak-files')
-rwxr-xr-x | bin/ak-files | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/bin/ak-files b/bin/ak-files new file mode 100755 index 0000000..e598e47 --- /dev/null +++ b/bin/ak-files @@ -0,0 +1,45 @@ +#!/bin/bash +# The following creates a mixtape data message +# We can extend it by calling the pack_z_block.sh mixtape/add data + +usage(){ + title + echo "$0 - file" +} + +main(){ + echo "Adding $FILE" + + FILE_IPFS_HASH=$(ipfs add -q $FILE) + + SIGN_FILE=$FILE".asc" + gpg2 --detach-sign --sign-with $FINGERPRINT --armor --output $SIGN_FILE $FILE + + SIGNATURE=$(ipfs add -q $SIGN_FILE) + + cat > data <<EOF +{ + "timestamp":"$(date -u +%s)", + "filename":"$FILE", + "ipfs":"$IPFS_HASH", + "detach":"$SIGNATURE" +} +EOF + +} + +title(){ + echo "File block creator" + echo "==================" +} + + +if [ ! -z $1 ]; +then + PWD="$(pwd)" + FILE="$PWD/$1" + main + cat $PWD/data | json_pp + # sh pack_z_block.sh mixtape/add $PWD/data +else usage +fi |