Based on the rednoah/filebot image, linuxserver/transmission and others I stitched something together; I tried using the official image but it couldn't run as non-root user inside the container - almost required for file permissions.
I'm having some issues with the filebot.sh scripts though.
The way I set up the user running the torrent client, and therefore FileBot, is as a system user, without shell or a home directory, UIDs and GIDs get reassigned based on env variables (using s6-overlay).
Transmission config is in /transmission and FileBot data is supposed to be in /filebot, this is useful to have persistent volumes per-application.
The deb package, however, seems to require HOME to be set; it seems an easy fix, but assigning it would also move transmission config files which use XDG_CONFIG_HOME by default.
In short, which options are required and overridable to have everything FileBot needs to persist in a single directory (e.g. /filebot, not hidden), regardless of the user?
Below my attempt (unsuccessful as still tries to use HOME of the running user for some reason (4.8.5 from deb repository https://get.filebot.net/deb/), what did I miss?
Code: Select all
FILEBOT_OPTS=-Dapplication.deployment=docker \
-Dapplication.dir=/filebot \
-Dapplication.cache=/filebot/cache \ # persistent
-Djava.io.tmpdir="/tmp/filebot \ # volatile
-Dnet.filebot.util.prefs.file="/filebot/prefs.properties" \
-Duser.home="/filebot"
-Dnet.filebot.license="/filebot/license.txt" # is this a file or a directory?
Code: Select all
### DEB filebot.sh ###
FILEBOT_HOME="/usr/share/filebot"
JAVA_HOME="$FILEBOT_HOME/jre"
if [ -z "$HOME" ]; then
echo '$HOME must be set' # WHY?
exit 1
fi
# select application data folder
APP_DATA="$HOME/.filebot"
LIBRARY_PATH="$FILEBOT_HOME/lib"
"$JAVA_HOME/bin/java" \
-Dapplication.deployment=deb \ # overridden
-Dnet.filebot.AcoustID.fpcalc="$LIBRARY_PATH/fpcalc" \
-Dunixfs=false \
-DuseExtendedFileAttributes=true \
-DuseCreationDate=false \
-Djava.net.useSystemProxies=true \
-Djna.nosys=true \
-Djna.nounpack=true \
[illegal-access and add-opens] \
-Djna.boot.library.path="$LIBRARY_PATH" \
-Djna.library.path="$LIBRARY_PATH" \
-Djava.library.path="$LIBRARY_PATH" \
-Dapplication.dir="$APP_DATA" \ # overridden (?)
-Dapplication.cache="$APP_DATA/cache" \
-Djava.io.tmpdir="$APP_DATA/tmp" \
-Dfile.encoding="UTF-8" \
-Dsun.jnu.encoding="UTF-8" \
-Djdk.gtk.version=2 \
-Dsun.java2d.xrender=true \
-Dawt.useSystemAAFontSettings=on \
-Dswing.aatext=true \
-Dapplication.help=show \
-Dnet.filebot.UserFiles.fileChooser=JavaFX \
-DuseGVFS=true \
-Dnet.filebot.gio.GVFS="$XDG_RUNTIME_DIR/gvfs" \
$JAVA_OPTS \
$FILEBOT_OPTS \
-jar "$FILEBOT_HOME/jar/filebot.jar" "$@"
### TAR filebot.sh ###
#!/bin/sh
PRG="$0"
# resolve relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
# get canonical path
PRG_DIR=`dirname "$PRG"`
FILEBOT_HOME=`cd "$PRG_DIR" && pwd` # should default to directory where filebot.sh is
# make sure required environment variables are set
if [ -z "$USER" ]; then
export USER=`whoami`
fi
# add package lib folder to library path
PACKAGE_LIBRARY_ARCH="$(uname -s)-$(uname -m)"
PACKAGE_LIBRARY_PATH="$FILEBOT_HOME/lib/$PACKAGE_LIBRARY_ARCH"
# add fpcalc to the $PATH by default
export PATH="$PATH:$PACKAGE_LIBRARY_PATH"
# force JVM language and encoding settings
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
# choose archive extractor / media characteristics parser
case $PACKAGE_LIBRARY_ARCH in
Linux-x86_64|Linux-i686)
# i686 or x86_64
ARCHIVE_EXTRACTOR="SevenZipNativeBindings"
MEDIA_PARSER="libmediainfo"
;;
*)
# armv7l or aarch64
ARCHIVE_EXTRACTOR="ShellExecutables"
MEDIA_PARSER="ffprobe"
;;
esac
# select application data folder
APP_DATA="$FILEBOT_HOME/data/$USER"
LIBRARY_PATH="$PACKAGE_LIBRARY_PATH:$LD_LIBRARY_PATH"
# start filebot
java \
-Dapplication.deployment=tar
-Dnet.filebot.license="$FILEBOT_HOME/data/.license" \ # does this mean it's shared among users (?)
-Dnet.filebot.media.parser="$MEDIA_PARSER" \
-Dnet.filebot.archive.extractor="$ARCHIVE_EXTRACTOR" \
-Dunixfs=false \
-DuseExtendedFileAttributes=true \
-DuseCreationDate=false \
-Djava.net.useSystemProxies=true \
-Djna.nosys=true \
-Djna.nounpack=true \
-Djna.boot.library.path="$LIBRARY_PATH" \
-Djna.library.path="$LIBRARY_PATH" \
-Djava.library.path="$LIBRARY_PATH" \
-Dapplication.dir="$APP_DATA" \
-Dapplication.cache="$APP_DATA/cache" \
-Djava.io.tmpdir="$APP_DATA/tmp" \
-Dfile.encoding="UTF-8" \
-Dsun.jnu.encoding="UTF-8" \
-Duser.home="$APP_DATA" \
-Djava.util.prefs.PreferencesFactory=net.filebot.util.prefs.FilePreferencesFactory \
-Dnet.filebot.util.prefs.file="$APP_DATA/prefs.properties" \
$JAVA_OPTS \
$FILEBOT_OPTS \
-jar "$FILEBOT_HOME/jar/filebot.jar" "$@"