#!/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>

# HACK - Temporarily disable on armhf
if [ $(dpkg --print-architecture) == "armhf" ]; then
  exit 0
fi
# HACK

set -e
set -E

if [ -n "$AUTOPKGTEST_TMP" ]; then
        TMP=`mktemp -q -p $AUTOPKGTEST_TMP`
else
        TMP=`mktemp -q`
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


