#!/bin/sh
set -e
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
setupenvironment
configarchitecture 'i386'
buildsimplenativepackage 'cool' 'i386' '1.0' 'unstable'
+msgmsg 'default setup'
setupaptarchive
aptgetupdate() {
rm -rf rootdir/var/lib/apt/ rootdir/var/cache/apt/*.bin
- aptget update -qq
+ ${1:-testwarning} aptget update --allow-insecure-repositories
}
-PKGTEXT="$(aptget install cool --assume-no -d | head -n 7)"
-DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.list'
+PKGTEXT="$(aptget install cool --assume-no -d | head -n 8)"
+DOWNLOG="$(echo "$PKGTEXT" | tail -n 1)"
+PKGTEXT="$(echo "$PKGTEXT" | head -n 7)"
+DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-*.list'
-testequal "$PKGTEXT
+testsuccessequal "$PKGTEXT
+$DOWNLOG
Download complete and in download only mode" aptget install cool --assume-no -d
-sed -i -e 's#deb#deb [trusted=no]#' $DEBFILE
-aptgetupdate
+testsuccessequal "$PKGTEXT
+$DOWNLOG
+Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated
+
+msgmsg 'sources marked trusted=no'
+sed -i -e 's#\(deb\(-src\)\?\) #\1 [trusted=no] #' $DEBFILE
+aptgetupdate 'testsuccess'
-testequal "$PKGTEXT
+testfailureequal "$PKGTEXT
WARNING: The following packages cannot be authenticated!
cool
-Install these packages without verification [y/N]? N
+Install these packages without verification? [y/N] N
E: Some packages could not be authenticated" aptget install cool --assume-no -d
+configarchitecture 'amd64' 'i386'
+testequal "$(echo "$PKGTEXT" | sed 's#cool$#cool:i386#g')
+WARNING: The following packages cannot be authenticated!
+ cool:i386
+Authentication warning overridden.
+$DOWNLOG
+Download complete and in download only mode" aptget install cool:i386 --assume-no -d --allow-unauthenticated
+configarchitecture 'i386'
+
find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
-sed -i -e 's#deb \[trusted=no\]#deb#' $DEBFILE
+msgmsg 'unsigned repo'
+sed -i -e 's#\(deb\(-src\)\?\) \[trusted=no\] #\1 #' $DEBFILE
aptgetupdate
-testequal "$PKGTEXT
+testfailureequal "$PKGTEXT
WARNING: The following packages cannot be authenticated!
cool
-Install these packages without verification [y/N]? N
+Install these packages without verification? [y/N] N
E: Some packages could not be authenticated" aptget install cool --assume-no -d
-sed -i -e 's#deb#deb [trusted=yes]#' $DEBFILE
-aptgetupdate
+testsuccessequal "$PKGTEXT
+WARNING: The following packages cannot be authenticated!
+ cool
+Authentication warning overridden.
+$DOWNLOG
+Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated
+
+msgmsg 'sources marked trusted=yes'
+sed -i -e 's#\(deb\(-src\)\?\) #\1 [trusted=yes] #' $DEBFILE
+aptgetupdate 'testsuccess'
-testequal "$PKGTEXT
+testsuccessequal "$PKGTEXT
+$DOWNLOG
Download complete and in download only mode" aptget install cool --assume-no -d