# Install IPFS ipfs() { echo -e "${c_yellow}Onboarding IPFS...$c_" BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" is_ipfs_update_installed=$(which ipfs-update) if [[ ! $is_ipfs_update_installed ]]; then if [[ $ARM == "yes" ]]; then wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update" else wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update" fi echo "INSTALL ipfs-update" sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ || err+="Untar ipfs-update" rm $MY_PATH/ipfs-update.tar.gz cd /usr/src/ipfs-update/ sudo ./install.sh || err+="Install ipfs-update" cd $MY_PATH echo "INSTALL latest ipfs" sudo ipfs-update install latest || err+="Install IPFS" fi if [[ ! -f /etc/systemd/system/ipfs.service ]]; then echo "CREATE SYSTEMD ipfs SERVICE" sudo cp -f $BASE_DIR/ipfs.service /etc/systemd/system/ sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service sudo systemctl daemon-reload || err+="Reload systemd" sudo systemctl enable ipfs || err+="Enable IPFS daemon" # DO NOT START YET... Must get IPFS swarm.key from a G1SSB Pub !! fi sudo systemctl stop ipfs echo "ipfs OK. Daemon stop... continue..." } $@