#!/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(){ CRP="$(pwd)" FILENAME="$1" main $FILENAME $CRP cat $TEMPASSIN/data | json_pp if [ $? == 0 ] then echo "cool" else echo "not?" fi } main(){ FILENAME="$1" CRP="$2" echo "Adding $FILENAME" tempassin cp $2/$1 $TEMPASSIN/$1 FILE="$TEMPASSIN/$1" 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 > $TEMPASSIN/data <