Skip to content

functions: use the -f/--force option when copying files with add_file

nl6720 requested to merge nl6720/mkinitcpio:use-the-force into master

When mkinitcpio is executed as a regular user instead of root, sometimes it will fail to overwrite files in the work directory.

For example, with a build hook containing:

add_binary /usr/bin/dmsetup
add_binary /usr/bin/dmsetup

The mkinitcpio output will contain:

cp: cannot create regular file '/tmp/mkinitcpio.XOuS4Z/root/usr/bin/dmsetup': Permission denied

Using the cp command's -f/--force option instructs it to remove the file if it cannot be opened. This prevents the issue.

Merge request reports