Skip to content

Commit

Permalink
When sending a file, automatically start the IPFS daemon if it's not …
Browse files Browse the repository at this point in the history
…running
  • Loading branch information
Zi1mo5zo committed Nov 22, 2018
1 parent f8bb9b1 commit 6548104
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions ipfs-wormhole.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@
set -euo pipefail
IFS=$'\n\t'

# Send/receive encrypted files using IPFS.
#
# The file to send is encrypted with a temporary password, and added to IPFS.
# The IPFS hash, the password and the file name are merged in a key, which can
# be used to retrieve, decrypt and save the content of the file.
#
# Dependencies:
# - pwgen
# - tar
# - gpg
# - ipfs
# - wget
# See <https://raw.githubusercontent.com/aurelg/ipfs-wormhole/master/README.md>

# Check deps

Expand All @@ -36,6 +25,11 @@ send)
IPFSCMD="$(checkdep ipfs)"
PASSWORD=$($PWGENCMD -1 20)
FILE=${2:-}
if ! pgrep ipfs 1>/dev/null 2>&1; then
echo "IPFS is not running, starting the daemon and sleep 5 seconds"
$IPFSCMD daemon &
sleep 5
fi
if [ -d "$FILE" ]; then
TAG=$(
$TARCMD -Jc "$FILE" | $GPGCMD --batch --passphrase="$PASSWORD" \
Expand Down

0 comments on commit 6548104

Please sign in to comment.