Adds variables and IPFS_FD_MAX to prevent add fail (#1)

This commit is contained in:
Alvaro Segura Del Barco 2018-02-11 16:26:47 -06:00 committed by GitHub
parent 5a7c0f0ec2
commit cdc3e9f9c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,6 +26,10 @@ if [ "$#" -ne 1 ]; then
exit 1
fi

IPFS="/usr/local/bin/ipfs"
export IPFS_PATH="/data/ipfsrepo"
export IPFS_FD_MAX="4096"

dir="$1"

# Two stage sync of the main Ubuntu mirror.
@ -38,12 +42,12 @@ rsync --recursive --times --links --safe-links --hard-links --stats --delete -
# Publish the files on IPFS.
# This uses the experimental filestore:
# https://github.com/ipfs/go-ipfs/issues/3397#issuecomment-284337564
ipfs config --json Experimental.FilestoreEnabled true
$IPFS config --json Experimental.FilestoreEnabled true
echo "Adding the mirror files to IPFS."
hash="$(ipfs add --quiet --recursive --nocopy "${dir}" | tail -n1)"
hash="$($IPFS add --progress --local --nocopy --fscache --quieter --recursive "${dir}" | tail -n1)"
echo "Published IPFS hash ${hash}."
echo "Updating IPNS."
ipns="$(ipfs name publish "${hash}" | cut -d ' ' -f 3 | tr -d ':')"
ipns="$($IPFS name publish "${hash}" | cut -d ' ' -f 3 | tr -d ':')"
echo "IPFS Mirror synchronized."
echo "Add the address 'ipfs:/ipns/${ipns}' to your '/etc/apt/sources.list'."
echo "For example, add 'deb ipfs:/ipns/${ipns} xenial main' if you are in Ubuntu 16.04, and you want to use IPFS to get updates from the main archive."