← 返回命令列表

Linux command

mock 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Build package in chroot

mock -r [fedora-39-x86_64] [package.src.rpm]

Initialize chroot

mock -r [fedora-39-x86_64] --init

Clean chroot

mock -r [fedora-39-x86_64] --clean

Shell into chroot

mock -r [fedora-39-x86_64] --shell

Build from spec

mock -r [fedora-39-x86_64] --spec [package.spec] --sources [sources/]

Rebuild SRPM

mock -r [fedora-39-x86_64] --rebuild [package.src.rpm]

说明

mock builds RPMs in clean chroot environments. It isolates builds from the host system. The tool creates reproducible builds. Used for Fedora/RHEL package building.

参数

-r _CONFIG_
Chroot configuration.
--init
Initialize chroot.
--clean
Clean chroot.
--shell
Enter chroot shell.
--rebuild
Rebuild SRPM.
--help
Display help information.

FAQ

What is the mock command used for?

mock builds RPMs in clean chroot environments. It isolates builds from the host system. The tool creates reproducible builds. Used for Fedora/RHEL package building.

How do I run a basic mock example?

Run `mock -r [fedora-39-x86_64] [package.src.rpm]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -r _CONFIG_ do in mock?

Chroot configuration.