From 9fe97b99cb6d7ea0d78adfffac9e66c705ea1a10 Mon Sep 17 00:00:00 2001 From: "David E. Perez Negron Rocha" Date: Tue, 9 Jun 2020 00:23:53 -0500 Subject: [PATCH] Adding receipts pinner and downloader script --- .gitignore | 3 ++- receipts.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 receipts.sh diff --git a/.gitignore b/.gitignore index 41ece8f..486ea91 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /node_modules /orbitdb +/receipts package-lock.json -.env \ No newline at end of file +.env diff --git a/receipts.sh b/receipts.sh new file mode 100755 index 0000000..195ff6a --- /dev/null +++ b/receipts.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +./connectNodes.sh + +# Receipts and Files to PIN +FilesHashList=("QmYw6JTNABDDfXvc3U2BfURjF5Zzx9eG3N43wJqHc4upDL" ) # \ + #"" \ + #"" \) +echo "" +echo "IPFS PIN DECA's Carbon Credits Receipts?:" + +read -p "Enter Y for Yes, N for No:" choice +case "$choice" in + Y | y) echo "Pinning Receipts by IPFS hash"; + for val in ${FilesHashList[*]}; do + /usr/local/bin/ipfs pin add $val + done + ;; + N | n) ;; + + *) echo "no option selected";; +esac + +receiptsRoute=./receipts +echo "" +echo "IPFS GET(Download) DECA's Carbon Credits Receipts?:" + +read -p "Enter Y for Yes, N for No:" choice +case "$choice" in + Y | y) echo "Getting Receipts by IPFS hash"; + echo "Default receipts file is ./receipts..." + mkdir $receiptsRoute + for val in ${FilesHashList[*]}; do + /usr/local/bin/ipfs get $val -o $receiptsRoute + done + ;; + N | n) ;; + + *) echo "no option selected";; +esac + +echo "Bye ;) $USERNAME"