Skip to content

Commit

Permalink
Avoid striping binaries incorrectly by detecting architecture: UNKNOW…
Browse files Browse the repository at this point in the history
…N reports
  • Loading branch information
Gowee committed Sep 23, 2019
1 parent 734bc3b commit cdb9ab9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ci/before_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ set -ex

try_compress() {
file=$1
target=$(objdump -a $file | grep -oP "(?<=format )[\w-]+" | tr -d '\n' || "")
if [ -n "$target" ] && strip -v $file --target $target; then
echo "Stripped $file (target: $target)."
header=$(objdump -f $file)
if ! echo $header | grep -P "architecture: \s*UNKNOWN" ; then
target=$(echo $header| grep -oP "(?<=format )\s*[\w-]+" | tr -d '\n' || "")
if [ -n "$target" ] && strip -v $file --target $target; then
echo "Stripped $file (target: $target)."
fi
fi
if upx $file; then
echo "Upx $file done."
Expand Down

0 comments on commit cdb9ab9

Please sign in to comment.