Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,13 @@ main (int argc,

setlocale (LC_ALL, "");

/* We don't support /etc/dnf/dnf.conf, so tell libdnf to not look for it. The function
* name here is misleading; it's not attached to a `DnfContext` object, but instead
* controls a global var. And it's not just the `DnfContext` that uses it, but e.g.
* `DnfSack` and Repo too. So just do this upfront. XXX: Clean up that API so it's always
* attached to a context object. */
dnf_context_set_config_file_path("");

GCancellable *cancellable = g_cancellable_new ();

g_autofree char *command_line = rebuild_command_line (argc, argv);
Expand Down
4 changes: 3 additions & 1 deletion src/app/rpmostree-builtin-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,9 @@ print_one_deployment (RPMOSTreeSysroot *sysroot_proxy,

for (char **iter = initramfs_args; iter && *iter; iter++)
{
g_string_append (buf, *iter);
const char *arg = *iter;
g_autofree char *quoted = rpmostree_maybe_shell_quote (arg);
g_string_append (buf, quoted ?: arg);
g_string_append_c (buf, ' ');
}
if (buf->len == 0)
Expand Down
9 changes: 6 additions & 3 deletions src/daemon/rpmostree-sysroot-upgrader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,9 +1097,12 @@ perform_local_assembly (RpmOstreeSysrootUpgrader *self,
g_assert (kernel_state && kernel_path);

g_auto(GLnxTmpfile) initramfs_tmpf = { 0, };
if (!rpmostree_run_dracut (self->tmprootfs_dfd, add_dracut_argv, kver,
initramfs_path, NULL, &initramfs_tmpf,
cancellable, error))
/* NB: We only use the real root's /etc if initramfs regeneration is explicitly
* requested. IOW, just replacing the kernel still gets use stock settings, like the
* server side. */
if (!rpmostree_run_dracut (self->tmprootfs_dfd, add_dracut_argv, kver, initramfs_path,
rpmostree_origin_get_regenerate_initramfs (self->origin),
NULL, &initramfs_tmpf, cancellable, error))
return FALSE;

if (!rpmostree_finalize_kernel (self->tmprootfs_dfd, bootdir, kver, kernel_path,
Expand Down
3 changes: 2 additions & 1 deletion src/libpriv/rpmostree-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3775,7 +3775,8 @@ rpmostree_context_get_tmprootfs_dfd (RpmOstreeContext *self)
static gboolean
pkg_name_is_kernel (const char *name)
{
return g_str_equal (name, "kernel") || g_str_equal (name, "kernel-core") || g_str_equal (name, "kernel-rt") || g_str_equal (name, "kernel-rt-core");
const char *kernel_names[] = {"kernel", "kernel-core", "kernel-rt", "kernel-rt-core", NULL};
return g_strv_contains (kernel_names, name);
}

/* Determine if a txn element contains vmlinuz. TODO: Check via provides?
Expand Down
8 changes: 3 additions & 5 deletions src/libpriv/rpmostree-kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ kernel_remove_in (int rootfs_dfd,
/* Given a root filesystem, delete all kernel/initramfs data from it.
* The rpm filelist for the kernel isn't aware of all the places we
* copy the data, such as `/usr/lib/ostree-boot`.
* Used by `rpm-ostree override-replace ./kernel-42.x86_64.rpm`.
* Used by `rpm-ostree override replace ./kernel-42.x86_64.rpm`.
*/
gboolean
rpmostree_kernel_remove (int rootfs_dfd,
Expand Down Expand Up @@ -475,6 +475,7 @@ rpmostree_run_dracut (int rootfs_dfd,
const char *const* argv,
const char *kver,
const char *rebuild_from_initramfs,
gboolean use_root_etc,
GLnxTmpDir *dracut_host_tmpdir,
GLnxTmpfile *out_initramfs_tmpf,
GCancellable *cancellable,
Expand Down Expand Up @@ -562,10 +563,7 @@ rpmostree_run_dracut (int rootfs_dfd,
&tmpf, error))
goto out;

/* If we're rebuilding, we use the *current* /etc so we pick up any modified
* config files. Otherwise, we use the usr/etc defaults.
*/
if (rebuild_from_initramfs)
if (use_root_etc)
{
bwrap = rpmostree_bwrap_new_base (rootfs_dfd, error);
if (!bwrap)
Expand Down
1 change: 1 addition & 0 deletions src/libpriv/rpmostree-kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ rpmostree_run_dracut (int rootfs_dfd,
const char *const* argv,
const char *kver,
const char *rebuild_from_initramfs,
gboolean use_root_etc,
GLnxTmpDir *dracut_host_tmpdir,
GLnxTmpfile *out_initramfs_tmpf,
GCancellable *cancellable,
Expand Down
2 changes: 1 addition & 1 deletion src/libpriv/rpmostree-postprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ process_kernel_and_initramfs (int rootfs_dfd,
return FALSE;
if (!rpmostree_run_dracut (rootfs_dfd,
(const char *const*)dracut_argv->pdata, kver,
NULL, &dracut_host_tmpd,
NULL, FALSE, &dracut_host_tmpd,
&initramfs_tmpf, cancellable, error))
return FALSE;
/* No reason to have the initramfs not be world-readable since
Expand Down
2 changes: 1 addition & 1 deletion tests/common/libvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ vm_run_container() {
# (use -n so this ssh invocation doesn't consume stdin)
vm_cmd -n mkdir -p /var/cache/dnf
vm_cmd podman run --rm -v /var/cache/dnf:/var/cache/dnf:z $podman_args \
registry.fedoraproject.org/fedora:30 "$@"
registry.fedoraproject.org/fedora:31 "$@"
}

# $1 - service name
Expand Down
6 changes: 4 additions & 2 deletions tests/compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ set -euo pipefail

# freeze on a specific commit for tests for reproducibility and since it should
# always work to target older treefiles
FEDORA_COREOS_CONFIG_COMMIT=088fc2dec535aca392958e9c30c17cf19ef4b568
# XXX: disable this for now: https://pagure.io/releng/issue/9281
# FEDORA_COREOS_CONFIG_COMMIT=088fc2dec535aca392958e9c30c17cf19ef4b568

dn=$(cd "$(dirname "$0")" && pwd)
topsrcdir=$(cd "$dn/.." && pwd)
Expand Down Expand Up @@ -38,7 +39,8 @@ if [ ! -d compose-cache ]; then
git clone https://github.com/coreos/fedora-coreos-config config

pushd config
git checkout "${FEDORA_COREOS_CONFIG_COMMIT}"
# XXX: disable this for now -- see above
# git checkout "${FEDORA_COREOS_CONFIG_COMMIT}"
# we flatten the treefile to make it easier to manipulate in tests (we have
# lots of tests that check for include logic already)
rpm-ostree compose tree --print-only manifest.yaml > manifest.json
Expand Down
9 changes: 9 additions & 0 deletions tests/vmcheck/test-override-kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,12 @@ assert_streq "$(wc -l < modules-dirs.txt)" "2"
assert_file_has_content_literal modules-dirs.txt $kernel_release

echo "ok override kernel"

# And check that we can regenerate the initramfs and include files from our /etc
vm_cmd touch /etc/foobar.conf
vm_rpmostree initramfs --enable --arg=-I --arg=/etc/foobar.conf
newroot=$(vm_get_deployment_root 0)
vm_cmd lsinitrd ${newroot}/usr/lib/modules/${kernel_release}/initramfs.img > lsinitrd.txt
assert_file_has_content_literal lsinitrd.txt etc/foobar.conf

echo "ok override kernel with custom initramfs args"