summaryrefslogtreecommitdiffstats
path: root/debian/tests/test-extension
blob: 460ed0fb774901cf9930b5df997d4b30bb826573 (plain)
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
#!/bin/bash
# autopkgtest check: Install a test extension (as smoketest would do)
# (c) 2017 Software in the Public Interest, Inc.
# Authors: Rene Engelhard <rene@debian.org>

set -e
set -E

if [ -n "$AUTOPKGTEST_TMP" ]; then
        TMP=`mktemp -q -p $AUTOPKGTEST_TMP`
else
        TMP=`mktemp -q`
fi

# skip if building as root:
# unopkg errors out with "ERROR: Cannot run unopkg as root without --shared or --bundled option."
# if ran as root
if [ `id -u` = "0" ]; then
	exit 77
fi

echo
echo "====== Add the extension ======"
# does it install fine?
unopkg add -v /usr/share/libreoffice/TestExtension.oxt

echo
echo "====== Show extension status ======"
# does it list? For whatever reason unopkg leaves a stale .lock behind when
# doing this grep directly on the output so do it on a tmpfile
unopkg list | tee $TMP
grep -q org.libreoffice.smoketest.TestExtension $TMP || exit 1
rm $TMP

echo
echo "====== Remove the extension ======"
# does it remove?
unopkg remove -v org.libreoffice.smoketest.TestExtension