blob: c3312779d1121b37c51634886e6a9f11fe68586d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#! /bin/sh
set -efu
# allow wrapper to find tabfs executable
PATH=$(dirname "$0")${PATH:+:$PATH}
if test -n "${TABFS_LOGFILE-}"; then
logfile=$TABFS_LOGFILE
elif test -n "${XDG_CACHE_HOME-}"; then
logfile=$XDG_CACHE_HOME/tabfs/log
elif test -n "${HOME-}"; then
logfile=$HOME/.tabfs/log
else
logfile=log.txt
fi
mkdir -p "$(dirname "$logfile")"
exec 2>>"$logfile"
if test -n "${TABFS_MOUNTPOINT-}"; then
mountpoint=$TABFS_MOUNTPOINT
elif test -n "${XDG_RUNTIME_DIR-}"; then
mountpoint=$XDG_RUNTIME_DIR/tabfs/mnt
elif test -n "${HOME-}"; then
mountpoint=$HOME/.tabfs/mnt
else
mountpoint=mnt
fi
pgrep tabfs | grep -v ^$$\$ | xargs kill -9 2>/dev/null || :
OS=$(uname -s)
case $OS in
Darwin)
diskutil umount force "$mountpoint" >/dev/null || :
extraArgs=
;;
FreeBSD)
umount -f "$mountpoint" 2>/dev/null || :
extraArgs=
;;
Linux)
fusermount -u "$mountpoint" 2>/dev/null || :
extraArgs=-oauto_unmount
;;
*)
echo "tabfs-wrapper: error: unknown OS: $OS" >&2
exit 2
esac
mkdir -p "$mountpoint"
exec stdbuf -e0 tabfs -f $extraArgs -odirect_io "$mountpoint"
|