Last active
February 19, 2021 14:26
-
-
Save maxux/b4e07d03ed3cf4cb9a9dcffc53545dc4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
prefix="$HOME/.threefold" | |
echo "[+] prefix: $prefix" | |
echo "[+] creating default directories" | |
mkdir -p "${prefix}" | |
mkdir -p "${prefix}/bin" | |
mkdir -p "${prefix}/etc" | |
mkdir -p "${prefix}/lib" | |
mkdir -p "${prefix}/var/cache" | |
mkdir -p "${prefix}/var/tmp" | |
mkdir -p "${prefix}/mnt/zdbfs" | |
cd "${prefix}/var/tmp" | |
rm -rf * | |
echo "[+] downloading bootstrapper" | |
wget --quiet --show-progress https://github.com/threefoldtech/0-flist/releases/download/v2.0.1/zflist-2.0.1-amd64-linux-gnu | |
chmod +x zflist-2.0.1-amd64-linux-gnu | |
echo "[+] downloading metadata" | |
wget --quiet --show-progress https://hub.grid.tf/maxux42.3bot/zdbfs-0.1.2-linux-gnu.flist | |
chmod +x zflist-2.0.1-amd64-linux-gnu | |
ln -fs zflist-2.0.1-amd64-linux-gnu zflist | |
echo "[+] preparing metadata" | |
export ZFLIST_MNT="${prefix}"/var/tmp/flistmnt | |
./zflist open zdbfs-0.1.2-linux-gnu.flist | |
./zflist metadata backend --host hub.grid.tf --port 9900 | |
export ZFLIST_JSON=1 | |
export ZFLIST_PROGRESS=1 | |
echo "[+] extracting zdbfs dependencies" | |
for file in /bin/etcd /bin/zdb /bin/zdbfs /bin/zstor-v2 /lib/libfuse3.so.3.9.0; do | |
echo -n "[+] extracting dependency: $file " | |
./zflist get ${file} "${prefix}"/${file} | while read line; do echo -n .; done | |
chmod +x "${prefix}"/$file | |
echo " ok" | |
done | |
unset ZFLIST_PROGRESS | |
unset ZFLIST_JSON | |
echo "[+] cleaning up" | |
./zflist close | |
echo "====" | |
echo " ${prefix}/bin/zdb --index ${prefix}/var/tmp/zdb/index --data ${prefix}/var/tmp/zdb/data --mode seq --background" | |
echo " ${prefix}/bin/zdbfs -o autons ${prefix}/mnt/zdbfs" | |
echo "====" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment