0

默认情况下xz,压缩器使用单线程(例如,从 AUR 压缩新创建的包)。有一个--threads使用更多线程的选项。

我在哪里可以设置 xz 的全局设置,以便将线程选项设置为我的值?在人中找不到任何信息。

4

1 回答 1

1

手册页确实讨论了为此目的使用环境变量:

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会做你想做的事。

于 2020-05-07T13:59:22.057 回答