mirror of
https://github.com/chinawrj/rtl8812au
synced 2024-11-08 20:35:07 +00:00
Add install and sign script for newer Ubuntu distros with SECUREBOOT
This commit is contained in:
parent
04f55bbaac
commit
0d41a378c5
57
tools/install-and-sign-ubuntu.sh
Executable file
57
tools/install-and-sign-ubuntu.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $(id -u) != 0 ]; then
|
||||
echo " Script must be run as root"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$(mokutil --sb-state)" == *enabled ]]; then
|
||||
SECUREBOOT="ON"
|
||||
else
|
||||
SECUREBOOT="OFF"
|
||||
fi
|
||||
|
||||
RUNASUSER="sudo -u $SUDO_USER"
|
||||
|
||||
# Run this block as user
|
||||
$RUNASUSER bash << EOF
|
||||
echo " Building the module"
|
||||
make -j$(nproc)
|
||||
|
||||
if [ ! -d ".ssl" ] && [ $SECUREBOOT == "ON" ]; then
|
||||
mkdir .ssl
|
||||
fi
|
||||
EOF
|
||||
|
||||
echo -e "\n Installing the module..."
|
||||
make install
|
||||
|
||||
# Sign module if SecureBoot is enabled
|
||||
if [ $SECUREBOOT == "ON" ]; then
|
||||
echo -e "\n Creating X.509 key pair"
|
||||
cd .ssl
|
||||
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=local_rtl8812au/"
|
||||
|
||||
SIGN=/usr/src/linux-headers-$(uname -r)/scripts/sign-file
|
||||
MODULE=$(modinfo -n 88XXau)
|
||||
|
||||
echo -e "\n Signing the following module"
|
||||
echo " $MODULE"
|
||||
|
||||
$SIGN sha256 ./MOK.priv ./MOK.der $MODULE
|
||||
|
||||
# Add key to trusted list
|
||||
echo -e "\n\t ATTENTION"
|
||||
echo -e " MOK manager ask you to enter input password."
|
||||
echo " This password will be needed once after first reboot."
|
||||
|
||||
mokutil --import ./MOK.der
|
||||
|
||||
echo ""
|
||||
echo " System requires reboot."
|
||||
echo " UEFI key manager will appear during the boot."
|
||||
echo " Select 'Enroll MOK' and 'Continue. Then enter input password."
|
||||
else
|
||||
modprobe 88XXau
|
||||
fi
|
Loading…
Reference in New Issue
Block a user