From e039170e314b4f5a1ea301a351e31192a3d59aff Mon Sep 17 00:00:00 2001 From: fdupoux Date: Wed, 5 Aug 2020 20:03:43 +0100 Subject: [PATCH] Test binaries from custom packages during the build (#133) --- airootfs/root/customize_airootfs.sh | 3 +++ airootfs/usr/bin/check-binaries.sh | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100755 airootfs/usr/bin/check-binaries.sh diff --git a/airootfs/root/customize_airootfs.sh b/airootfs/root/customize_airootfs.sh index 9878466..aa2792e 100755 --- a/airootfs/root/customize_airootfs.sh +++ b/airootfs/root/customize_airootfs.sh @@ -71,6 +71,9 @@ fi # Update pacman.conf sed -i -e '/# ==== BEGIN customrepos ====/,/# ==== END customrepos ====/d' /etc/pacman.conf +# Check for issues with binaries +/usr/bin/check-binaries.sh + # Customizations /usr/bin/updatedb diff --git a/airootfs/usr/bin/check-binaries.sh b/airootfs/usr/bin/check-binaries.sh new file mode 100755 index 0000000..ff85733 --- /dev/null +++ b/airootfs/usr/bin/check-binaries.sh @@ -0,0 +1,25 @@ +#!/bin/bash +errcnt=0 + +for curfile in /usr/bin/{*btrfs*,*xfs*,featherpad,ms-sys,nwipe,udp*,whdd,zerofree} /opt/firefox*/firefox* +do + test -x ${curfile} || continue + file --mime ${curfile} | grep -q x-pie-executable || continue + + if ldd ${curfile} | grep -q -F 'not found' + then + echo "ERROR: Program ${curfile} is missing libraries" + ldd ${curfile} + errcnt=$((errcnt + 1)) + fi + +done + +if [ ${errcnt} -eq 0 ] +then + echo "SUCCESS: Have not found any missing library" + exit 0 +else + echo "FAILURE: Have found ${errcnt} issues" + exit 1 +fi