New upstream version 2019.1
This commit is contained in:
commit
72f5087561
73 files changed
+3173
-1997
No files matched your search
+50
-4
@@ -21,7 +21,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..$((85 + ${extra_basic_tests:-0}))"
|
||||
echo "1..$((88 + ${extra_basic_tests:-0}))"
|
||||
|
||||
CHECKOUT_U_ARG=""
|
||||
CHECKOUT_H_ARGS="-H"
|
||||
@@ -364,6 +364,39 @@ if ! skip_one_without_user_xattrs; then
|
||||
echo "ok pull-local --bareuseronly-files"
|
||||
fi
|
||||
|
||||
rm repo2 -rf
|
||||
ostree_repo_init repo2 --mode="$mode"
|
||||
$CMD_PREFIX ostree --repo=repo2 pull-local --untrusted repo test2
|
||||
target_file_object=$(ostree_file_path_to_relative_object_path repo test2 baz/saucer)
|
||||
target_file_checksum=$(ostree_file_path_to_checksum repo test2 baz/saucer)
|
||||
assert_files_hardlinked repo{,2}/${target_file_object}
|
||||
echo "ok pull-local hardlinking, untrusted"
|
||||
|
||||
if grep -q 'mode=bare' repo/config; then
|
||||
# Now copy/corrupt an object in a 3rd repo, pull into 2nd (leaving the first pristine)
|
||||
rm repo{2,3} -rf
|
||||
ostree_repo_init repo2 --mode="$mode"
|
||||
ostree_repo_init repo3 --mode="$mode"
|
||||
# Pull into 3rd repo, corrupt an object
|
||||
$CMD_PREFIX ostree --repo=repo3 pull-local repo test2
|
||||
cp -a --reflink=auto repo3/${target_file_object}{,.tmp}
|
||||
mv repo3/${target_file_object}{.tmp,}
|
||||
echo blah >> repo3/${target_file_object}
|
||||
if $CMD_PREFIX ostree --repo=repo2 pull-local --untrusted repo3 2>err.txt; then
|
||||
assert_not_reached "pulled --untrusted from corrupted repo"
|
||||
fi
|
||||
assert_file_has_content err.txt 'Corrupted.*'${target_file_checksum}
|
||||
rm -f err.txt
|
||||
# But this one should succeed
|
||||
$CMD_PREFIX ostree --repo=repo2 pull-local repo3
|
||||
if $CMD_PREFIX ostree --repo=repo2 fsck 2>err.txt; then
|
||||
fatal "repo should have pulled corrupted object"
|
||||
fi
|
||||
assert_file_has_content err.txt 'Corrupted.*'${target_file_checksum}
|
||||
fi
|
||||
echo "ok pull-local --untrusted corruption"
|
||||
rm repo{2,3} -rf
|
||||
|
||||
# This is mostly a copy of the suid test in test-basic-user-only.sh,
|
||||
# but for the `pull --bareuseronly-files` case.
|
||||
cd ${test_tmpdir}
|
||||
@@ -385,7 +418,7 @@ echo "ok pull-local (bareuseronly files)"
|
||||
|
||||
if ! skip_one_without_user_xattrs; then
|
||||
cd ${test_tmpdir}
|
||||
${CMD_PREFIX} ostree --repo=repo2 checkout ${CHECKOUT_U_ARG} test2 test2-checkout-from-local-clone
|
||||
${CMD_PREFIX} ostree --repo=repo checkout ${CHECKOUT_U_ARG} test2 test2-checkout-from-local-clone
|
||||
cd test2-checkout-from-local-clone
|
||||
assert_file_has_content yet/another/tree/green 'leaf'
|
||||
echo "ok local clone checkout"
|
||||
@@ -762,7 +795,19 @@ echo "ok subdir noent"
|
||||
|
||||
if ! skip_one_without_user_xattrs; then
|
||||
cd ${test_tmpdir}
|
||||
mkdir repo3
|
||||
mkdir repo4
|
||||
ostree_repo_init repo4 --mode=bare-user
|
||||
${CMD_PREFIX} ostree --repo=repo4 pull-local --commit-metadata-only repo test2
|
||||
csum1=$($OSTREE rev-parse test2)
|
||||
csum2=$(${CMD_PREFIX} ostree --repo=repo4 rev-parse test2)
|
||||
assert_streq "${csum1}" "${csum2}"
|
||||
test -f repo4/state/$csum1.commitpartial
|
||||
echo "ok pull-local --commit-metadata-only"
|
||||
rm -rf repo4
|
||||
fi
|
||||
|
||||
if ! skip_one_without_user_xattrs; then
|
||||
cd ${test_tmpdir}
|
||||
ostree_repo_init repo3 --mode=bare-user
|
||||
${CMD_PREFIX} ostree --repo=repo3 pull-local --remote=aremote repo test2
|
||||
${CMD_PREFIX} ostree --repo=repo3 rev-parse aremote/test2
|
||||
@@ -1034,7 +1079,7 @@ echo "ok test error pre commit/bootid"
|
||||
# Whiteouts
|
||||
cd ${test_tmpdir}
|
||||
mkdir -p overlay/baz/
|
||||
if touch overlay/baz/.wh.cow && touch overlay/.wh.deeper; then
|
||||
if touch overlay/baz/.wh.cow && touch overlay/.wh.deeper && touch overlay/baz/another/.wh..wh..opq; then
|
||||
touch overlay/anewfile
|
||||
mkdir overlay/anewdir/
|
||||
touch overlay/anewdir/blah
|
||||
@@ -1050,6 +1095,7 @@ if touch overlay/baz/.wh.cow && touch overlay/.wh.deeper; then
|
||||
assert_not_has_dir overlay-co/deeper
|
||||
assert_has_file overlay-co/anewdir/blah
|
||||
assert_has_file overlay-co/anewfile
|
||||
assert_not_has_file overlay-co/baz/another/y
|
||||
|
||||
# And test replacing a directory wholesale with a symlink as well as a regular file
|
||||
mkdir overlay
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The builtin grub.cfg generator.
|
||||
# The builtin grub.cfg generator. This script is called by
|
||||
# ostree/src/libostree/ostree-bootloader-grub2.c whenever boot loader
|
||||
# configuration file needs to be updated on systems which do not use
|
||||
# grub2-mkconfig (and thus, the `ostree admin instutil grub2-generate` path).
|
||||
#
|
||||
# This script is called by ostree/src/libostree/ostree-bootloader-grub2.c whenever
|
||||
# boot loader configuration file needs to be updated. It can be used as a template
|
||||
# for a custom grub.cfg generator. What to consider when writing a custom grub.cfg
|
||||
# generator:
|
||||
# It can be used as a template for a custom grub.cfg generator. What to consider
|
||||
# when writing a custom grub.cfg generator:
|
||||
#
|
||||
# - The populate_menu() function converts boot loader entries as defined by
|
||||
# https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ into GRUB2
|
||||
@@ -32,6 +33,7 @@ read_config()
|
||||
initrd=""
|
||||
options=""
|
||||
linux=""
|
||||
devicetree=""
|
||||
|
||||
while read -r line
|
||||
do
|
||||
@@ -47,6 +49,9 @@ read_config()
|
||||
"linux")
|
||||
linux=${value}
|
||||
;;
|
||||
"devicetree")
|
||||
devicetree=${value}
|
||||
;;
|
||||
"options")
|
||||
options=${value}
|
||||
;;
|
||||
@@ -73,6 +78,9 @@ populate_menu()
|
||||
if [ -n "${initrd}" ] ; then
|
||||
menu="${menu}\t initrd ${boot_prefix}${initrd}\n"
|
||||
fi
|
||||
if [ -n "${devicetree}" ] ; then
|
||||
menu="${menu}\t devicetree ${boot_prefix}${devicetree}\n"
|
||||
fi
|
||||
menu="${menu}}\n\n"
|
||||
done
|
||||
# The printf command seems to be more reliable across shells for special character (\n, \t) evaluation
|
||||
|
||||
Executable
+149
@@ -0,0 +1,149 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2019 Rafael Fonseca <r4f4rfs@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-2.0+
|
||||
#
|
||||
# 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 -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
setup_os_repository_signed () {
|
||||
mode=$1
|
||||
shift
|
||||
bootmode=$1
|
||||
shift
|
||||
bootdir=${1:-usr/lib/modules/3.6.0}
|
||||
|
||||
oldpwd=`pwd`
|
||||
keyid="472CDAFA"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
mkdir testos-repo
|
||||
if test -n "$mode"; then
|
||||
ostree_repo_init testos-repo --mode=${mode}
|
||||
else
|
||||
ostree_repo_init testos-repo
|
||||
fi
|
||||
|
||||
cd ${test_tmpdir}
|
||||
mkdir osdata
|
||||
cd osdata
|
||||
kver=3.6.0
|
||||
mkdir -p usr/bin ${bootdir} usr/lib/modules/${kver} usr/share usr/etc
|
||||
kernel_path=${bootdir}/vmlinuz
|
||||
initramfs_path=${bootdir}/initramfs.img
|
||||
# /usr/lib/modules just uses "vmlinuz", since the version is in the module
|
||||
# directory name.
|
||||
if [[ $bootdir != usr/lib/modules/* ]]; then
|
||||
kernel_path=${kernel_path}-${kver}
|
||||
initramfs_path=${bootdir}/initramfs-${kver}.img
|
||||
fi
|
||||
echo "a kernel" > ${kernel_path}
|
||||
echo "an initramfs" > ${initramfs_path}
|
||||
bootcsum=$(cat ${kernel_path} ${initramfs_path} | sha256sum | cut -f 1 -d ' ')
|
||||
export bootcsum
|
||||
# Add the checksum for legacy dirs (/boot, /usr/lib/ostree-boot), but not
|
||||
# /usr/lib/modules.
|
||||
if [[ $bootdir != usr/lib/modules/* ]]; then
|
||||
mv ${kernel_path}{,-${bootcsum}}
|
||||
mv ${initramfs_path}{,-${bootcsum}}
|
||||
fi
|
||||
|
||||
echo "an executable" > usr/bin/sh
|
||||
echo "some shared data" > usr/share/langs.txt
|
||||
echo "a library" > usr/lib/libfoo.so.0
|
||||
ln -s usr/bin bin
|
||||
cat > usr/etc/os-release <<EOF
|
||||
NAME=TestOS
|
||||
VERSION=42
|
||||
ID=testos
|
||||
VERSION_ID=42
|
||||
PRETTY_NAME="TestOS 42"
|
||||
EOF
|
||||
echo "a config file" > usr/etc/aconfigfile
|
||||
mkdir -p usr/etc/NetworkManager
|
||||
echo "a default daemon file" > usr/etc/NetworkManager/nm.conf
|
||||
mkdir -p usr/etc/testdirectory
|
||||
echo "a default daemon file" > usr/etc/testdirectory/test
|
||||
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.9 -b testos/buildmaster/x86_64-runtime -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome
|
||||
|
||||
# Ensure these commits have distinct second timestamps
|
||||
sleep 2
|
||||
echo "a new executable" > usr/bin/sh
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.10 -b testos/buildmaster/x86_64-runtime -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome
|
||||
|
||||
cd ${test_tmpdir}
|
||||
cp -a osdata osdata-devel
|
||||
cd osdata-devel
|
||||
mkdir -p usr/include
|
||||
echo "a development header" > usr/include/foo.h
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string version=1.0.9 -b testos/buildmaster/x86_64-devel -s "Build" --gpg-sign=$keyid --gpg-homedir=${test_tmpdir}/gpghome
|
||||
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo fsck -q
|
||||
|
||||
cd ${test_tmpdir}
|
||||
mkdir sysroot
|
||||
export OSTREE_SYSROOT=sysroot
|
||||
${CMD_PREFIX} ostree admin init-fs sysroot
|
||||
if test -n "${OSTREE_NO_XATTRS:-}"; then
|
||||
echo -e 'disable-xattrs=true\n' >> sysroot/ostree/repo/config
|
||||
fi
|
||||
${CMD_PREFIX} ostree admin os-init testos
|
||||
|
||||
case $bootmode in
|
||||
"syslinux")
|
||||
setup_os_boot_syslinux
|
||||
;;
|
||||
"uboot")
|
||||
setup_os_boot_uboot
|
||||
;;
|
||||
*grub2*)
|
||||
setup_os_boot_grub2 "${bootmode}"
|
||||
;;
|
||||
esac
|
||||
|
||||
cd ${test_tmpdir}
|
||||
mkdir ${test_tmpdir}/httpd
|
||||
cd httpd
|
||||
ln -s ${test_tmpdir} ostree
|
||||
${OSTREE_HTTPD} --autoexit --daemonize -p ${test_tmpdir}/httpd-port
|
||||
port=$(cat ${test_tmpdir}/httpd-port)
|
||||
echo "http://127.0.0.1:${port}" > ${test_tmpdir}/httpd-address
|
||||
cd ${oldpwd}
|
||||
}
|
||||
|
||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||
setup_os_repository_signed "archive" "syslinux"
|
||||
|
||||
echo "1..2"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add testos $(cat httpd-address)/ostree/testos-repo
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --gpg-verify=true --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||
# This initial deployment gets kicked off with some kernel arguments
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
|
||||
|
||||
echo "ok deploy command"
|
||||
|
||||
${CMD_PREFIX} ostree admin status > status.txt
|
||||
test -f status.txt
|
||||
assert_file_has_content status.txt "GPG: Signature made"
|
||||
assert_not_file_has_content status.txt "GPG: Can't check signature: public key not found"
|
||||
echo 'ok gpg signature'
|
||||
@@ -33,21 +33,21 @@ ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testo
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
|
||||
${CMD_PREFIX} ostree admin instutil set-kargs FOO=BAR
|
||||
${CMD_PREFIX} ostree admin instutil set-kargs FOO=BAZ FOO=BIF TESTARG=TESTVALUE
|
||||
${CMD_PREFIX} ostree admin instutil set-kargs FOO=BAZ FOO=BIF TESTARG=TESTVALUE KEYWORD EMPTYLIST=
|
||||
assert_not_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=BAR'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=BAZ .*FOO=BIF'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*TESTARG=TESTVALUE'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*TESTARG=TESTVALUE KEYWORD EMPTYLIST='
|
||||
echo "ok instutil set-kargs (basic)"
|
||||
|
||||
${CMD_PREFIX} ostree admin instutil set-kargs --merge FOO=BAR
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=BAZ .*FOO=BIF .*FOO=BAR'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*TESTARG=TESTVALUE'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*TESTARG=TESTVALUE KEYWORD EMPTYLIST='
|
||||
echo "ok instutil set-kargs --merge"
|
||||
|
||||
${CMD_PREFIX} ostree admin instutil set-kargs --merge --replace=FOO=XXX
|
||||
assert_not_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=BAR'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=XXX'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*TESTARG=TESTVALUE'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*TESTARG=TESTVALUE KEYWORD EMPTYLIST='
|
||||
echo "ok instutil set-kargs --replace"
|
||||
|
||||
${CMD_PREFIX} ostree admin instutil set-kargs --merge --append=FOO=BAR --append=APPENDARG=VALAPPEND --append=APPENDARG=2NDAPPEND testos:testos/buildmaster/x86_64-runtime
|
||||
|
||||
@@ -23,7 +23,8 @@ set -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
setup_test_repository "bare-user-only"
|
||||
mode="bare-user-only"
|
||||
setup_test_repository "$mode"
|
||||
extra_basic_tests=5
|
||||
. $(dirname $0)/basic-test.sh
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ set -euo pipefail
|
||||
|
||||
skip_without_user_xattrs
|
||||
|
||||
setup_test_repository "bare-user"
|
||||
mode="bare-user"
|
||||
setup_test_repository "$mode"
|
||||
|
||||
extra_basic_tests=6
|
||||
. $(dirname $0)/basic-test.sh
|
||||
@@ -117,9 +118,10 @@ assert_file_has_content ls.txt "^-006.. ${newuid} ${newgid} .*/baz/cow"
|
||||
|
||||
# But --devino-canonical should override that
|
||||
$OSTREE commit ${COMMIT_ARGS} --owner-uid ${newuid} --owner-gid ${newgid} \
|
||||
-I -b test2-devino-test --tree=dir=test2-checkout
|
||||
-I -b test2-devino-test --table-output --tree=dir=test2-checkout > out.txt
|
||||
$OSTREE ls test2-devino-test /baz/cow > ls.txt
|
||||
assert_file_has_content ls.txt "^-006.. ${myuid} ${mygid} .*/baz/cow"
|
||||
assert_file_has_content out.txt "Content Cache Hits: [1-9][0-9]*"
|
||||
|
||||
$OSTREE refs --delete test2-{linkcheckout,devino}-test
|
||||
echo "ok commit with -I"
|
||||
+2
-1
@@ -25,5 +25,6 @@ set -euo pipefail
|
||||
|
||||
skip_without_no_selinux_or_relabel
|
||||
|
||||
setup_test_repository "bare"
|
||||
mode="bare"
|
||||
setup_test_repository "$mode"
|
||||
. $(dirname $0)/basic-test.sh
|
||||
@@ -25,52 +25,10 @@ set -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
echo '1..4'
|
||||
echo '1..1'
|
||||
|
||||
setup_test_repository "bare"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
mkdir repo2
|
||||
ostree_repo_init repo2 --mode="bare"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=repo2 --untrusted pull-local repo
|
||||
|
||||
find repo2 -type f -links +1 | while read line; do
|
||||
assert_not_reached "pull-local created hardlinks"
|
||||
done
|
||||
echo "ok pull-local --untrusted didn't hardlink"
|
||||
|
||||
# Corrupt repo
|
||||
for i in ${test_tmpdir}/repo/objects/*/*.file; do
|
||||
|
||||
# make sure it's not a symlink
|
||||
if [ -L $i ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "corrupting $i"
|
||||
echo "broke" >> $i
|
||||
break;
|
||||
done
|
||||
|
||||
rm -rf repo2
|
||||
mkdir repo2
|
||||
ostree_repo_init repo2 --mode="bare"
|
||||
if ${CMD_PREFIX} ostree --repo=repo2 pull-local repo; then
|
||||
echo "ok trusted pull with corruption succeeded"
|
||||
else
|
||||
assert_not_reached "corrupted trusted pull unexpectedly succeeded!"
|
||||
fi
|
||||
|
||||
rm -rf repo2
|
||||
ostree_repo_init repo2 --mode="bare"
|
||||
if ${CMD_PREFIX} ostree --repo=repo2 pull-local --untrusted repo; then
|
||||
assert_not_reached "corrupted untrusted pull unexpectedly failed!"
|
||||
else
|
||||
echo "ok untrusted pull with corruption failed"
|
||||
fi
|
||||
|
||||
|
||||
cd ${test_tmpdir}
|
||||
tar xf ${test_srcdir}/ostree-path-traverse.tar.gz
|
||||
rm -rf repo2
|
||||
|
||||
+7
-1
@@ -25,7 +25,7 @@ set -euo pipefail
|
||||
|
||||
setup_fake_remote_repo1 "archive"
|
||||
|
||||
echo '1..6'
|
||||
echo '1..7'
|
||||
|
||||
cd ${test_tmpdir}
|
||||
mkdir repo
|
||||
@@ -207,3 +207,9 @@ if ${CMD_PREFIX} ostree --repo=repo refs -A exampleos/x86_64/27/server --create=
|
||||
fi
|
||||
assert_file_has_content_literal err.txt 'Cannot create alias to remote ref'
|
||||
echo "ok ref no alias remote"
|
||||
|
||||
if ${CMD_PREFIX} ostree --repo=repo refs -A --create foobar nonexistent 2>err.txt; then
|
||||
fatal "Created alias to nonexistent ref?"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt 'Cannot create alias to non-existent ref'
|
||||
echo "ok ref no broken alias"
|
||||
@@ -154,6 +154,79 @@ ${OSTREE} prune --refs-only
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome/key3.asc R4 $(cat httpd-address)/ostree/gnomerepo
|
||||
${OSTREE} pull R4:main >/dev/null
|
||||
|
||||
# Test gpgkeypath success with multiple keys to try
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome/key1.asc,${test_tmpdir}/gpghome/key2.asc,${test_tmpdir}/gpghome/key3.asc R7 $(cat httpd-address)/ostree/gnomerepo
|
||||
${OSTREE} pull R7:main >/dev/null
|
||||
|
||||
# Test gpgkeypath failure with multiple keys but none in keyring
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome/key1.asc,${test_tmpdir}/gpghome/key2.asc R8 $(cat httpd-address)/ostree/gnomerepo
|
||||
if ${OSTREE} pull R8:main 2>err.txt; then
|
||||
assert_not_reached "Unexpectedly succeeded at pulling with different key"
|
||||
fi
|
||||
assert_file_has_content err.txt "GPG signatures found, but none are in trusted keyring"
|
||||
|
||||
# Test gpgkeypath success with directory containing a valid key
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome/ R9 $(cat httpd-address)/ostree/gnomerepo
|
||||
${OSTREE} pull R9:main >/dev/null
|
||||
|
||||
# Test gpgkeypath failure with nonexistent directory
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome/INVALIDKEYDIRPATH/ R10 $(cat httpd-address)/ostree/gnomerepo
|
||||
if ${OSTREE} pull R10:main 2>err.txt; then
|
||||
assert_not_reached "Unexpectedly succeeded at pulling with nonexistent key directory"
|
||||
fi
|
||||
assert_file_has_content err.txt "INVALIDKEYDIRPATH.*No such file or directory"
|
||||
|
||||
# Test gpgkeypath failure with a directory containing a valid key, and a nonexistent key
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome/,${test_tmpdir}/gpghome/INVALIDKEYPATH.asc R11 $(cat httpd-address)/ostree/gnomerepo
|
||||
if ${OSTREE} pull R11:main 2>err.txt; then
|
||||
assert_not_reached "Unexpectedly succeeded at pulling with nonexistent key"
|
||||
fi
|
||||
assert_file_has_content err.txt "INVALIDKEYPATH.*No such file or directory"
|
||||
|
||||
# Test gpgkeypath success with a directory containing a valid key, and a key not in keyring
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome/,${test_tmpdir}/gpghome/key1.asc R12 $(cat httpd-address)/ostree/gnomerepo
|
||||
${OSTREE} pull R12:main >/dev/null
|
||||
|
||||
# Test gpgkeypath failure with a nonexistent directory, and a valid key
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome/INVALIDKEYDIRPATH/,${test_tmpdir}/gpghome/key3.asc R13 $(cat httpd-address)/ostree/gnomerepo
|
||||
if ${OSTREE} pull R13:main 2>err.txt; then
|
||||
assert_not_reached "Unexpectedly succeeded at pulling with nonexistent key directory"
|
||||
fi
|
||||
assert_file_has_content err.txt "INVALIDKEYDIRPATH.*No such file or directory"
|
||||
|
||||
# Test gpgkeypath failure with a nonexistent directory and a nonexistent key
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome/INVALIDKEYDIRPATH/,${test_tmpdir}/gpghome/INVALIDKEYPATH.asc R14 $(cat httpd-address)/ostree/gnomerepo
|
||||
if ${OSTREE} pull R14:main 2>err.txt; then
|
||||
assert_not_reached "Unexpectedly succeeded at pulling with nonexistent key"
|
||||
fi
|
||||
assert_file_has_content err.txt "INVALIDKEYDIRPATH.*No such file or directory"
|
||||
|
||||
# Test gpgkeypath success for no trailing slash in directory path
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome R15 $(cat httpd-address)/ostree/gnomerepo
|
||||
${OSTREE} pull R15:main >/dev/null
|
||||
|
||||
# Test gpgkeypath failure with prefixed separator giving an empty path, and a nonexistent key
|
||||
${OSTREE} remote add --set=gpgkeypath=,${test_tmpdir}/gpghome/INVALIDKEYPATH.asc R16 $(cat httpd-address)/ostree/gnomerepo
|
||||
if ${OSTREE} pull R16:main 2>err.txt; then
|
||||
assert_not_reached "Unexpectedly succeeded at pulling with nonexistent key"
|
||||
fi
|
||||
assert_file_has_content err.txt "().*No such file or directory"
|
||||
|
||||
# Test gpgkeypath success with suffixed separator
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome/key3.asc, R17 $(cat httpd-address)/ostree/gnomerepo
|
||||
${OSTREE} pull R17:main >/dev/null
|
||||
|
||||
# Test gpgkeypath success with multiple keys specified, with semicolons
|
||||
${OSTREE} remote add --set=gpgkeypath="${test_tmpdir}/gpghome/key1.asc;${test_tmpdir}/gpghome/key2.asc;${test_tmpdir}/gpghome/key3.asc" R18 $(cat httpd-address)/ostree/gnomerepo
|
||||
${OSTREE} pull R18:main >/dev/null
|
||||
|
||||
# Test gpgkeypath failure multiple keys specified, with mix of commas and semicolons
|
||||
${OSTREE} remote add --set=gpgkeypath="${test_tmpdir}/gpghome/key1.asc,${test_tmpdir}/gpghome/key2.asc;${test_tmpdir}/gpghome/key3.asc" R19 $(cat httpd-address)/ostree/gnomerepo
|
||||
if ${OSTREE} pull R19:main 2>err.txt; then
|
||||
assert_not_reached "Unexpectedly succeeded at pulling with invalid gpgkeypath value"
|
||||
fi
|
||||
assert_file_has_content err.txt ".*key value list contains more than one separator"
|
||||
|
||||
rm repo/refs/remotes/* -rf
|
||||
${OSTREE} prune --refs-only
|
||||
|
||||
|
||||
Reference in new issue
Block a user