Skip to content

Instantly share code, notes, and snippets.

@maxux
Last active August 13, 2018 19:05
Show Gist options
  • Save maxux/a8bd412e0f4473b2618362c22c3e6972 to your computer and use it in GitHub Desktop.
Save maxux/a8bd412e0f4473b2618362c22c3e6972 to your computer and use it in GitHub Desktop.
Hub Converter
docker run -it --rm \
--device /dev/fuse \
--privileged \
--name hub-converter \
--net hub \
--hostname hub-converter \
-v /mnt/hub/:/mnt/hub \
ubuntu:16.04
#!/bin/bash
set -ex
apt-get update
makeopts="-j 32"
#
# zflist
#
apt-get install -y git curl build-essential vim
apt-get install -y libsnappy-dev libz-dev libtar-dev libb2-dev
apt-get install -y autoconf libtool libjansson-dev libhiredis-dev libsqlite3-dev
cd /opt
# download
git clone https://github.com/opensourcerouting/c-capnproto
cd c-capnproto
git submodule update --init --recursive
cd ..
git clone https://github.com/threefoldtech/0-flist
# building
cd c-capnproto
autoreconf -f -i -s
./configure
make ${makeopts}
make install
cd ..
cd 0-flist
cd libflist
make
cd ..
cd zflist
make embedded
cd ..
#
# rocksdb
#
apt-get install -y libtool gettext m4 autoconf libattr1-dev zlib1g-dev libmnl-dev
apt-get install -y libglib2.0-dev libxml2-dev liblz4-dev libsnappy-dev libbz2-dev libssl-dev liblzma-dev
ROCKSDB_VERSION="439855a7743a10bc036c7bc05563521500b83068"
ROCKSDB_CHECKSUM="331c51c2f8028c14e7c152c3c18d4c25"
ROCKSDB_LINK="https://github.com/facebook/rocksdb/archive/${ROCKSDB_VERSION}.tar.gz"
curl -L $ROCKSDB_LINK > /opt/rocksdb.tar.gz
tar -xvf rocksdb.tar.gz
cd rocksdb-*
PORTABLE=1 make ${makeopts} shared_lib
cp -arv librocksdb.so* /usr/local/lib/
cp -arv include/rocksdb /usr/local/include
ldconfig
#
# 0-fs and go
#
curl https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz > /tmp/go1.8.linux-amd64.tar.gz
tar -C /usr/local -xzf /tmp/go1.8.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
mkdir -p /gopath
export GOPATH=/gopath
go get -v -d github.com/threefoldtech/0-fs
cd $GOPATH/src/github.com/threefoldtech/0-fs
make
#
# final binaries
#
mkdir /opt/hub-converter
cp -av g8ufs /opt/hub-converter
cp -av /opt/0-flist/zflist/zflist /opt/hub-converter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment