fix permissions, capitalize variable names
This commit is contained in:
parent
de37e36676
commit
b177ded516
19
sync.run
19
sync.run
@ -24,20 +24,20 @@ export IPFS_PATH=/var/lib/ipfs
|
||||
|
||||
if [[ ! -d $MIRROR_DIR ]]; then
|
||||
mkdir -p $MIRROR_DIR
|
||||
chown ipfs:ipfs $MIRROR_DIR
|
||||
fi
|
||||
chown ipfs:ipfs $MIRROR_DIR
|
||||
|
||||
export GNUPGHOME=/etc/debmirror/gnupg
|
||||
|
||||
if [[ ! -d $GNUPGHOME ]]; then
|
||||
mkdir -p $GNUPGHOME
|
||||
chown ipfs:ipfs $GNUPGHOME
|
||||
fi
|
||||
chown ipfs:ipfs $GNUPGHOME
|
||||
|
||||
chpst -u ipfs /bin/bash << '__EOF__'
|
||||
|
||||
export IPFS=/usr/local/bin/ipfs
|
||||
export HOME=/home/ipfs
|
||||
export HOME=/var/lib/ipfs
|
||||
export IPFS_FD_MAX=4096
|
||||
|
||||
gpg --no-default-keyring --keyring $GNUPGHOME/trustedkeys.kbx --import \
|
||||
@ -47,6 +47,8 @@ $IPFS config --json Experimental.FilestoreEnabled true
|
||||
|
||||
echo "Synchronizing with the main Ubuntu mirror."
|
||||
|
||||
set -x # error out if the sync fails
|
||||
|
||||
debmirror \
|
||||
--keyring $GNUPGHOME/trustedkeys.kbx \
|
||||
-a ${MIRROR_ARCHITECTURES:-amd64} \
|
||||
@ -60,19 +62,20 @@ debmirror \
|
||||
--method=http \
|
||||
$MIRROR_DIR
|
||||
|
||||
set +x # resume ignoring errors
|
||||
# Publish the files on IPFS.
|
||||
# This uses the experimental filestore:
|
||||
# https://github.com/ipfs/go-ipfs/issues/3397#issuecomment-284337564
|
||||
|
||||
echo "Adding the mirror files to IPFS."
|
||||
hash="$($IPFS add --progress --local --nocopy --fscache --quieter --recursive "$MIRROR_DIR" | tail -n1)"
|
||||
echo "Published IPFS hash ${hash}."
|
||||
HASH="$($IPFS add --progress --local --nocopy --fscache --quieter --recursive "$MIRROR_DIR" | tail -n1)"
|
||||
echo "Published (added/pinned) /ipfs/${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."
|
||||
echo "Add the address 'ipfs:/ipns/${IPNS}' to your '/etc/apt/sources.list'."
|
||||
echo "For example, add 'deb ipfs:/ipns/${IPNS} xenial main'"
|
||||
__EOF__
|
||||
|
||||
sleep 3600 # wait 1h before syncing again
|
||||
|
Loading…
Reference in New Issue
Block a user