Skip to content

Commit

Permalink
Merge pull request #4573 from cgwalters/enablerepo-only-container
Browse files Browse the repository at this point in the history
install/uninstall: Error out with --enablerepo on booted host
  • Loading branch information
jmarrero authored Sep 1, 2023
2 parents 51cd299 + 7c03c7b commit 79c5843
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/rpmostree-pkg-builtins.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ rpmostree_builtin_install (int argc, char **argv, RpmOstreeCommandInvocation *in
}
return rpmostree_container_rebuild (*treefile, cancellable, error);
}
else
{
// This very much relates to https://github.com/coreos/rpm-ostree/issues/2326 etc.
if (opt_enable_repo)
return glnx_throw (error, "--enablerepo currently only works in a container build");
if (opt_disable_repo)
return glnx_throw (error, "--disablerepo currently only works in a container build");
}

return pkg_change (invocation, sysroot_proxy, FALSE, (const char *const *)argv,
(const char *const *)opt_uninstall, cancellable, error);
Expand Down
5 changes: 5 additions & 0 deletions tests/kolainst/nondestructive/misc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ if rpm-ostree ex rebuild 2>err.txt; then
fi
assert_file_has_content_literal err.txt 'error: This command can only run in an OSTree container'

if rpm-ostree install --enablerepo=blah foo 2>err.txt; then
fatal "enablerepo should not have worked"
fi
assert_file_has_content err.txt 'enablerepo currently only works in a container build'

rpm-ostree status --jsonpath '$.deployments[0].booted' > jsonpath.txt
assert_file_has_content_literal jsonpath.txt 'true'
echo "ok jsonpath"
Expand Down

0 comments on commit 79c5843

Please sign in to comment.