On Wed, Nov 30, 2011 at 08:49:57PM +0800, 郑文辉 wrote:
2011/11/29 Jonathan Steel <jsteel@vorx.com>
Hi,
I was told it was best practice to use "install" rather than "mkdir" and "cp" in a PKGBUILD, but how can you copy a directory and its contents (recursively) using "install"?
If you cannot, with a folder with lots of files, is it best practice to list every file to copy with "install", or use one command to "cp" the whole folder?
Thanks,
Jonathan
I used to combine find and install together to accomplish that.
For example:
find . -type d -exec install -d {,${pkgdir}/opt/xmail/}{} \; find . -type f -exec install -D -m 644 {,${pkgdir}/opt/xmail/}{} \;
Except that brace expansion occurs before parameter expansion, so this fails. Additionally, any non 644 files just lost any special permissioning. Copying entire directory structures is the unusual case. It's always preferrable that upstream provide some sort of sane build system that gets all the permissioning correct. I would suggest using: cp -dr --no-preserve=ownership This way, fakeroot installs the files as root but preserves other metadata. dave