From 71984f3e28827549aad5b77939cdeeb62382ecb0 Mon Sep 17 00:00:00 2001
From: Rob Landley <rob@landley.net>
Date: Sat, 27 Oct 2018 10:09:08 -0500
Subject: Allow unstripped build to overwrite read-only output file.

(Output file is read only because broken installs that write to the old filename
will truncate+overwrite toybox binary otherwise.)
---
 scripts/make.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'scripts')

diff --git a/scripts/make.sh b/scripts/make.sh
index ef0a7050..a1fdb343 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -336,8 +336,10 @@ do_loudly $BUILD $LNKFILES $LINK || exit 1
 if [ ! -z "$NOSTRIP" ] ||
   ! do_loudly ${CROSS_COMPILE}${STRIP} "$UNSTRIPPED" -o "$OUTNAME"
 then
-  echo "strip failed, using unstripped" && cp "$UNSTRIPPED" "$OUTNAME" ||
-  exit 1
+  echo "strip failed, using unstripped" &&
+  rm -f "$OUTNAME" &&
+  cp "$UNSTRIPPED" "$OUTNAME" ||
+    exit 1
 fi
 
 # gcc 4.4's strip command is buggy, and doesn't set the executable bit on
-- 
cgit v1.2.3