使用 coreutils install 安装符号链接 [英] install symbolic links with coreutils install
问题描述
我构建了一个库,我想使用 coreutils install
将该库安装到 /usr/local/lib
.构建结果如下所示:
I built a library and I want to install the library to /usr/local/lib
using coreutils install
. The result of the build looks as follows:
libfoo.so -> libfoo.so.1
libfoo.so.1 -> libfoo.so.1.1
libfoo.so.1.1
我想保留符号链接,并安装
文件到/usr/local/lib
.但是,如果我运行
I want to retain the symbolic links and install
the files as is to /usr/local/lib
. However, if I run
install libfoo* /usr/local/lib
符号链接已解析,/usr/local/lib
如下所示:
the symbolic links are resolved and /usr/local/lib
looks as follows:
libfoo.so
libfoo.so.1
libfoo.so.1.1
换句话说,这些都是真实的文件,没有符号链接.
In other words, these are all real files and no symbolic links.
install
的手册页不包含任何有关解析符号链接的信息.我如何安装
符号链接?
The manpage of install
does not contain any information about resolving symbolic links. How can I install
symbolic links?
推荐答案
我也想知道这个问题.在查看源代码之后,看起来install
很漂亮在安装时积极解决链接.以下是它传递给 cp
的一些默认值;相关的以后不会被覆盖.
I wondered about this too. After looking at the source code it would appear that install
is pretty aggressive about resolving links at install time. Here are some of the defaults it passes to cp
; the relevant ones don't get overridden later.
cp_option_init (struct cp_options *x)
{
cp_options_default (x);
x->copy_as_regular = true;
x->reflink_mode = REFLINK_NEVER;
x->dereference = DEREF_ALWAYS;
x->hard_link = false;
x->preserve_links = false;
x->preserve_mode = false;
x->symbolic_link = false;
(...)
解决方法是使用 cp
+ chmod
.
The workaround would be to use cp
+ chmod
.
这篇关于使用 coreutils install 安装符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!