32 lines
1.1 KiB
Bash
32 lines
1.1 KiB
Bash
|
#!/bin/bash
|
||
|
################################################################################
|
||
|
# Author: Fred (support@qo-op.com)
|
||
|
# Version: 1.0
|
||
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||
|
###########################################################################################
|
||
|
# ipfs_TASK.sh SYNC SWARM PEERS AND RUN TASKS
|
||
|
me=`basename "$0"`
|
||
|
IPFSNODEID=$(ipfs id -f='<id>\n')
|
||
|
|
||
|
########################################################################
|
||
|
### IPFS ADD ~/.zen/wallets
|
||
|
IWALLETS=$(ipfs add -rHq '~/.zen/wallets' | tail -n 1)
|
||
|
|
||
|
# CHAIN STATE FOR $IPFSNODEID
|
||
|
if [[ -f ~/.zen/wallets/.$IPFSNODEID.chain ]]; then
|
||
|
cat ~/.zen/wallets/.$IPFSNODEID.chain > ~/.zen/wallets/.$IPFSNODEID.chain.prev
|
||
|
INC=$(cat ~/.zen/wallets/.$IPFSNODEID.n)
|
||
|
((INC++))
|
||
|
echo $INC > ~/.zen/wallets/.$IPFSNODEID.n
|
||
|
else
|
||
|
echo "" > ~/.zen/wallets/.$IPFSNODEID.chain.prev
|
||
|
echo "0" > ~/.zen/wallets/.$IPFSNODEID.n
|
||
|
fi
|
||
|
### IPFS ADD ~/.zen/wallets
|
||
|
echo $IWALLETS > ~/.zen/wallets/.$IPFSNODEID.chain
|
||
|
|
||
|
IWALLETS=$(ipfs add -rHq '~/.zen/wallets' | tail -n 1)
|
||
|
# PUBLISH IPNS NODE WALLETS
|
||
|
NODEWALLETS=$(ipfs name publish --quieter /ipfs/$IWALLETS)
|
||
|
echo $IWALLETS
|