add instructions to test with the hacky mirror

This commit is contained in:
Leo Arias 2017-12-03 18:59:09 +00:00
parent 207e6e2a2e
commit 0e91addbad
2 changed files with 28 additions and 16 deletions

View File

@ -2,7 +2,7 @@ IPFS transport for apt

# Requirements

sudo apt install python3 pip
sudo apt install python3-pip git
sudo pip3 install ipfsapi
sudo snap install ipfs
ipfs init
@ -12,29 +12,27 @@ IPFS transport for apt

Copy the ipfs file from this repo to the directory for apt transport methods:

sudo wget --output-document /usr/lib/apt/methods/ipfs https://raw.githubusercontent.com/JaquerEspeis/apt-transport-ipfs/master/ipfs
sudo chmod +x /usr/lib/apt/methods/ipfs
git clone https://github.com/JaquerEspeis/apt-transport-ipfs
sudo mv ipfs /usr/lib/apt/methods/ipfs

# Configure

Add an IPFS mirror to your apt sources.list file. TODO set up a mirror.

# Hacky local test
# Hacky test

While we set up a proper IPFS mirror, this can be tested by adding a bunch
of files:
While we set up a proper IPFS mirror, this can be tested by using a hardcoded
IPFS hash that was manually set up to serve the hello deb.

cd ~
mkdir --parents test-archive/dists/xenial/
cd test-archive/dists/xenial
wget http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease
wget http://archive.ubuntu.com/ubuntu/dists/xenial/Release
ipfs add --recursive ~/test-archive
Backup your /etc/apt/sources.list, remove all the lines that it has and leave it
just with:

The last line that this command returns will be something like:
deb ipfs://QmTNL3t9h23ZUUSsRj1h4CaZ6SLQF6xFoLcve2gAMcLdWA xenial main

added {hash} test-archive
To test it, run:

Now, add that hash to /etc/apt/source.list with the following form:
sudo apt update
sudo apt install hello

deb ipfs://{hash} xenial main
This IPFS node is not permanent and will disappear. To set it up again, use the
script in `scripts/add_test_mirror.sh`.

14
scripts/add_test_mirror.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash

mkdir --parents test-archive/dists/xenial/main/binary-amd64/by-hash/SHA256/
mkdir --parents test-archive/dists/xenial/main/i18n/
mkdir --parents test-archive/pool/main/h/hello/

wget --directory-prefix=test-archive/dists/xenial/ http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease
wget --directory-prefix=test-archive/dists/xenial/ http://archive.ubuntu.com/ubuntu/dists/xenial/Release
wget --directory-prefix=test-archive/dists/xenial/main/binary-amd64/by-hash/SHA256/ http://archive.ubuntu.com/ubuntu/dists/xenial/main/binary-amd64/by-hash/SHA256/76858a337b1665561a256cea6f7ef32515517754e3c5e54c1895cf29e1b41884
wget --directory-prefix=test-archive/dists/xenial/main/binary-amd64/ http://archive.ubuntu.com/ubuntu/dists/xenial/main/binary-amd64/Packages.xz
wget --directory-prefix=test-archive/dists/xenial/main/i18n/ http://archive.ubuntu.com/ubuntu/dists/xenial/main/i18n/Translation-en.xz
wget --directory-prefix=test-archive/pool/main/h/hello/ http://archive.ubuntu.com/ubuntu/pool/main/h/hello/hello_2.10-1_amd64.deb

ipfs add --recursive ~/test-archive