Improved ipfs-publish.sh

This commit is contained in:
Markus Fleschutz 2021-03-08 18:57:00 +01:00
parent 4ae46363dd
commit d221ab23bd

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# Syntax: ./ipfs-publish <dir-tree> # Syntax: ./ipfs-publish <dir-tree>
# Description: publishes the given directory tree to IPDS # Description: publishes the given directory tree to IPFS
# Author: Markus Fleschutz # Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell # Source: github.com/fleschutz/PowerShell
# License: CC0 # License: CC0
@ -11,18 +11,15 @@ DIR=$1
IPFS_HASHES="IPFS_hash_list.txt" IPFS_HASHES="IPFS_hash_list.txt"
DF_HASHES="checksum_list.xml" DF_HASHES="checksum_list.xml"
echo "Publishing directory tree $DIR to IPFS" echo "Publishing folder $DIR to IPFS"
echo "(1) Removing Thumbs.db in subfolders ..." echo "(1/3) Removing Thumbs.db in subfolders ..."
nice find "$DIR" -name Thumbs.db -exec rm -rf {} \; nice find "$DIR" -name Thumbs.db -exec rm -rf {} \;
echo "(2) Adding $DIR to IPFS ..." echo "(2/3) Adding $DIR to IPFS ..."
nice ipfs add -r "$DIR" > $IPFS_HASHES nice ipfs add -r "$DIR" > $IPFS_HASHES
echo "(3) Verifying ..." echo "(3/3) Calculating digital forensics hashes to $DF_HASHES ..."
nice ipfs pin verify
echo "(4) Calculating digital forensics hashes to $DF_HASHES ..."
nice hashdeep -c md5,sha1,sha256 -r -d -l -j 1 "$DIR" > $DF_HASHES nice hashdeep -c md5,sha1,sha256 -r -d -l -j 1 "$DIR" > $DF_HASHES
echo "DONE - to publish the content execute: ipfs name publish <HASH>" echo "OK - to publish the content execute: ipfs name publish <HASH>"
exit 0 exit 0