|
| 1 | +# This snap will build go-ipfs from source. |
| 2 | +# See: https://github.com/ipfs-shipyard/ipfs-snap for more details |
| 3 | +name: ipfs |
| 4 | +summary: global, versioned, peer-to-peer filesystem # 79 char long summary |
| 5 | +description: | |
| 6 | + IPFS combines good ideas from Git, BitTorrent, Kademlia, SFS, and the Web. |
| 7 | + It is like a single bittorrent swarm, exchanging git objects. IPFS provides |
| 8 | + an interface as simple as the HTTP web, but with permanence built in. You |
| 9 | + can also mount the world at /ipfs. |
| 10 | +
|
| 11 | +# fetch the version number in the `ipfs` part rather than hardcode it here |
| 12 | +# see: https://snapcraft.io/docs/using-external-metadata#heading--scriptlet |
| 13 | +adopt-info: ipfs |
| 14 | +base: core18 |
| 15 | +grade: stable |
| 16 | +confinement: strict |
| 17 | + |
| 18 | +apps: |
| 19 | + ipfs: |
| 20 | + command: ipfs |
| 21 | + plugs: [network, network-bind, removable-media] |
| 22 | + environment: |
| 23 | + # Snaps versions are isolated by default. This keeps the same ipfs repo across upgrades. |
| 24 | + IPFS_PATH: "$SNAP_USER_COMMON" |
| 25 | + |
| 26 | +parts: |
| 27 | + ipfs: |
| 28 | + source: '.' |
| 29 | + # TODO: set this to master when porting this file to ipfs/go-ipfs. |
| 30 | + # Setting it explicitly lets us build the missing versions 0.5 and 0.6 |
| 31 | + source-tag: master |
| 32 | + plugin: go |
| 33 | + # keep me up to date with the go version that go-ipfs expects to be built with. |
| 34 | + go-channel: 1.14/stable |
| 35 | + go-importpath: github.com/ipfs/go-ipfs |
| 36 | + build-packages: |
| 37 | + - build-essential |
| 38 | + |
| 39 | + # use `make` to build and set the snap version from `ipfs version` output |
| 40 | + override-build: | |
| 41 | + export GOPATH=$SNAPCRAFT_PART_BUILD/go |
| 42 | + make install |
| 43 | + cp $SNAPCRAFT_PART_BUILD/go/bin/ipfs $SNAPCRAFT_PART_INSTALL |
| 44 | + export IPFS_VERSION=$($SNAPCRAFT_PART_BUILD/go/bin/ipfs version --commit | cut -c 14-) |
| 45 | + echo "found version $IPFS_VERSION" |
| 46 | + snapcraftctl set-version $IPFS_VERSION |
0 commit comments