update mirror script

This commit is contained in:
6543 2018-10-16 10:56:41 +02:00
parent 37e53715ac
commit 86e5ae075a
1 changed files with 8 additions and 5 deletions

View File

@ -1,18 +1,21 @@
#!/bin/bash

## mirror
sudo -u apt-mirror -g apt-mirror apt-mirror
lxc-attach -n c_apt-mirror -- sudo -u apt-mirror -g apt-mirror apt-mirror

#ipfs check storage
lxc-attach -n c_ipfs -- /ipfs filestore verify

#ipfs key gen --type=rsa --size=2048 archive.canonical.com
# -> QmUajtQCL6yHcBaYxsZKyD8QH7n977ZVxjU5yMXwYC183c
hash_canonical="$(ipfs add --progress --local --nocopy --fscache --recursive /home/maddl/.ipfs/mirror/archive.canonical.com/ | tail -n1)"
name_canonical="$(ipfs name publish --key=archive.canonical.com `echo $hash_canonical | cut -d ' ' -f 2` | cut -d ' ' -f 3 | tr -d :)"
hash_canonical="$(lxc-attach -n c_ipfs -- /ipfs add --progress --local --nocopy --fscache --recursive /srv/apt-mirror/archive.canonical.com/ubuntu/ | tail -n1)"
name_canonical="$(lxc-attach -n c_ipfs -- /ipfs name publish --key=archive.canonical.com `echo $hash_canonical | cut -d ' ' -f 2` | cut -d ' ' -f 3 | tr -d :)"
echo "archive.canonical.com/ubuntu -> $name_canonical"
echo 'done'

#ipfs key gen --type=rsa --size=2048 archive.ubuntu.com
# -> QmXfAyjHThwksUyW9BwuqCDuzu1PM1XQkR1HVTbActvYDJ
hash_ubuntu="$(ipfs add --progress --local --nocopy --fscache --recursive /home/maddl/.ipfs/mirror/archive.ubuntu.com/ | tail -n1)"
name_ubuntu="$(ipfs name publish --key=archive.ubuntu.com `echo $hash_ubuntu | cut -d ' ' -f 2` | cut -d ' ' -f 3 | tr -d :)"
hash_ubuntu="$(lxc-attach -n c_ipfs -- /ipfs add --progress --local --nocopy --fscache --recursive /srv/apt-mirror/archive.ubuntu.com/ubuntu/ | tail -n1)"
name_ubuntu="$(lxc-attach -n c_ipfs -- /ipfs name publish --key=archive.ubuntu.com `echo $hash_ubuntu | cut -d ' ' -f 2` | cut -d ' ' -f 3 | tr -d :)"
echo "archive.utuntu.com/ubuntu -> $name_ubuntu"
echo 'done'