aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-pack_z_block
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-04-03 05:15:00 +0300
committerkaotisk <kaotisk@arching-kaos.org>2023-04-03 05:15:00 +0300
commitfc91066907e4d16a951c8d72d23aa610945f5407 (patch)
tree8d66ab33ae012ba185810b7462cd58687b6be38b /bin/ak-pack_z_block
parentad7d6281475c4adb67e0a43017803aeb4a9059ce (diff)
downloadarching-kaos-tools-fc91066907e4d16a951c8d72d23aa610945f5407.tar.gz
arching-kaos-tools-fc91066907e4d16a951c8d72d23aa610945f5407.tar.bz2
arching-kaos-tools-fc91066907e4d16a951c8d72d23aa610945f5407.zip
Clean up, elimination of duplicate tempassins, fixed current directory problems, introduced new tool
Diffstat (limited to 'bin/ak-pack_z_block')
-rwxr-xr-xbin/ak-pack_z_block21
1 files changed, 3 insertions, 18 deletions
diff --git a/bin/ak-pack_z_block b/bin/ak-pack_z_block
index 76e87df..7465897 100755
--- a/bin/ak-pack_z_block
+++ b/bin/ak-pack_z_block
@@ -74,16 +74,7 @@ main(){
PREVIOUS=$(ak-ipfs-files-stat /zlatest | head -n 1)
# We create a block of json like this:
- cat > block <<EOF
-{
- "timestamp":"$(date -u +%s)",
- "action":"$ACTION",
- "data":"$MESSAGE_HASH",
- "detach":"$MESSAGE_SIGNATURE",
- "gpg":"$GPG_PUB_KEY",
- "previous":"$PREVIOUS"
-}
-EOF
+ printf '{"timestamp":"%s","action":"%s","data":"%s","detach":"%s","gpg":"%s","previous":"%s"}' $(date -u +%s) $ACTION $MESSAGE_HASH $MESSAGE_SIGNATURE $GPG_PUB_KEY $PREVIOUS > block
BLOCK="block"
BLOCK_SIG=$BLOCK".asc"
# We have a block now, so we sign it
@@ -96,12 +87,7 @@ EOF
BLOCK=$(ak-ipfs-add $BLOCK)
# So we now do the think almost again
- cat > zblock << EOF
-{
- "block":"$BLOCK",
- "block_signature":"$BLOCK_SIGNATURE"
-}
-EOF
+ printf '{"block":"%s","block_signature":"%s"}' $BLOCK $BLOCK_SIGNATURE > zblock
ZBL="zblock"
# and we add it on IPFS
ZBLOCK=$(ak-ipfs-add $ZBL)
@@ -110,8 +96,7 @@ EOF
if [ ! -z $2 ];
then
- PWD="$(pwd)"
- MESSAGE="$PWD/$2"
+ MESSAGE="$2"
ACTION="$1"
if [ -f "$MESSAGE" ]; then
main