Clean up and parallelize mod-sign.sh
Thanks to Denys Vlasenko for this work
This commit is contained in:
parent
aa92e83bbb
commit
276fd64595
19
mod-sign.sh
19
mod-sign.sh
@ -11,21 +11,22 @@
|
|||||||
|
|
||||||
MODSECKEY=$1
|
MODSECKEY=$1
|
||||||
MODPUBKEY=$2
|
MODPUBKEY=$2
|
||||||
|
|
||||||
moddir=$3
|
moddir=$3
|
||||||
|
|
||||||
modules=`find $moddir -name *.ko`
|
modules=`find $moddir -type f -name '*.ko'`
|
||||||
|
|
||||||
for mod in $modules
|
NPROC=`nproc`
|
||||||
do
|
[ -z "$NPROC" ] && NPROC=1
|
||||||
dir=`dirname $mod`
|
|
||||||
file=`basename $mod`
|
|
||||||
|
|
||||||
./scripts/sign-file sha256 ${MODSECKEY} ${MODPUBKEY} ${dir}/${file}
|
# NB: this loop runs 2000+ iterations. Try to be fast.
|
||||||
rm -f ${dir}/${file}.{sig,dig}
|
echo "$modules" | xargs -r -n16 -P $NPROC sh -c "
|
||||||
|
for mod; do
|
||||||
|
./scripts/sign-file sha256 $MODSECKEY $MODPUBKEY \$mod
|
||||||
|
rm -f \$mod.sig \$mod.dig
|
||||||
done
|
done
|
||||||
|
" DUMMYARG0 # xargs appends ARG1 ARG2..., which go into $mod in for loop.
|
||||||
|
|
||||||
RANDOMMOD=$(find $moddir -type f -name '*.ko' | sort -R | head -n 1)
|
RANDOMMOD=$(echo "$modules" | sort -R | head -n 1)
|
||||||
if [ "~Module signature appended~" != "$(tail -c 28 $RANDOMMOD)" ]; then
|
if [ "~Module signature appended~" != "$(tail -c 28 $RANDOMMOD)" ]; then
|
||||||
echo "*****************************"
|
echo "*****************************"
|
||||||
echo "*** Modules are unsigned! ***"
|
echo "*** Modules are unsigned! ***"
|
||||||
|
Loading…
Reference in New Issue
Block a user