-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorig-vmwsmr.sh
More file actions
49 lines (40 loc) · 1.76 KB
/
orig-vmwsmr.sh
File metadata and controls
49 lines (40 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
set -e # Exit immediately if a command exits with a non-zero status
# 1. Set working directory to where your keys are located
cd /root
# 2. define variables
KERN_VER=$(uname -r)
VMWARE_MODULE_DIR="/lib/modules/$KERN_VER/misc"
SIGN_SCRIPT="/usr/src/linux-headers-$KERN_VER/scripts/sign-file"
echo "Starting vmmon and vmnet modules rebuild for kernel $KERN_VER..."
# 3. Recompile modules
# --install-all compiles and installs the modules to the directory defined above
# We append '|| true' because this command attempts to start services immediately
# after compilation. Since modules aren't signed yet, service launch fails.
# We ignore this specific error to proceed to signing.
/usr/bin/vmware-modconfig --console --install-all || true
# 4. Sign the modules
# We verify the signing script exists first to avoid vague errors if headers are missing
if [ -f "$SIGN_SCRIPT" ]; then
# SAFETY CHECK: verify compilation actually created the file before signing
if [ ! -f "$VMWARE_MODULE_DIR/vmmon.ko" ]; then
echo "ERROR: vmmon.ko was not found at $VMWARE_MODULE_DIR. Compilation likely failed completely."
exit 1
fi
if [ ! -f "$VMWARE_MODULE_DIR/vmnet.ko" ]; then
echo "ERROR: vmnet.ko was not found at $VMWARE_MODULE_DIR. Compilation likely failed completely."
exit 1
fi
echo "Signing vmmon..."
"$SIGN_SCRIPT" sha256 MOK.priv MOK.der "$VMWARE_MODULE_DIR/vmmon.ko"
echo "Signing vmnet..."
"$SIGN_SCRIPT" sha256 MOK.priv MOK.der "$VMWARE_MODULE_DIR/vmnet.ko"
else
echo "ERROR: Signing script not found at $SIGN_SCRIPT. Are linux-headers installed?"
exit 1
fi
# 5. Load the modules explicitly
echo "Loading modules..."
modprobe vmmon
modprobe vmnet
echo "vmmon and vmnet modules rebuild and sign complete."