imperfectism / rpms / kernel

Forked from rpms/kernel 4 years ago
Clone
8481d4
#! /bin/bash
8481d4
8481d4
MODSECKEY="./signing_key.priv"
8481d4
MODPUBKEY="./signing_key.x509"
d843f0
moddir=$1
d843f0
d843f0
modules=`find $moddir -type f -name '*.ko'`
8481d4
d843f0
NPROC=`nproc`
d843f0
[ -z "$NPROC" ] && NPROC=1
8481d4
d843f0
# NB: this loop runs 2000+ iterations. Try to be fast.
d843f0
echo "$modules" | xargs -r -n16 -P $NPROC sh -c "
d843f0
for mod; do
d843f0
    ./scripts/sign-file sha256 $MODSECKEY $MODPUBKEY \$mod
d843f0
    rm -f \$mod.sig \$mod.dig
8481d4
done
d843f0
" DUMMYARG0   # xargs appends ARG1 ARG2..., which go into $mod in for loop.
8481d4
d843f0
RANDOMMOD=$(echo "$modules" | sort -R | tail -n 1)
8481d4
if [ "~Module signature appended~" != "$(tail -c 28 $RANDOMMOD)" ]; then
8481d4
	echo "*** Modules are unsigned! ***"
8481d4
	exit 1
8481d4
fi
8481d4
8481d4
exit 0