archlinux - 如何为 xz 归档器设置默认参数?
问题描述
默认情况下xz
,压缩器使用单线程(例如,从 AUR 压缩新创建的包)。有一个--threads
使用更多线程的选项。
我在哪里可以设置 xz 的全局设置,以便将线程选项设置为我的值?在人中找不到任何信息。
解决方案
手册页确实讨论了为此目的使用环境变量:
ENVIRONMENT
xz parses space-separated lists of options from the environment variables XZ_DEFAULTS
and XZ_OPT, in this order, before parsing the options from the command line. Note
that only options are parsed from the environment variables; all non-options are
silently ignored. Parsing is done with getopt_long(3) which is used also for the
command line arguments.
XZ_DEFAULTS
User-specific or system-wide default options. Typically this is set in a
shell initialization script to enable xz's memory usage limiter by default.
Excluding shell initialization scripts and similar special cases, scripts must
never set or unset XZ_DEFAULTS.
XZ_OPT This is for passing options to xz when it is not possible to set the options
directly on the xz command line. This is the case e.g. when xz is run by a
script or tool, e.g. GNU tar(1):
XZ_OPT=-2v tar caf foo.tar.xz foo
Scripts may use XZ_OPT e.g. to set script-specific default compression op‐
tions. It is still recommended to allow users to override XZ_OPT if that is
reasonable, e.g. in sh(1) scripts one may use something like this:
XZ_OPT=${XZ_OPT-"-7e"}
export XZ_OPT
看起来XZ_DEFAULTS
会做你想做的事。
推荐阅读
- .net - 如何在我的构建中运行应用程序项目下的测试,而不是测试项目?
- python - 获取 Traceback 和 UnboundLocalError
- java - 如何从 java 程序中传递命令行参数?
- flask - 为什么我不能通过 AWS 上的负载均衡器访问 Flask API
- python - 熊猫在循环中设置数据框的名称
- scala - 在持久化 RDD 上有多个操作的情况下,缓存 RDD 的工作原理
- javascript - “检测到 EventEmitter 内存泄漏”错误导致崩溃
- angular - Angular2将身份验证令牌传递给另一个服务
- go - Go中有没有类似于C++绑定的东西?
- variables - 方法中的数学和变量