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
|
#!/bin/bash
export PATH=${APPDIR}:${APPDIR}/usr/bin:$PATH
export LD_LIBRARY_PATH=${APPDIR}/usr/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${APPDIR}/usr/lib64:$LD_LIBRARY_PATH
export GI_TYPELIB_PATH=${APPDIR}/usr/lib/girepository-1.0
export PYTHONPATH=${APPDIR}/usr/lib/python2.7/site-packages:$PYTHONPATH
export PYTHONPATH=${APPDIR}/usr/lib64/python2.7/site-packages:$PYTHONPATH
function dependency_check_failed() {
# This checks 4 different ways to open error message in addition to
# throwing it to screen directly
echo "$1" >&2
[ -e /usr/bin/zenity ] && run_and_die /usr/bin/zenity --no-wrap --error --text "$1"
[ -e /usr/bin/yad ] && run_and_die /usr/bin/yad --error --text "$1"
echo "$1" > /tmp/depcheck.$$.txt
[ -e /usr/bin/Xdialog ] && run_and_die /usr/bin/Xdialog --textbox /tmp/depcheck.$$.txt 10 100
[ -e /usr/bin/xdg ] && run_and_die /usr/bin/xdg-open /tmp/depcheck.$$.txt
exit 1
}
function run_and_die() {
"$@"
exit 1
}
# Start
if [ "x$1" == "xbash" ] ; then
cd "${APPDIR}"
bash
else
# Check dependencies 1st
python2 -c "pass" \
|| dependency_check_failed "Please, install python package using"
python2 -c 'import gi; gi.require_version("Gtk", "3.0"); from gi.repository import Gtk' \
|| dependency_check_failed "Syncthing-GTK requires GTK and gobject-introspection packages.\n Please, install GTK3 and gobject-introspection packages using your package manager"
python2 -c 'import cairo;' \
|| dependency_check_failed "Cairo library is missing.\n Please, install cairo package using your package manager"
python2 ${APPDIR}/usr/bin/syncthing-gtk $@
fi
|