Wrapping other CLI entrypoints
封装其他 CLI 入口点

A simple way to describe the goal of rpm-ostree is to convert the default model for operating system updates to be “image based”.
描述 rpm-ostree 目标的简单方法是将操作系统更新的默认模型转换为“基于镜像”。

However, many distributions such as Fedora (and derivatives) ship a variety of tools which need adaptation for this. In some cases, changing those upstream projects to be “ostree aware” makes sense, and is straightforward. In others, it is easier to wrap/reimplement the functionality of those tools.
然而,许多发行版(如 Fedora 及其衍生版本)提供了许多需要适应此模型的工具。在某些情况下,将这些上游项目改为“ostree 感知”是有意义且直接的。在其他情况下,更容易包装/重新实现这些工具的功能。

rpm-ostree today contains code to wrap/reimplement the latter, which includes dnf/yum, grubby, and rpm for example.
rpm-ostree 今天包含了包装/重新实现后者的代码,其中包括 dnf/yumgrubbyrpm ,例如。

Enabling and disabling cliwrap on a client system
在客户系统上启用和禁用 cliwrap

$ rpm-ostree deploy --ex-cliwrap=true

You may also want to follow this with an rpm-ostree apply-live to apply the change live.
您可能还想跟着 rpm-ostree apply-live 来实时应用更改。

To disable: rpm-ostree deploy --ex-cliwrap=false 禁用: rpm-ostree deploy --ex-cliwrap=false

Enabling cliwrap at build time
在构建时启用 cliwrap

This is just cliwrap: true in the treefile.
这只是树文件中的 cliwrap: true

Globally Skipping cliwrap via environment variable
通过环境变量全局跳过 cliwrap

To skip cliwrap set the RPMOSTREE_CLIWRAP_SKIP enviroment variable with any value.
要跳过 cliwrap,请使用任何值设置 RPMOSTREE_CLIWRAP_SKIP 环境变量。

Wrapped commands 包装的命令

rpm

Currently, this is mostly oriented towards executing the real underlying rpm binary, but may e.g. drop privileges for commands that may not be safe. For example:
目前,这主要是针对执行真实的底层 rpm 二进制文件,但可能会为可能不安全的命令放弃权限。例如:

[root@cosa-devsh ~]# rpm -e toolbox
rpm-ostree: Note: This system is image (rpm-ostree) based.
rpm-ostree: Dropping privileges as `rpm` was executed with not "known safe" arguments.
rpm-ostree: You may invoke the real `rpm` binary in `/usr/libexec/rpm-ostree/wrapped/rpm`.
rpm-ostree: Continuing execution in 5 seconds.

error: can't create transaction lock on /usr/share/rpm/.rpm.lock (Read-only file system)
[root@cosa-devsh ~]# 

In the future, the rpm-ostree cliwrap for rpm may help translate some commands.
将来, rpm-ostreerpm 的 cliwrap 可能有助于翻译一些命令。

dracut

This one just prints a helpful redirection:
这个只是打印一个有用的重定向:

[root@cosa-devsh ~]# dracut
This system is rpm-ostree based; initramfs handling is
integrated with the underlying ostree transaction mechanism.
Use `rpm-ostree initramfs` to control client-side initramfs generation.

grubby

Similar to dracut, prints a redirection:
类似于 dracut,打印一个重定向:

[root@cosa-devsh ~]# grubby
This system is rpm-ostree based; grubby is not used.
Use `rpm-ostree kargs` instead.

yum/dnf

The implementation of this is tracked in this Github issue.
这一实现在此 Github 问题中有记录。

But for example, typing dnf update will be translated to rpm-ostree update. Other commands such as dnf install foo will print a helpful error like this:
但是,例如,输入 dnf update 将被翻译为 rpm-ostree update 。其他命令如 dnf install foo 将打印类似这样的有用错误:

[root@cosa-devsh ~]# dnf install foo
Note: This system is image (rpm-ostree) based.
Before installing packages to the host root filesystem, consider other options:
 - `toolbox`: For command-line development and debugging tools in a privileged container
 - `podman`: General purpose containers
 - `docker`: General purpose containers
 - `rpm-ostree install`: Install RPM packages layered on the host root filesystem.
   Consider these "operating system extensions".
   Add `--apply-live` to immediately start using the layered packages.
error: not implemented