Skip to content

Instantly share code, notes, and snippets.

@maxux
Last active July 17, 2018 08:21
Show Gist options
  • Save maxux/3c42f3d102f0bbbe96ee383273b9e9d3 to your computer and use it in GitHub Desktop.
Save maxux/3c42f3d102f0bbbe96ee383273b9e9d3 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -ex
target="/tmp/g8ufs-debug"
zrfsbin="/opt/code/go/src/github.com/zero-os/0-fs/g8ufs"
[[ $UID != 0 ]] && (echo "[-] root privileges needed" && exit 1)
[[ -z $1 ]] && (echo "[-] missing flist url" && exit 1)
echo "[+] cleaning previous workspace"
rm -rf ${target}
echo "[+] creating temporary workspace"
mkdir -p "${target}"
mkdir -p "${target}/backend"
mkdir -p "${target}/db"
mkdir -p "${target}/target"
echo "[+] downloading flist"
flistfile="${target}/db/$(basename $1).tar.gz"
wget $1 -O "${flistfile}"
echo "[+] extracting flist"
tar -xf "${flistfile}" -C "${target}/db"
echo "[+] mounting flist [${target}/target]"
setsid -c "${zrfsbin}" -backend "${target}/backend" -debug -meta "${target}/db" -reset "${target}/target" || true
echo "[+] cleaning"
fusermount -u "${target}/target"
fusermount -u "${target}/backend/ro"
echo "[+] all done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment