filebot/installer/snappy/filebot.sh

122 lines
4.3 KiB
Bash
Raw Normal View History

#!/bin/bash
2016-05-22 06:24:06 +00:00
export LANG=C.UTF-8
export ARCH=x86_64-linux-gnu
2016-05-18 07:21:25 +00:00
2016-05-22 06:24:06 +00:00
export JAVA_HOME=$SNAP/oracle-java
export PATH=$JAVA_HOME/jre/bin:$PATH
2016-05-19 20:24:52 +00:00
2016-05-22 06:24:06 +00:00
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/$SNAP_ARCH/jli:$JAVA_HOME/jre/lib/$SNAP_ARCH:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/gtk-2.0/2.10.0/engines:$SNAP/usr/lib/$ARCH/gtk-2.0/modules:$SNAP/usr/lib/$ARCH/pulseaudio:$LD_LIBRARY_PATH
2016-06-14 15:03:47 +00:00
export LD_LIBRARY_PATH=$SNAP/filebot/lib/$SNAP_ARCH:$LD_LIBRARY_PATH
2016-05-19 20:24:52 +00:00
2016-05-22 06:24:06 +00:00
export GDK_PIXBUF_MODULEDIR=$SNAP/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0
export GDK_PIXBUF_MODULE_FILE=$SNAP/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
2016-05-19 20:24:52 +00:00
2016-05-22 06:24:06 +00:00
export GTK2_RC_FILES=$SNAP/usr/share/themes/Ambiance/gtk-2.0/gtkrc
export GTK_THEME=$SNAP/usr/share/themes/Ambiance/gtk-3.0/gtk.css
2016-05-19 20:24:52 +00:00
2016-05-22 06:24:06 +00:00
export GTK_PATH=$SNAP/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0
export GTK_MODULES=
export GTK2_MODULES=
2016-05-18 07:21:25 +00:00
2016-05-22 06:24:06 +00:00
export XKB_CONFIG_ROOT=$SNAP/usr/share/X11/xkb
2016-05-19 20:24:52 +00:00
2016-05-22 06:24:06 +00:00
export XDG_CONFIG_DIRS=$SNAP/usr/xdg:$SNAP/etc/xdg:$XDG_CONFIG_DIRS
export XDG_DATA_DIRS=$SNAP/usr/share:$SNAP_USER_DATA:$XDG_DATA_DIRS
2016-05-19 20:24:52 +00:00
2016-05-22 06:24:06 +00:00
export FONTCONFIG_PATH=$SNAP/etc/fonts/config.d
export FONTCONFIG_FILE=$SNAP/etc/fonts/fonts.conf
2016-05-21 19:39:07 +00:00
2016-05-22 06:24:06 +00:00
export LIBGL_DRIVERS_PATH=$SNAP/usr/lib/$ARCH/dri
2016-05-21 19:39:07 +00:00
2016-05-22 06:24:06 +00:00
# export JAVA_TOOL_OPTIONS=-javaagent:$SNAP/usr/share/java/jayatanaag.jar
# export JAVA_OPTS=-Dsun.java2d.opengl=True
2016-06-15 17:18:04 +00:00
export JAVA_OPTS=-Dsun.java2d.xrender=True
2016-05-21 22:02:58 +00:00
2016-05-22 06:24:06 +00:00
export APP_ROOT=$SNAP/filebot
export APP_DATA=$SNAP_USER_DATA/data
export APP_CACHE=$SNAP_USER_DATA/cache
export APP_PREFS=$SNAP_USER_DATA/prefs
2016-05-21 19:39:07 +00:00
# Set XDG_DATA_HOME to local path, dependent on snap version
export XDG_DATA_HOME=$SNAP_USER_DATA/XDG/data-$SNAP_VERSION
export XDG_DATA_DIRS=$XDG_DATA_HOME:$XDG_DATA_DIRS
mkdir -p $XDG_DATA_HOME
# Set cache folder to local path, dependent on snap version
export XDG_CACHE_HOME=$SNAP_USER_DATA/XDG/cache-$SNAP_VERSION
mkdir -p $XDG_CACHE_HOME
# Not good, needed for fontconfig and themes
ln -sf $SNAP/usr/share/{fonts,themes} $XDG_DATA_HOME
# Build mime.cache
if [ ! -d $XDG_DATA_HOME/mime ]; then
cp -r $SNAP/usr/share/mime $XDG_DATA_HOME
$SNAP/usr/bin/update-mime-database $XDG_DATA_HOME/mime
fi
# Setup GDK pixbuf loaders
export GDK_PIXBUF_MODULE_FILE=$XDG_CACHE_HOME/gdk-pixbuf-loaders.cache
export GDK_PIXBUF_MODULEDIR=$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/2.10.0/loaders
if [ ! -e $GDK_PIXBUF_MODULE_FILE ]; then
$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders > $GDK_PIXBUF_MODULE_FILE
fi
2016-06-15 17:18:04 +00:00
# Gio modules and cache
export GIO_MODULE_DIR=$XDG_CACHE_HOME/gio-modules
if [ ! -d $GIO_MODULE_DIR ]; then
mkdir -p $GIO_MODULE_DIR
ln -sf $SNAP/usr/lib/$ARCH/gio/modules/*.so $GIO_MODULE_DIR
$SNAP/usr/lib/$ARCH/glib-2.0/gio-querymodules $GIO_MODULE_DIR
fi
# Keep an array of data dirs, for looping through them
IFS=':' read -r -a data_dirs_array <<< "$XDG_DATA_DIRS"
2016-06-15 17:18:04 +00:00
# Setup compiled gsettings schema
GS_SCHEMA_DIR=$XDG_DATA_HOME/glib-2.0/schemas
if [ ! -d $GS_SCHEMA_DIR ]; then
mkdir -p $GS_SCHEMA_DIR
for d in "${data_dirs_array[@]}"; do
if [ -d "$d/glib-2.0/schemas" ]; then
# hack for empty system schemas dir
if [ "$d" != "/usr/share/" ]; then
ln -sf $d/glib-2.0/schemas/* $GS_SCHEMA_DIR
fi
fi
done
$SNAP/usr/lib/$ARCH/glib-2.0/glib-compile-schemas $GS_SCHEMA_DIR
fi
# Icon themes cache
if [ ! -d $XDG_DATA_HOME/icons ]; then
mkdir -p $XDG_DATA_HOME/icons
for d in "${data_dirs_array[@]}"; do
for i in $d/icons/*; do
if [ -d "$i" ]; then
theme_dir=$XDG_DATA_HOME/icons/$(basename "$i")
mkdir -p "$theme_dir"
ln -sf $i/* "$theme_dir"
$SNAP/usr/sbin/update-icon-caches "$theme_dir"
fi
done
done
fi
2016-06-15 17:18:04 +00:00
cd "$SNAP_USER_DATA"
2016-06-07 17:33:39 +00:00
java -Duser.home="$SNAP_USER_DATA" -Djava.library.path="$LD_LIBRARY_PATH" -Djna.library.path="$LD_LIBRARY_PATH" -Dunixfs=false -DuseGVFS=true -DuseExtendedFileAttributes=true -DuseCreationDate=false -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Djava.net.useSystemProxies=true -Dapplication.update=skip -Dapplication.deployment=usc -Dnet.filebot.UserFiles.fileChooser=JavaFX -Dapplication.dir="$APP_DATA" -Dapplication.cache="$APP_CACHE/ehcache.disk.store" -Djava.io.tmpdir="$APP_CACHE/java.io.tmpdir" -Djava.util.prefs.userRoot="$APP_PREFS/user" -Djava.util.prefs.systemRoot="$APP_PREFS/system" -Dnet.filebot.AcoustID.fpcalc="$SNAP/usr/bin/fpcalc" $JAVA_OPTS -jar "$APP_ROOT/FileBot.jar" "$@"