5 # this script attempts to package appimagetool as an AppImage with... surprise, appimagetool
7 tempdir
=$
(mktemp
-d /tmp
/appimage-test.XXXXXXXX
)
8 thisdir
=$
(dirname $
(readlink
-f "$0"))
10 export PATH
="$thisdir/squashfs-tools/squashfs-tools:$PATH"
12 appimagetool
=$
(readlink
-f "$1")
14 if [ ! -x "$appimagetool" ]; then
15 echo "Usage: $0 <path to appimagetool>"
19 cleanup
() { rm -r "$tempdir"; }
24 if [ "$TRAVIS" == true
]; then
25 # TODO: find way to get colored log on Travis
28 log
() { echo "$(tput setaf 2)$(tput bold)$*$(tput sgr0)"; }
31 log
"create a sample AppDir"
32 mkdir
-p appimagetool.AppDir
/usr
/share
/metainfo
/
33 cp "$thisdir"/resources
/{appimagetool.
*,AppRun
} appimagetool.AppDir
/
34 cp "$thisdir"/resources
/usr
/share
/metainfo
/appimagetool.appdata.xml appimagetool.AppDir
/usr
/share
/metainfo
/
35 cp "$appimagetool" appimagetool.AppDir
/
36 mkdir
-p appimagetool.AppDir
/usr
/share
/applications
37 cp appimagetool.AppDir
/appimagetool.desktop appimagetool.AppDir
/usr
/share
/applications
39 log
"create a file that should be ignored"
40 touch appimagetool.AppDir
/to-be-ignored
42 log
"create an AppImage without an ignore file to make sure it is bundled"
43 $appimagetool appimagetool.AppDir appimagetool.AppImage ||
exit $?
44 $appimagetool -l appimagetool.AppImage |
grep -q to-be-ignored ||
exit 1
46 log
"now set up the ignore file, and check that the file is properly ignored"
47 echo "to-be-ignored" > .appimageignore
48 $appimagetool appimagetool.AppDir appimagetool.AppImage
49 $appimagetool -l appimagetool.AppImage |
grep -q to-be-ignored
&& exit 1 || true
51 log
"remove the default ignore file, and check if an explicitly passed one works, too"
53 log
"to-be-ignored" > ignore
54 $appimagetool appimagetool.AppDir appimagetool.AppImage
--exclude-file ignore ||
exit $?
55 $appimagetool -l appimagetool.AppImage |
grep -q to-be-ignored
&& exit 1 || true
57 log
"check whether files in both .appimageignore and the explicitly passed file work"
58 touch appimagetool.AppDir
/to-be-ignored-too
59 echo "to-be-ignored-too" > .appimageignore
60 $appimagetool appimagetool.AppDir appimagetool.AppImage
--exclude-file ignore ||
exit $?
61 $appimagetool -l appimagetool.AppImage |
grep -q to-be-ignored
&& exit 1 || true
62 $appimagetool -l appimagetool.AppImage |
grep -q to-be-ignored-too
&& exit 1 || true