按文件复制目录树
我的顾问经常将一堆软件编译到他的 /usr/local 中,然后将他的 /usr/local 作为 tarball 分发。然后,我将 tarball 提取到我们的实验室机器上供我们使用。到目前为止,这一切都很好,我们只需用 tarball 的内容替换旧的 /usr/local 即可。
但我已经开始在这些机器上安装我自己的软件。如果我删除 /usr/local,显然某些软件和配置也会被删除。
相反,我如何将文件从 tarball 递归复制到 /usr/local 中的相应目录中?
例如:
tarball path filesystem path
------------ ---------------
local/bin/myprog -> /usr/local/bin/myprog
local/lib/mylib.so -> /usr/local/lib/mylib.so
等等。
或者这对 ServerFault 来说是一个更好的问题吗?
My advisor frequently compiles a bunch of software into his /usr/local and then distributes his /usr/local as a tarball. I then extract the tarball onto our lab machines for our use. Until now, this has worked fine, we just replace the old /usr/local with the contents of the tarball.
But I have started installing my own software on these machines. If I delete /usr/local, obviously some of that software and config gets deleted as well.
Instead, how can I recursively copy files from the tarball into the corresponding directory in /usr/local?
For example:
tarball path filesystem path
------------ ---------------
local/bin/myprog -> /usr/local/bin/myprog
local/lib/mylib.so -> /usr/local/lib/mylib.so
etc.
Or is this a better question for ServerFault?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
或
虽然实际上,我认为它应该放在其他目录中,或者放在
/usr/local/
的子目录中。除了默认的 PATH 组件之外,/usr/local/
并没有什么神奇之处。or
Although really, I think it should just go in some other directory, or in a subdir of
/usr/local/
. There isn't anything magical about/usr/local/
except perhaps a default PATH component.cp 命令具有用于递归复制的 -r 标志:
请查找系统的 cp 手册页以获取更多信息。
The cp command has the -r flag for copying recursively:
Please look up your system's man page for cp for more information.
使用
k
选项并指定目标以防止覆盖文件:Use the
k
option and specify the destination to protect against overwriting files: