Files
flatpak/tests/make-test-app.sh
Alexander Larsson 0fb2f362a8 tests: Move the test repo to a subdirectory (repos/test)
This makes the ostree trivial-httpd --autoexit feature work better,
because it seems to exit whenever the root directory changes (i.e. not
only when its deleted).

This means the root dir can't be the repo (because then we can't
update the repo), or the base testdir (because we create files there
too), so instead we make the repo $testdir/repos/test and
$testdir/repos as the httpd root.
2017-01-12 00:04:36 +01:00

60 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
set -e
DIR=`mktemp -d`
EXTRA="${1-}"
# Init dir
flatpak build-init ${DIR} org.test.Hello org.test.Platform org.test.Platform
mkdir -p ${DIR}/files/bin
cat > ${DIR}/files/bin/hello.sh <<EOF
#!/bin/sh
echo "Hello world, from a sandbox$EXTRA"
EOF
chmod a+x ${DIR}/files/bin/hello.sh
mkdir -p ${DIR}/files/share/applications
cat > ${DIR}/files/share/applications/org.test.Hello.desktop <<EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=Hello
Exec=hello.sh
Icon=org.test.Hello
MimeType=x-test/Hello;
EOF
mkdir -p ${DIR}/files/share/icons/hicolor/64x64/apps
cp $(dirname $0)/org.test.Hello.png ${DIR}/files/share/icons/hicolor/64x64/apps/
cp $(dirname $0)/org.test.Hello.png ${DIR}/files/share/icons/hicolor/64x64/apps/dont-export.png
mkdir -p ${DIR}/files/share/icons/HighContrast/64x64/apps
cp $(dirname $0)/org.test.Hello.png ${DIR}/files/share/icons/HighContrast/64x64/apps/
mkdir -p ${DIR}/files/share/app-info/xmls
mkdir -p ${DIR}/files/share/app-info/icons/flatpak/64x64
gzip -c > ${DIR}/files/share/app-info/xmls/org.test.Hello.xml.gz <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<components version="0.8">
<component type="desktop">
<id>org.test.Hello.desktop</id>
<name>Hello world test app</name>
<summary>Print a greeting</summary>
<description><p>This is a test app.</p></description>
<categories>
<category>Utility</category>
</categories>
<icon height="64" width="64" type="cached">64x64/org.gnome.gedit.png</icon>
</component>
</components>
EOF
cp $(dirname $0)/org.test.Hello.png ${DIR}/files/share/app-info/icons/flatpak/64x64/
flatpak build-finish --command=hello.sh ${DIR}
mkdir -p repos
flatpak build-export ${GPGARGS-} repos/test ${DIR}
rm -rf ${DIR}