#!/bin/bash
# Elevate script
if [ ! "$UID" -eq 0 ]
then
    sudo bash "$BASH_SOURCE";
else
    keyDir="/var/lib/shim-signed/mok";
    keyFile="$keyDir/MOK.priv";
    pubFile="$keyDir/MOK.der";

    for file in $(find /lib/modules /var/lib/dkms -name *.ko);
    do
        kmodsign sha512 "$keyFile" "$pubFile" "$file";
    done
fi