diff --git a/src/freedombone-meshweb b/src/freedombone-meshweb index e7be470a..f33845ce 100755 --- a/src/freedombone-meshweb +++ b/src/freedombone-meshweb @@ -20,6 +20,8 @@ UPDATED="no" ZERONET_DEFAULT_BLOG_TAGLINE="Blogging on the Mesh" ZERONET_DEFAULT_FORUM_TAGLINE="A decentralized discussion group" +IPFS_PORT=4001 + function install_ipfs { if [ ! -f /home/$MY_USERNAME/go/bin/ipfs ]; then if [ ! -d /usr/local/go ]; then @@ -68,6 +70,26 @@ function install_ipfs { sudo chown $MY_USERNAME:$MY_USERNAME /dev/fuse fi fi + + IPFS_PEER_ID=$(ipfs id | grep '\"ID\":' | awk -F '\"' '{print $4}') + if [ ${#IPFS_PEER_ID} -lt 10 ]; then + echo 'Invalid IPFS peer ID' + echo "$IPFS_PEER_ID" + exit 74782 + fi + + # Add an avahi service + echo '' > /tmp/ipfs.service + echo '' >> /tmp/ipfs.service + echo '' >> /tmp/ipfs.service + echo ' %h IPFS' >> /tmp/ipfs.service + echo ' ' >> /tmp/ipfs.service + echo ' _ipfs._tcp' >> /tmp/ipfs.service + echo " $IPFS_PORT" >> /tmp/ipfs.service + echo " $IPFS_PEER_ID" >> /tmp/ipfs.service + echo ' ' >> /tmp/ipfs.service + echo '' >> /tmp/ipfs.service + sudo cp /tmp/ipfs.service /etc/avahi/services/ipfs.service } function install_zeronet_blog {