Skip to content

Commit

Permalink
Added AppImage support
Browse files Browse the repository at this point in the history
  • Loading branch information
kozec committed Feb 18, 2018
1 parent e8a328b commit ad741f4
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
28 changes: 28 additions & 0 deletions appimage-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
APP="syncthing-gtk"
EXEC="syncthing-gtk"
[ x"$BUILD_APPDIR" == "x" ] && BUILD_APPDIR=$(pwd)/appimage

set -ex # display commands, terminate after 1st failure

# Prepare & build
mkdir -p ${BUILD_APPDIR}/usr
python2 setup.py build
python2 setup.py install --prefix ${BUILD_APPDIR}/usr

# Move & patch desktop file
mv ${BUILD_APPDIR}/usr/share/applications/${APP}.desktop ${BUILD_APPDIR}/
sed -i "s/Icon=.*/Icon=${APP}/g" ${BUILD_APPDIR}/${APP}.desktop

# Copy
cp -H icons/${APP}.png ${BUILD_APPDIR}/${APP}.png

# Copy appdata.xml
mkdir -p ${BUILD_APPDIR}/usr/share/metainfo/
cp scripts/${APP}.appdata.xml ${BUILD_APPDIR}/usr/share/metainfo/${APP}.appdata.xml

# Copy AppRun script
cp scripts/appimage-AppRun.sh ${BUILD_APPDIR}/AppRun
chmod +x ${BUILD_APPDIR}/AppRun

echo "Run appimagetool ${BUILD_APPDIR} to finish prepared appimage"
36 changes: 36 additions & 0 deletions scripts/appimage-AppRun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/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 PYTHONPATH=${APPDIR}/usr/lib/python2.7/site-packages:$PYTHONPATH
export PYTHONPATH=${APPDIR}/usr/lib64/python2.7/site-packages:$PYTHONPATH
export SCC_SHARED=${APPDIR}/usr/share/scc

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
}

# Check dependencies 1st
python2 -c 'import gi' \
|| dependency_check_failed "Please, install python-gobject package using your package manager"
python2 -c 'import gi; gi.require_version("Gtk", "3.0")' \
|| dependency_check_failed "Syncthing-GTK requires GTK. Please, install GTK3 package using your package manager"
python2 -c 'import bcrypt' || dependency_check_failed "Please, install python-bcrypt package using your package manager"
python2 -c 'import dateutil' || dependency_check_failed "Please, install python-dateutil package using your package manager"

# Start
python2 ${APPDIR}/usr/bin/syncthing-gtk $@
23 changes: 23 additions & 0 deletions scripts/syncthing-gtk.appdata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>syncthing-gtk.desktop</id>
<name>Syncthing GTK</name>
<summary>GUI for Syncthing</summary>
<developer_name>kozec</developer_name>
<description>
<p>
GTK3 &amp; Python based GUI and notification area icon for Syncthing
</p>
</description>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0</project_license>
<url type="bugtracker">https://github.com/syncthing/syncthing-gtk/issues</url>
<url type="donation">https://www.paypal.com/cgi-bin/webscr?cmd=_donations&amp;business=77DQD3L9K8RPU&amp;lc=SK&amp;item_name=kozec&amp;item_number=scc&amp;currency_code=EUR&amp;bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted</url>
<url type="homepage">https://github.com/syncthing/syncthing-gtk/</url>
<screenshots>
<screenshot type="default">
<caption>Main Application Window</caption>
<image width="987" height="483">http://i.imgur.com/RTRgRdC.png</image>
</screenshot>
</screenshots>
</component>

0 comments on commit ad741f4

Please sign in to comment.