2016-06-22 00:35:51 +03:00
#!/bin/bash
#
# Copyright (C) 2016 Jonathan Lebon <jlebon@redhat.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
set -e
. ${ commondir } /libtest.sh
. ${ commondir } /libvm.sh
set -x
2016-07-04 18:43:02 +03:00
# SUMMARY: basic sanity check of package layering
# METHOD:
# Add a package, verify that it was added, then remove it, and verify that
# it was removed.
2016-06-22 00:35:51 +03:00
2016-07-04 18:43:02 +03:00
vm_send_test_repo
2016-06-22 00:35:51 +03:00
2016-07-04 18:43:02 +03:00
# make sure the package is not already layered
vm_assert_layered_pkg foo absent
2016-06-22 00:35:51 +03:00
2017-01-13 22:23:33 +03:00
# Be sure an unprivileged user exists
vm_cmd getent passwd bin
if vm_cmd "runuser -u bin rpm-ostree pkg-add foo-1.0" ; then
assert_not_reached "Was able to install a package as non-root!"
fi
2017-01-17 21:29:48 +03:00
vm_rpmostree pkg-add foo-1.0
2016-06-22 00:35:51 +03:00
echo "ok pkg-add foo"
vm_reboot
2016-11-14 22:28:38 +03:00
vm_assert_layered_pkg foo-1.0 present
2016-07-04 18:43:02 +03:00
echo "ok pkg foo added"
2016-06-22 00:35:51 +03:00
2016-07-04 18:43:02 +03:00
if ! vm_cmd /usr/bin/foo | grep "Happy foobing!" ; then
2016-06-22 00:35:51 +03:00
assert_not_reached "foo printed wrong output"
fi
echo "ok correct output"
2017-02-04 02:18:23 +03:00
# check that root is a shared mount
# https://bugzilla.redhat.com/show_bug.cgi?id=1318547
if ! vm_cmd "findmnt / -no PROPAGATION" | grep shared; then
assert_not_reached "root is not mounted shared"
fi
2017-01-17 21:29:48 +03:00
vm_rpmostree pkg-remove foo-1.0
2016-07-04 18:43:02 +03:00
echo "ok pkg-remove foo"
2016-06-22 00:35:51 +03:00
vm_reboot
2016-07-04 18:43:02 +03:00
vm_assert_layered_pkg foo absent
echo "ok pkg foo removed"