Skip to content

Commit

Permalink
Merge pull request #434 from Apachez-/T5589
Browse files Browse the repository at this point in the history
T5589: Nonstripped binaries exists in VyOS
  • Loading branch information
c-po authored Oct 9, 2023
2 parents 168a86e + d474248 commit c0662f7
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions data/live-build-config/hooks/live/99-strip-symbols.chroot
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,47 @@ STRIPDIR_UNNEEDED="
/usr/libx32
/usr/sbin
"
STRIP_EXCLUDE=`dpkg-query -L libbinutils | grep '.so'`

# Perform stuff.
echo "Stripping symbols..."

# List excluded files.
echo "Exclude files: ${STRIP_EXCLUDE}"

# CMD: strip
for DIR in ${STRIPDIR_REGULAR}; do
echo "Parse dir (strip): ${DIR}"
find ${DIR} -type f -exec file {} \; | grep 'not stripped' | cut -d ":" -f 1 | while read FILE; do
echo "Strip file (strip): ${FILE}"
${STRIPCMD_REGULAR} ${FILE}
echo "${STRIP_EXCLUDE}" | grep -F -q -w "${FILE}"
if [ $? -ne 0 ]; then
echo "Strip file (strip): ${FILE}"
${STRIPCMD_REGULAR} ${FILE}
fi
done
done

# CMD: strip --strip-debug
for DIR in ${STRIPDIR_DEBUG}; do
echo "Parse dir (strip-debug): ${DIR}"
find ${DIR} -type f -exec file {} \; | grep 'not stripped' | cut -d ":" -f 1 | while read FILE; do
echo "Strip file (strip-debug): ${FILE}"
${STRIPCMD_DEBUG} ${FILE}
echo "${STRIP_EXCLUDE}" | grep -F -q -w "${FILE}"
if [ $? -ne 0 ]; then
echo "Strip file (strip-debug): ${FILE}"
${STRIPCMD_DEBUG} ${FILE}
fi
done
done

# CMD: strip --strip-unneeded
for DIR in ${STRIPDIR_UNNEEDED}; do
echo "Parse dir (strip-unneeded: ${DIR}"
find ${DIR} -type f -exec file {} \; | grep 'not stripped' | cut -d ":" -f 1 | while read FILE; do
echo "Strip file (strip-unneeded): ${FILE}"
${STRIPCMD_UNNEEDED} ${FILE}
echo "${STRIP_EXCLUDE}" | grep -F -q -w "${FILE}"
if [ $? -ne 0 ]; then
echo "Strip file (strip-unneeded): ${FILE}"
${STRIPCMD_UNNEEDED} ${FILE}
fi
done
done

Expand Down

0 comments on commit c0662f7

Please sign in to comment.