New upstream version 2018.1
This commit is contained in:
commit
e91328b9e9
64 files changed
+1078
-363
No files matched your search
+26
-2
@@ -19,7 +19,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..$((78 + ${extra_basic_tests:-0}))"
|
||||
echo "1..$((79 + ${extra_basic_tests:-0}))"
|
||||
|
||||
CHECKOUT_U_ARG=""
|
||||
CHECKOUT_H_ARGS="-H"
|
||||
@@ -759,14 +759,38 @@ $OSTREE show --print-metadata-key=FOO test2 > test2-meta
|
||||
assert_file_has_content test2-meta "BAR"
|
||||
$OSTREE show --print-metadata-key=KITTENS test2 > test2-meta
|
||||
assert_file_has_content test2-meta "CUTE"
|
||||
|
||||
$OSTREE show --print-metadata-key=SOMENUM test2 > test2-meta
|
||||
assert_file_has_content test2-meta "uint64 3026418949592973312"
|
||||
case "$("${test_builddir}/get-byte-order")" in
|
||||
(4321)
|
||||
assert_file_has_content test2-meta "uint64 42"
|
||||
;;
|
||||
(1234)
|
||||
assert_file_has_content test2-meta "uint64 3026418949592973312"
|
||||
;;
|
||||
(*)
|
||||
fatal "neither little-endian nor big-endian?"
|
||||
;;
|
||||
esac
|
||||
|
||||
$OSTREE show -B --print-metadata-key=SOMENUM test2 > test2-meta
|
||||
assert_file_has_content test2-meta "uint64 42"
|
||||
$OSTREE show --print-detached-metadata-key=SIGNATURE test2 > test2-meta
|
||||
assert_file_has_content test2-meta "HANCOCK"
|
||||
echo "ok metadata commit with strings"
|
||||
|
||||
$OSTREE commit ${COMMIT_ARGS} -b test2 --tree=ref=test2 \
|
||||
--add-detached-metadata-string=SIGNATURE=HANCOCK \
|
||||
--keep-metadata=KITTENS --keep-metadata=SOMENUM
|
||||
if $OSTREE show --print-metadata-key=FOO test2; then
|
||||
assert_not_reached "FOO was kept without explicit --keep-metadata?"
|
||||
fi
|
||||
$OSTREE show --print-metadata-key=KITTENS test2 > test2-meta
|
||||
assert_file_has_content test2-meta "CUTE"
|
||||
$OSTREE show -B --print-metadata-key=SOMENUM test2 > test2-meta
|
||||
assert_file_has_content test2-meta "uint64 42"
|
||||
echo "ok keep metadata from parent"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
$OSTREE show --print-metadata-key=ostree.ref-binding test2 > test2-ref-binding
|
||||
assert_file_has_content test2-ref-binding 'test2'
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/* Helper for OSTree tests: return host byte order */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
g_print ("%d\n", G_BYTE_ORDER);
|
||||
return 0;
|
||||
}
|
||||
@@ -112,9 +112,12 @@ assert_file_has_content () {
|
||||
}
|
||||
|
||||
assert_file_has_content_literal () {
|
||||
if ! grep -q -F -e "$2" "$1"; then
|
||||
_fatal_print_file "$1" "File '$1' doesn't match fixed string list '$2'"
|
||||
fi
|
||||
fpath=$1; shift
|
||||
for s in "$@"; do
|
||||
if ! grep -q -F -e "$s" "$fpath"; then
|
||||
_fatal_print_file "$fpath" "File '$fpath' doesn't match fixed string list '$s'"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
assert_file_has_mode () {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# To use a custrom script for generating grub.cfg, set the --with-grub2-mkconfig=no
|
||||
# configure switch when configuring and building OSTree.
|
||||
# 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. It can be used as a template
|
||||
@@ -28,7 +27,7 @@ entries_path=$(dirname $new_grub2_cfg)/entries
|
||||
|
||||
read_config()
|
||||
{
|
||||
config_file=${entries_path}/${1}
|
||||
config_file=${1}
|
||||
title=""
|
||||
initrd=""
|
||||
options=""
|
||||
@@ -67,11 +66,13 @@ populate_menu()
|
||||
else
|
||||
boot_prefix="${OSTREE_BOOT_PARTITION}"
|
||||
fi
|
||||
for config in $(ls ${entries_path}); do
|
||||
for config in $(ls $entries_path/*.conf); do
|
||||
read_config ${config}
|
||||
menu="${menu}menuentry '${title}' {\n"
|
||||
menu="${menu}\t linux ${boot_prefix}${linux} ${options}\n"
|
||||
menu="${menu}\t initrd ${boot_prefix}${initrd}\n"
|
||||
if [ -n "${initrd}" ] ; then
|
||||
menu="${menu}\t initrd ${boot_prefix}${initrd}\n"
|
||||
fi
|
||||
menu="${menu}}\n\n"
|
||||
done
|
||||
# The printf command seems to be more reliable across shells for special character (\n, \t) evaluation
|
||||
|
||||
Binary file not shown.
+19
-1
@@ -52,7 +52,7 @@ function verify_initial_contents() {
|
||||
assert_file_has_content baz/cow '^moo$'
|
||||
}
|
||||
|
||||
echo "1..33"
|
||||
echo "1..34"
|
||||
|
||||
# Try both syntaxes
|
||||
repo_init --no-gpg-verify
|
||||
@@ -217,6 +217,24 @@ else
|
||||
echo "ok corruption (skipped)"
|
||||
fi
|
||||
|
||||
|
||||
cd ${test_tmpdir}/ostree-srv
|
||||
tar xf ${test_srcdir}/ostree-path-traverse.tar.gz
|
||||
cd ${test_tmpdir}
|
||||
rm corruptrepo -rf
|
||||
ostree_repo_init corruptrepo --mode=archive
|
||||
${CMD_PREFIX} ostree --repo=corruptrepo remote add --set=gpg-verify=false pathtraverse $(cat httpd-address)/ostree/ostree-path-traverse/repo
|
||||
if ${CMD_PREFIX} ostree --repo=corruptrepo pull pathtraverse pathtraverse-test 2>err.txt; then
|
||||
fatal "Pulled a repo with path traversal in dirtree"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt 'ae9a5d2701a02740aa2ee317ba53b13e3efb0f29609cd4896e1bafeee4caddb5.dirtree: Invalid / in filename ../afile'
|
||||
# And verify we didn't write the object into the staging directory even
|
||||
find corruptrepo/tmp -name '9a5d2701a02740aa2ee317ba53b13e3efb0f29609cd4896e1bafeee4caddb5.dirtree' >find.txt
|
||||
assert_not_file_has_content find.txt '9a5d2701a02740aa2ee317ba53b13e3efb0f29609cd4896e1bafeee4caddb5'
|
||||
rm corruptrepo -rf
|
||||
echo "ok path traversal checked on pull"
|
||||
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm mirrorrepo/refs/remotes/* -rf
|
||||
${CMD_PREFIX} ostree --repo=mirrorrepo prune --refs-only
|
||||
|
||||
@@ -104,18 +104,20 @@ cd ${test_tmpdir}
|
||||
rm -rf test2-checkout
|
||||
$OSTREE checkout -H -U test2 test2-checkout
|
||||
# With --link-checkout-speedup, specifying --owner-uid should "win" by default.
|
||||
myid=$(id -u)
|
||||
newid=$((${myid} + 1))
|
||||
$OSTREE commit ${COMMIT_ARGS} --owner-uid ${newid} --owner-gid ${newid} \
|
||||
myuid=$(id -u)
|
||||
mygid=$(id -g)
|
||||
newuid=$((${myuid} + 1))
|
||||
newgid=$((${mygid} + 1))
|
||||
$OSTREE commit ${COMMIT_ARGS} --owner-uid ${newuid} --owner-gid ${newgid} \
|
||||
--link-checkout-speedup -b test2-linkcheckout-test --tree=dir=test2-checkout
|
||||
$OSTREE ls test2-linkcheckout-test /baz/cow > ls.txt
|
||||
assert_file_has_content ls.txt "^-006.. ${newid} ${newid} .*/baz/cow"
|
||||
assert_file_has_content ls.txt "^-006.. ${newuid} ${newgid} .*/baz/cow"
|
||||
|
||||
# But --devino-canonical should override that
|
||||
$OSTREE commit ${COMMIT_ARGS} --owner-uid ${newid} --owner-gid ${newid} \
|
||||
$OSTREE commit ${COMMIT_ARGS} --owner-uid ${newuid} --owner-gid ${newgid} \
|
||||
-I -b test2-devino-test --tree=dir=test2-checkout
|
||||
$OSTREE ls test2-devino-test /baz/cow > ls.txt
|
||||
assert_file_has_content ls.txt "^-006.. ${myid} ${myid} .*/baz/cow"
|
||||
assert_file_has_content ls.txt "^-006.. ${myuid} ${mygid} .*/baz/cow"
|
||||
|
||||
$OSTREE refs --delete test2-{linkcheckout,devino}-test
|
||||
echo "ok commit with -I"
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..4"
|
||||
echo "1..6"
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
@@ -72,3 +72,18 @@ fi
|
||||
assert_file_has_content_literal err.txt "Loading commit for ref test2: No such metadata object"
|
||||
|
||||
echo "ok missing commit"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
tar xf ${test_srcdir}/ostree-path-traverse.tar.gz
|
||||
if ${CMD_PREFIX} ostree --repo=ostree-path-traverse/repo fsck -q 2>err.txt; then
|
||||
fatal "fsck unexpectedly succeeded"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt '.dirtree: Invalid / in filename ../afile'
|
||||
echo "ok path traverse fsck"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
if ${CMD_PREFIX} ostree --repo=ostree-path-traverse/repo checkout pathtraverse-test pathtraverse-test 2>err.txt; then
|
||||
fatal "checkout with path traversal unexpectedly succeeded"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt 'Invalid / in filename ../afile'
|
||||
echo "ok path traverse checkout"
|
||||
+14
-14
@@ -86,7 +86,7 @@ assert_file_has_content local-mirror/refs/mirrors/org.example.OsCollection/os/am
|
||||
|
||||
for repo in local local-mirror; do
|
||||
# Try finding an update for an existing branch.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes org.example.AppsCollection app1 > find
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 > find
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/apps-collection$"
|
||||
assert_file_has_content find "^ - Keyring: apps-remote.trustedkeys.gpg$"
|
||||
assert_file_has_content find "^ - (org.example.AppsCollection, app1) = $(cat app1-checksum)$"
|
||||
@@ -94,7 +94,7 @@ for repo in local local-mirror; do
|
||||
assert_not_file_has_content find "^No results.$"
|
||||
|
||||
# Find several updates for several existing branches.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes org.example.AppsCollection app1 org.example.OsCollection os/amd64/master > find
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.OsCollection os/amd64/master > find
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/apps-collection$"
|
||||
assert_file_has_content find "^ - Keyring: apps-remote.trustedkeys.gpg$"
|
||||
assert_file_has_content find "^ - (org.example.AppsCollection, app1) = $(cat app1-checksum)$"
|
||||
@@ -105,7 +105,7 @@ for repo in local local-mirror; do
|
||||
assert_not_file_has_content find "^No results.$"
|
||||
|
||||
# Find some updates and a new branch.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/master > find
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/master > find
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/apps-collection$"
|
||||
assert_file_has_content find "^ - Keyring: apps-remote.trustedkeys.gpg$"
|
||||
assert_file_has_content find "^ - (org.example.AppsCollection, app1) = $(cat app1-checksum)$"
|
||||
@@ -117,7 +117,7 @@ for repo in local local-mirror; do
|
||||
assert_not_file_has_content find "^No results.$"
|
||||
|
||||
# Find an update and a non-existent branch.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes org.example.AppsCollection app1 org.example.AppsCollection not-an-app > find
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.AppsCollection app1 org.example.AppsCollection not-an-app > find
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/apps-collection$"
|
||||
assert_file_has_content find "^ - Keyring: apps-remote.trustedkeys.gpg$"
|
||||
assert_file_has_content find "^ - (org.example.AppsCollection, not-an-app) = (not found)$"
|
||||
@@ -128,20 +128,20 @@ for repo in local local-mirror; do
|
||||
assert_not_file_has_content find "^No results.$"
|
||||
|
||||
# Do all the above, but pull this time.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --pull org.example.AppsCollection app1 > pull || true
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 > pull || true
|
||||
assert_file_has_content pull "^1/1 refs were found.$"
|
||||
assert_file_has_content pull "^Pulled 1/1 refs successfully.$"
|
||||
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
|
||||
assert_ref $repo app1 $(cat app1-checksum)
|
||||
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --pull org.example.AppsCollection app1 org.example.OsCollection os/amd64/master > pull
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.OsCollection os/amd64/master > pull
|
||||
assert_file_has_content pull "^2/2 refs were found.$"
|
||||
assert_file_has_content pull "^Pulled 2/2 refs successfully.$"
|
||||
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
|
||||
assert_ref $repo app1 $(cat app1-checksum)
|
||||
assert_ref $repo os/amd64/master $(cat os-checksum)
|
||||
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --pull org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/master > pull
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.AppsCollection app2 org.example.OsCollection os/amd64/master > pull
|
||||
assert_file_has_content pull "^3/3 refs were found.$"
|
||||
assert_file_has_content pull "^Pulled 3/3 refs successfully.$"
|
||||
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
|
||||
@@ -149,7 +149,7 @@ for repo in local local-mirror; do
|
||||
assert_ref $repo app2 $(cat app2-checksum)
|
||||
assert_ref $repo os/amd64/master $(cat os-checksum)
|
||||
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --pull org.example.AppsCollection app1 org.example.AppsCollection not-an-app > pull
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.AppsCollection app1 org.example.AppsCollection not-an-app > pull
|
||||
assert_file_has_content pull "^1/2 refs were found.$"
|
||||
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
|
||||
assert_ref $repo app1 $(cat app1-checksum)
|
||||
@@ -164,7 +164,7 @@ ${CMD_PREFIX} ostree --repo=os-collection summary --update --gpg-homedir=${TEST_
|
||||
|
||||
for repo in local-mirror; do
|
||||
# Try finding an update for that branch.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes org.example.OsCollection os/amd64/master > find
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/master > find
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$"
|
||||
assert_file_has_content find "^ - Keyring: os-remote.trustedkeys.gpg$"
|
||||
assert_file_has_content find "^ - (org.example.OsCollection, os/amd64/master) = $(cat os-checksum-2)$"
|
||||
@@ -172,7 +172,7 @@ for repo in local-mirror; do
|
||||
assert_not_file_has_content find "^No results.$"
|
||||
|
||||
# Pull it.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --pull org.example.OsCollection os/amd64/master > pull || true
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/master > pull || true
|
||||
assert_file_has_content pull "^1/1 refs were found.$"
|
||||
assert_file_has_content pull "^Pulled 1/1 refs successfully.$"
|
||||
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
|
||||
@@ -191,7 +191,7 @@ ${CMD_PREFIX} ostree --repo=local remote add os-remote-local-mirror file://$(pwd
|
||||
|
||||
for repo in local; do
|
||||
# Try finding an update for that branch.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes org.example.OsCollection os/amd64/master > find
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/master > find
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$"
|
||||
assert_file_has_content find "^ - Keyring: os-remote.trustedkeys.gpg$"
|
||||
assert_file_has_content find "^ - (org.example.OsCollection, os/amd64/master) = $(cat os-checksum-2)$"
|
||||
@@ -202,7 +202,7 @@ for repo in local; do
|
||||
assert_not_file_has_content find "^No results.$"
|
||||
|
||||
# Pull it.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --pull org.example.OsCollection os/amd64/master > pull || true
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/master > pull || true
|
||||
assert_file_has_content pull "^1/1 refs were found.$"
|
||||
assert_file_has_content pull "^Pulled 1/1 refs successfully.$"
|
||||
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
|
||||
@@ -218,7 +218,7 @@ ${CMD_PREFIX} ostree --repo=os-collection summary --update --gpg-homedir=${TEST_
|
||||
|
||||
for repo in local; do
|
||||
# Try finding an update for that branch.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes org.example.OsCollection os/amd64/master > find
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config org.example.OsCollection os/amd64/master > find
|
||||
assert_file_has_content find "^Result [0-9]\+: file://$(pwd)/os-collection$"
|
||||
assert_file_has_content find "^ - Keyring: os-remote.trustedkeys.gpg$"
|
||||
assert_file_has_content find "^ - (org.example.OsCollection, os/amd64/master) = $(cat os-checksum-3)$"
|
||||
@@ -226,7 +226,7 @@ for repo in local; do
|
||||
assert_not_file_has_content find "^No results.$"
|
||||
|
||||
# Pull it.
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --pull org.example.OsCollection os/amd64/master > pull || true
|
||||
${CMD_PREFIX} ostree --repo=$repo find-remotes --finders=config --pull org.example.OsCollection os/amd64/master > pull || true
|
||||
assert_file_has_content pull "^1/1 refs were found.$"
|
||||
assert_file_has_content pull "^Pulled 1/1 refs successfully.$"
|
||||
assert_not_file_has_content pull "Failed to pull some refs from the remotes"
|
||||
|
||||
Executable
+78
@@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
echo "1..7"
|
||||
|
||||
setup_os_repository "archive-z2" "uboot"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos $(cat httpd-address)/ostree/testos-repo
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=rootfs --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'root=LABEL=rootfs'
|
||||
assert_not_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'init='
|
||||
|
||||
echo "ok deployment with initramfs"
|
||||
|
||||
pull_test_tree() {
|
||||
kernel_contents=$1
|
||||
initramfs_contents=$2
|
||||
|
||||
printf "TEST SETUP:\n kernel: %s\n initramfs: %s\n layout: %s\n" \
|
||||
"$kernel_contents" "$initramfs_contents" "$layout"
|
||||
|
||||
rm -rf ${test_tmpdir}/osdata/usr/lib/modules/3.6.0/{initramfs.img,vmlinuz} \
|
||||
${test_tmpdir}/osdata/usr/lib/ostree-boot \
|
||||
${test_tmpdir}/osdata/boot
|
||||
if [ "$layout" = "/usr/lib/modules" ]; then
|
||||
# Fedora compatible layout
|
||||
cd ${test_tmpdir}/osdata/usr/lib/modules/3.6.0
|
||||
echo -n "$kernel_contents" > vmlinuz
|
||||
[ -n "$initramfs_contents" ] && echo -n "$initramfs_contents" > initramfs.img
|
||||
elif [ "$layout" = "/usr/lib/ostree-boot" ] || [ "$layout" = "/boot" ]; then
|
||||
# "Legacy" layout
|
||||
mkdir -p "${test_tmpdir}/osdata/$layout"
|
||||
cd "${test_tmpdir}/osdata/$layout"
|
||||
bootcsum=$(echo -n "$kernel_contents$initramfs_contents" \
|
||||
| sha256sum | cut -f 1 -d ' ')
|
||||
echo -n "$kernel_contents" > vmlinuz-${bootcsum}
|
||||
[ -n "$initramfs_contents" ] && echo -n "$initramfs_contents" > initramfs-${bootcsum}
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
cd -
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit --tree=dir=osdata/ -b testos/buildmaster/x86_64-runtime
|
||||
${CMD_PREFIX} ostree pull testos:testos/buildmaster/x86_64-runtime
|
||||
}
|
||||
|
||||
get_key_from_bootloader_conf() {
|
||||
conffile=$1
|
||||
key=$2
|
||||
|
||||
assert_file_has_content "$conffile" "^$key"
|
||||
awk "/^$key/ { print \$2 }" "$conffile"
|
||||
}
|
||||
|
||||
for layout in /usr/lib/modules /usr/lib/ostree-boot /boot;
|
||||
do
|
||||
pull_test_tree "the kernel only"
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg=root=/dev/sda2 --karg=rootwait testos:testos/buildmaster/x86_64-runtime
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'rootwait'
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'init='
|
||||
assert_not_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'initrd'
|
||||
|
||||
echo "ok switching to bootdir with no initramfs layout=$layout"
|
||||
|
||||
pull_test_tree "the kernel" "initramfs to assist the kernel"
|
||||
${CMD_PREFIX} ostree admin deploy --os=testos --karg-none --karg=root=LABEL=rootfs testos:testos/buildmaster/x86_64-runtime
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'initrd'
|
||||
assert_file_has_content sysroot/boot/$(get_key_from_bootloader_conf sysroot/boot/loader/entries/ostree-testos-0.conf "initrd") "initramfs to assist the kernel"
|
||||
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'root=LABEL=rootfs'
|
||||
assert_not_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'rootwait'
|
||||
assert_not_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'init='
|
||||
|
||||
echo "ok switching from no initramfs to initramfs enabled sysroot layout=$layout"
|
||||
done
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2014 Alexander Larsson <alexl@redhat.com>
|
||||
# Copyright (C) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -22,7 +23,7 @@ set -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
echo '1..3'
|
||||
echo '1..4'
|
||||
|
||||
setup_test_repository "bare"
|
||||
|
||||
@@ -60,10 +61,20 @@ else
|
||||
fi
|
||||
|
||||
rm -rf repo2
|
||||
mkdir 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
|
||||
ostree_repo_init repo2 --mode=archive
|
||||
if ${CMD_PREFIX} ostree --repo=repo2 pull-local --untrusted ostree-path-traverse/repo pathtraverse-test 2>err.txt; then
|
||||
fatal "pull-local unexpectedly succeeded"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt 'Invalid / in filename ../afile'
|
||||
echo "ok untrusted pull-local path traversal"
|
||||
@@ -109,12 +109,12 @@ for fs_type in ext4 vfat; do
|
||||
ostree_repo_init peer-repo_$fs_type
|
||||
${CMD_PREFIX} ostree --repo=peer-repo_$fs_type remote add remote1 file://just-here-for-the-keyring --collection-id org.example.Collection1 --gpg-import="${test_tmpdir}/gpghome/key1.asc"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=peer-repo_$fs_type find-remotes org.example.Collection1 test-1 > find-results
|
||||
${CMD_PREFIX} ostree --repo=peer-repo_$fs_type find-remotes --finders=mount org.example.Collection1 test-1 > find-results
|
||||
assert_not_file_has_content find-results "^No results.$"
|
||||
assert_file_has_content find-results "^Result 0: file://${usb_mount}"
|
||||
assert_file_has_content find-results "(org.example.Collection1, test-1) = $(cat ref1-checksum)$"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=peer-repo_$fs_type find-remotes --pull org.example.Collection1 test-1 > pull-results
|
||||
${CMD_PREFIX} ostree --repo=peer-repo_$fs_type find-remotes --finders=mount --pull org.example.Collection1 test-1 > pull-results
|
||||
assert_file_has_content pull-results "^Pulled 1/1 refs successfully.$"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=peer-repo_$fs_type refs --collections > refs
|
||||
|
||||
@@ -26,7 +26,7 @@ skip_without_user_xattrs
|
||||
|
||||
setup_test_repository "bare"
|
||||
|
||||
echo "1..8"
|
||||
echo "1..11"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
mkdir mnt
|
||||
@@ -117,3 +117,58 @@ echo "ok checkout copy fallback"
|
||||
|
||||
# check that O_RDONLY|O_CREAT is handled correctly; used by flock(1) at least
|
||||
flock mnt/nonexistent-file echo "ok create file in ro mode"
|
||||
echo "ok flock"
|
||||
|
||||
# And now with --copyup enabled
|
||||
|
||||
copyup_reset() {
|
||||
cd ${test_tmpdir}
|
||||
fusermount -u mnt
|
||||
rm checkout-test2 -rf
|
||||
$OSTREE checkout -H test2 checkout-test2
|
||||
rofiles-fuse --copyup checkout-test2 mnt
|
||||
}
|
||||
|
||||
assert_test_file() {
|
||||
t=$1
|
||||
f=$2
|
||||
if ! test ${t} "${f}"; then
|
||||
ls -al "${f}"
|
||||
fatal "Failed test ${t} ${f}"
|
||||
fi
|
||||
}
|
||||
|
||||
copyup_reset
|
||||
assert_file_has_content mnt/firstfile first
|
||||
echo "ok copyup mount"
|
||||
|
||||
# Test O_TRUNC directly
|
||||
firstfile_orig_inode=$(stat -c %i checkout-test2/firstfile)
|
||||
echo -n truncating > mnt/firstfile
|
||||
assert_streq "$(cat mnt/firstfile)" truncating
|
||||
firstfile_new_inode=$(stat -c %i checkout-test2/firstfile)
|
||||
assert_not_streq "${firstfile_orig_inode}" "${firstfile_new_inode}"
|
||||
assert_test_file -f checkout-test2/firstfile
|
||||
|
||||
copyup_reset
|
||||
firstfile_link_orig_inode=$(stat -c %i checkout-test2/firstfile-link)
|
||||
firstfile_orig_inode=$(stat -c %i checkout-test2/firstfile)
|
||||
# Now write via the symlink
|
||||
echo -n truncating > mnt/firstfile-link
|
||||
assert_streq "$(cat mnt/firstfile)" truncating
|
||||
firstfile_new_inode=$(stat -c %i checkout-test2/firstfile)
|
||||
firstfile_link_new_inode=$(stat -c %i checkout-test2/firstfile-link)
|
||||
assert_not_streq "${firstfile_orig_inode}" "${firstfile_new_inode}"
|
||||
assert_streq "${firstfile_link_orig_inode}" "${firstfile_link_new_inode}"
|
||||
assert_test_file -f checkout-test2/firstfile
|
||||
# Verify we didn't replace the link with a regfile somehow
|
||||
assert_test_file -L checkout-test2/firstfile-link
|
||||
|
||||
# These both end up creating new files; in the sed case we'll then do a rename()
|
||||
copyup_reset
|
||||
echo "hello new file" > mnt/a-new-non-copyup-file
|
||||
assert_file_has_content_literal mnt/a-new-non-copyup-file "hello new file"
|
||||
sed -i -e s,first,second, mnt/firstfile
|
||||
assert_file_has_content_literal mnt/firstfile "second"
|
||||
|
||||
echo "ok copyup"
|
||||
@@ -52,7 +52,7 @@ echo 'ok documented symbols'
|
||||
|
||||
# ONLY update this checksum in release commits!
|
||||
cat > released-sha256.txt <<EOF
|
||||
3dbe0aa610c7229050f4a651fd18893742f8a24c34f3e25bf807ff98fbfc7f72 ${released_syms}
|
||||
e880ade1f3b4cc7587dc1a7a30059ab1d5287484ee70843f1bb4f258fbec677c ${released_syms}
|
||||
EOF
|
||||
sha256sum -c released-sha256.txt
|
||||
|
||||
|
||||
Reference in new issue
Block a user