/usr/sbin/install的真正作用是什么? [英] What does /usr/sbin/install really do?
问题描述
我正在尝试在
I'm trying to install discount on my VPS which is based on Solaris and compiling works great after setting some environment variables but the install fails.
所以我想我会手动进行安装,但是install
真正在做什么?仅仅是mv
后跟chmod
吗?这是魔术吗?该错误似乎表明它试图对整个文件进行大量搜索?
So I thought I'd do the install manually, but what does install
really do? Is it simply a mv
followed by a chmod
? Is it magic? That error seems to show that it attempts to do a lot of searching for files all over?
我可以照常复制二进制文件,库文件和头文件吗?
Can I just copy the binary, library and header files as usual?
谷歌搜索安装"并没有给我太多相关信息,因此,我很感谢我得到的任何澄清!
Googling "install" doesn't give me much relevant information so I appreciate any clarification I can get!
推荐答案
根据 man install
:
install [OPTION]... [-T] SOURCE DEST`
install [OPTION]... SOURCE... DIRECTORY
install [OPTION]... -t DIRECTORY SOURCE...
install [OPTION]... -d DIRECTORY...
在前三种形式中,将SOURCE复制到DEST或将多个SOURCE复制到 现有的目录,同时设置权限模式和所有者/组. 在第4种形式中,创建给定目录的所有组件.
In the first three forms, copy SOURCE to DEST or multiple SOURCE(s) to the existing DIRECTORY, while setting permission modes and owner/group. In the 4th form, create all components of the given DIRECTORY(ies).
关于使用cp
的区别,根据安装vs.cp;和mmap ,install
取消链接现有文件,从而创建一个链接到同一位置的新文件.
As for the difference to using cp
, according to install vs. cp; and mmap, install
unlinks the existing file, creating a new one linked to the same spot.
这样做的好处是,如果您要覆盖的文件是当前正在运行的程序,则它可以继续运行,因为正在写入的文件实际上位于新位置,并且现有程序代码仍在旧的.
This has the advantage that, if the file you're trying to overwrite is a currently running program, it can continue running, as the file being written is in fact in a new location, and the existing program code is still in the old one.
cp
只是尝试覆盖现有文件,如果该文件由于使用中而被锁定,则将失败.
A cp
simply tries to overwrite the existing file, which will fail if the file is locked due to being in use.
这篇关于/usr/sbin/install的真正作用是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!