配置脚本的问题
我遇到了 ffmpeg 的 ./configure
脚本问题。我的 Linux 环境使用 busybox,它只允许使用有限的 Linux 命令集。 ffmpeg ./configure
脚本中使用的一个命令是 mktemp -u
,这里的问题是 Linux 的 busybox 无法将 -u 开关识别为有效,因此它抱怨它并破坏了配置过程。
这是 ./configure
中使用 mktemp -u
命令的相关代码:
if ! check_cmd type mktemp; then
# simple replacement for missing mktemp
# NOT SAFE FOR GENERAL USE
mktemp(){
echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
}
fi
tmpfile(){
tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
(set -C; exec > $tmp) 2>/dev/null ||
die "Unable to create temporary file in $TMPDIR."
append TMPFILES $tmp
eval $1=$tmp
}
我根本不擅长 bash 脚本编写,所以我想知道是否有人有关于如何强制此配置脚本不使用 mktemp -u 并使用上面代码片段中提供的“替换”替代选项的想法。谢谢。
顺便说一句...简单地删除 -u
开关是行不通的。也不能将其替换为 -t
或 -p
。我相信必须完全绕过mktemp
。
I am running into a problem with the ./configure
script for ffmpeg. My linux environment uses busybox, which only allows for limited set of linux commands. One command which is used in the ffmpeg ./configure
script is mktemp -u
, the problem here is the busybox for linux does not recognize the -u switch as valid, so it complains about it and breaks the configure process.
This is the relevant code in ./configure
which uses the mktemp -u
command:
if ! check_cmd type mktemp; then
# simple replacement for missing mktemp
# NOT SAFE FOR GENERAL USE
mktemp(){
echo "${2%XXX*}.${HOSTNAME}.${UID}.$"
}
fi
tmpfile(){
tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
(set -C; exec > $tmp) 2>/dev/null ||
die "Unable to create temporary file in $TMPDIR."
append TMPFILES $tmp
eval $1=$tmp
}
I am not good with bash scripting at all, so I was wondering if anyone one had an idea on how I can force this configure script to not use mktemp -u
and use the 'replacement' alternative option that is available in as per the snippet above. Thanks.
btw... simply removing the -u
switch does not work. Nor does replacing it with -t
, or -p
. I believe the mktemp
has to be bypassed completely.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更改为:
您
可以选择删除整个
if
fi
构造,以便剩下的只是mktemp()
定义,但我'我宁愿把它们留下来,以记住需要做什么以及以防万一您需要返回。Change this:
To this:
You could alternatively remove the entire
if
fi
constructs so that what's left is just themktemp()
definition but I'd rather leave them in as a way to remember what needed to be done and in case you need to go back.我只需更改配置脚本,将
-u
选项删除为 mktemp 并删除set -C;
(它设置 no-clobber 模式,并且要求该文件不存在;删除-u
意味着您还需要删除set -C
)。mktemp(1) 的 MacOS X 手册页说:
生成的文件名由 mktemp 取消链接,然后立即由配置脚本重新创建,这有点愚蠢。删除
-u
意味着文件名已经存在,并且已安全创建。如果您经常使用该软件,请将问题报告给该软件的开发人员或维护人员。
I would just change the configure script to drop the
-u
option to mktemp and remove theset -C;
(which sets no-clobber mode, and requires the file to be absent; removing the-u
means you need to remove theset -C
too).The MacOS X manual pages for mktemp(1) say:
The generated file name is unlinked by mktemp, and then immediately re-created by the configure script, which is a trifle silly. Dropping the
-u
means that the file name will already exist, having been created securely.If the software is something you are going to use often, then report the issue to the developer or maintainer of the software.