aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2021-01-04 13:13:14 +0100
committertv <tv@krebsco.de>2021-01-14 23:33:16 +0100
commited69f746a38f00a8d2eec90057ff8cc247df4dd6 (patch)
treeb9126146a4fb6ebaf53b41f03ed2bdf339230079
parent29573adcbc37fbbf8aa29086854ae11c65c71eb4 (diff)
tabfs-wrapper: make logfile configurable
-rwxr-xr-xfs/tabfs-wrapper15
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/tabfs-wrapper b/fs/tabfs-wrapper
index 8e8523b..c331277 100755
--- a/fs/tabfs-wrapper
+++ b/fs/tabfs-wrapper
@@ -4,6 +4,19 @@ 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
@@ -37,4 +50,4 @@ esac
mkdir -p "$mountpoint"
-exec tabfs -f $extraArgs -odirect_io "$mountpoint"
+exec stdbuf -e0 tabfs -f $extraArgs -odirect_io "$mountpoint"