From eabdad3798b43fa5e9aacd0d0395a74154e56434 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Thu, 8 Dec 2022 10:51:49 +0200 Subject: [mkinitcpio] [PATCH 1/1] functions: fix overwriting of symlinks with regular files Use `cp --remove-destination` in `add_file` to remove the destination file. Without this, if the destination file is an existing symlink, it will be the link target that will get overwritten, not the symlink. --- functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions b/functions index 9939e25..3b3de05 100644 --- a/functions +++ b/functions @@ -650,7 +650,7 @@ add_file() { fi if [[ -z "$mode" ]]; then add_dir "${dest%/*}" - command cp -f --preserve=mode,ownership "$src" "${BUILDROOT}${dest}" + command cp --remove-destination --preserve=mode,ownership "$src" "${BUILDROOT}${dest}" else command install -Dm"$mode" "$src" "${BUILDROOT}${dest}" fi