gist/ipfs-get-repos.sh

44 lines
957 B
Bash

#!/bin/bash
_USER='apt-mirror'
_DIR='/var/spool/apt-mirror'
_MIRROR_LIST=" \
k51qzi5uqu5dg9vawh923wejqffxiu9bhqlze5f508msk0h7ylpac27fdgaskx \
k51qzi5uqu5dhngjg68o8x9uimwy5h8iqt91n2266idc7uet9ew3lc472upy27 \
k51qzi5uqu5dlp5yjlahzcp3kfpnhbifo9ka9iybo3bp5vt781duafkyyvt9al \
k51qzi5uqu5dhvbtvdf46kkhobzgamhiirte6s6k28l2c1iapumphh3cpkw33f \
k51qzi5uqu5dj05z8mr958kwvrg7a0wqouj5nnoo5uqu1btnsljvpznfaav9nk \
k51qzi5uqu5dgu3homski160l4t4bmp52vb6dbgxb5bda90rewnwg64wnkwxj4 \
"
pushd $_DIR
die()
{
echo $@
exit 1
}
if [ $(whoami) != $_USER ]; then
die Run me from $_USER!
fi
for i in $_MIRROR_LIST;
do
savelog -J -n var/rsync.$i
echo "Pre cleaning $i"
rm -rf $i
echo "Downloading $i"
ipfs get /ipns/$i
echo "Rsyncing $i"
rsync -av --delete $i mirror/$i > var/rsync.$i
echo "Post cleaning $i"
rm -rf $i
done
popd