#!/bin/sh

set -e

echo "Ensure apt integration is installed"
apt-config dump | grep -i Post-Invoke-Success | grep cnf-update-db

echo "Ensure apt update runs without errors"
apt-get update

echo "Ensure we have results from c-n-f"
/usr/lib/command-not-found --ignore-installed vim 2>&1 | grep vim
/usr/lib/command-not-found --ignore-installed vim 2>&1 | grep "command '.*' from deb "


echo "Add testuser"
adduser --gecos="no" --disabled-password testuser

echo "Ensure c-n-f works as user"
su -l testuser -c "/usr/lib/command-not-found --ignore-installed konsole" 2>&1 | grep konsole
