I am building my first PKGBUILD and I have run into a problem. The package I'm building is trying overwriting files in /usr/lib/crda. At first I put the file copy instructions in the build() function of my PKGBUILD. However, it complained about existing files and aborted the installation. So I tried to get around this existing file restriction, and built an .install script. However, I needed access to the $srcdir, $pkgver and $USER variables, and those are not passed on to the install script.
I'm guessing I got the concepts wrong somehow, and that overwriting of existing files is done through some other mechanism. Exactly how would I go about creating a PKGBUILD that was able to overwrite existing files?
a new package should never overwrite files from other packages, if your package contains files that would overwrite files from another package, then it [ conflicts ] with the other package, and you should put a conflicts=() into your PKGBUILD to ensure the conflicting package is removed before your package is installed
At first I put the file copy instructions in the build() function of my PKGBUILD. However, it complained about existing files and aborted the installation.
There are no existing files before you build a package, so either you're not using $pkgdir, and your PKGBUILD is attempting to install directly into the installed system, or else you're on your Nth build attempt and you haven't cleaned out the build directory after the last attempt.