Skip to content

Commit 1194308

Browse files
committed
lib/qemu/nix: use --remove-destination instead of -f
The cp -f arg only comes into effect if the file is not readable. This is a subset behavior of what we really want, which is for the file to be replaced no matter what. Just remove it before attempting to copy. Signed-off-by: Joel Granados <joel.granados@kernel.org>
1 parent df1cd75 commit 1194308

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/qemu/nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ _qemu_nix_create_nix_sys () {
1616
fi
1717

1818
_add_pre_cmd "mkdir -p \"${flake_dst_dir}\""
19-
_add_pre_cmd "cp -f \"${NIX_FLAKE_PATH}\" \"${flake_dst_path}\""
19+
_add_pre_cmd "cp --remove-destination \"${NIX_FLAKE_PATH}\" \"${flake_dst_path}\""
2020

2121
_add_pre_cmd "nix build \
2222
'path:${flake_dst_dir}#${flake_attr_path}' \
@@ -35,10 +35,10 @@ _qemu_nix_create_nix_init () {
3535
_require_program "$(command -v musl-clang 2> /dev/null || echo gcc)"
3636

3737
local make_path="${state_dir}/Makefile"
38-
_add_pre_cmd "cp -f \"${BASEDIR}/contrib/nix/Makefile\" \"${make_path}\""
38+
_add_pre_cmd "cp --remove-destination \"${BASEDIR}/contrib/nix/Makefile\" \"${make_path}\""
3939

4040
local c_init_path="${state_dir}/vmctl_init.c"
41-
_add_pre_cmd "cp -f \"${BASEDIR}/contrib/nix/vmctl_init.c\" \"${c_init_path}\""
41+
_add_pre_cmd "cp --remove-destination \"${BASEDIR}/contrib/nix/vmctl_init.c\" \"${c_init_path}\""
4242

4343
if [[ ${NIX_INIT_REBUILD} == "yes" ]]; then
4444
_add_pre_cmd "make -C \"${state_dir}\" clean"

0 commit comments

Comments
 (0)