From 151ce5dc3e361a418f8c18f49b1f36d1f96313d7 Mon Sep 17 00:00:00 2001
From: Marcus Comstedt <marcus@mc.pp.se>
Date: Tue, 5 Jan 2021 23:41:34 +0100
Subject: [PATCH] install_module: Remove destination before copy if it is a
 file

This prevents overwriting executable binaries, something which
confuses the code signing logic on macOS.
---
 bin/install_module | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bin/install_module b/bin/install_module
index 07c4292da1..97b71e8df7 100755
--- a/bin/install_module
+++ b/bin/install_module
@@ -78,6 +78,9 @@ if [ -d "$FROM" ]; then
   CPFLAGS="-r"
 fi
 
+if [ -f "$TO" ]; then
+  rm -f "$TO"
+fi
 cp $CPFLAGS "$FROM" "$TO"
 
 exit $?
-- 
GitLab