#!/bin/sh
# ollie-remount — unmount and remount the ollie 9pfuse mount.
# Intended to recover a stale FUSE mount after sleep/wake.

set -e

OLLIE="${OLLIE:-$HOME/mnt/ollie}"
NAMESPACE="${NAMESPACE:-/tmp/ns.$(id -un).$(echo "${DISPLAY:-:0}" | tr / _)}"
SOCK="$NAMESPACE/ollie"

echo $NAMESPACE
echo $SOCK

sudo umount -f "$OLLIE" 2>/dev/null || true
9pfuse "$SOCK" "$OLLIE"
