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 '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /tmp/ipfs.service + echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /tmp/ipfs.service + echo '<service-group>' >> /tmp/ipfs.service + echo ' <name replace-wildcards="yes">%h IPFS</name>' >> /tmp/ipfs.service + echo ' <service>' >> /tmp/ipfs.service + echo ' <type>_ipfs._tcp</type>' >> /tmp/ipfs.service + echo " <port>$IPFS_PORT</port>" >> /tmp/ipfs.service + echo " <txt-record>$IPFS_PEER_ID</txt-record>" >> /tmp/ipfs.service + echo ' </service>' >> /tmp/ipfs.service + echo '</service-group>' >> /tmp/ipfs.service + sudo cp /tmp/ipfs.service /etc/avahi/services/ipfs.service } function install_zeronet_blog {