简体   繁体   English

安装rpm并将文件放入符号链接目录

[英]Install rpm and put file into symbolic link directory

I have made an rpm package that install a program and one of the folders it needs to copy a file to is a symbolic link since the program the symbolic link is pointing to may change over time so it is easier to maintain the building of the rpm package by copying the file to the symbolic link rather then to the hard coded path. 我已经制作了一个rpm软件包,用于安装程序,并且它需要将文件复制到其中的一个文件夹是一个symbolic link因为该符号链接指向的程序可能会随时间变化,因此更易于维护rpm的构建通过将文件复制到symbolic link而不是硬编码路径来打包。 However, I get the error 但是,我得到了错误

cp: cannot overwrite directory with non-directory

when the rpm package tried to copy the file to the symbolic link folder. rpm软件包尝试将文件复制到符号链接文件夹时。 Why does this happen, and is there anything I can do to work around this error other then making the files to be copied to the folder the symbolic link points to? 为什么会发生这种情况,并且除了将文件复制到symbolic link指向的文件夹之外,还可以采取其他措施来解决此错误吗? I am running RHEL 6.6 as of note. 注意,我正在运行RHEL 6.6

That error generally means something like you having told cp to treat the target as a normal file (the -T argument). 该错误通常表示您已经告诉cp将目标视为普通文件( -T参数)。

$ ls -lR
.:
total 16
drwxr-xr-x 2 root root 4096 Feb  6 09:46 dir
-rw-r--r-- 1 root root    0 Feb  6 09:45 file
lrwxrwxrwx 1 root root    3 Feb  6 09:45 symdir -> dir

./dir:
total 0
$ cp -T file symdir
cp: cannot overwrite non-directory `symdir' with non-directory
$ ls -lR
.:
total 16
drwxr-xr-x 2 root root 4096 Feb  6 09:46 dir
-rw-r--r-- 1 root root    0 Feb  6 09:45 file
lrwxrwxrwx 1 root root    3 Feb  6 09:45 symdir -> dir

./dir:
total 0
$ cp file symdir
$ ls -lR
.:
total 16
drwxr-xr-x 2 root root 4096 Feb  6 09:46 dir
-rw-r--r-- 1 root root    0 Feb  6 09:45 file
lrwxrwxrwx 1 root root    3 Feb  6 09:45 symdir -> dir

./dir:
total 4
-rw-r--r-- 1 root root 0 Feb  6 09:46 file

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 CentOS 5.5 - 创建RPM规范文件的符号链接 - CentOS 5.5 - symbolic link creation into RPM spec file 如何确定linux符号链接是否指向目录或文件 - How to determine if a linux symbolic link points to a directory or a file RPM build没有这样的文件或目录 - RPM build No such file or directory rpm规格文件的安装后脚本中的yum / rpm install命令 - yum/rpm install command in post install script of rpm spec file 符号链接到文件夹中的最新文件 - Symbolic link to latest file in a folder 创建一个名为 long_file 的符号链接,指向当前目录中最大的文件 - Create a symbolic link named long_file pointing to the largest file in the current directory 创建指向多个目录中心的符号链接 - create a symbolic link to multiple directory centos 在redhat或centos Linux中的不同目录中具有嵌入式Flash SWF的HTML文件的符号链接 - Symbolic link for html file with an embeded flash swf located in different directory in redhat or centos Linux Node.js:在使用“fs”迭代目录时检查文件是否是符号链接 - Node.js: Check if file is an symbolic link when iterating over directory with 'fs' 如何检测何时在Linux中的符号链接目录中修改了一个文件 - How to detect when one file is modified inside a symbolic link directory in Linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM