Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // create bash script
- sudo nano /usr/local/bin/rebuild-vmware-modules.sh
- // add contents of script
- #!/bin/bash
- if [ "$(id -u)" -ne 0 ]; then
- echo "This operation requires root privileges."
- exit 1
- fi
- /usr/bin/vmware-modconfig --console --install-all
- /// create a systemd path file to monitor kernel changes
- sudo nano /etc/systemd/system/rebuild-vmware-modules.path
- /// add to path file
- [Unit]
- Description=Monitor Kernel Headers for Changes
- [Path]
- PathChanged=/usr/src/kernels
- PathChanged=/lib/modules
- [Install]
- WantedBy=multi-user.target
- /// create systemd service file
- sudo nano /etc/systemd/system/rebuild-vmware-modules.service
- /// add to service file
- [Unit]
- Description=Rebuild VMware Workstation Kernel Modules
- After=network.target
- [Service]
- Type=oneshot
- ExecStart=/usr/local/bin/rebuild-vmware-modules.sh
- RemainAfterExit=true
- User=root
- Group=root
- [Install]
- WantedBy=multi-user.target
- /// reload and enable
- sudo systemctl daemon-reload
- sudo systemctl enable rebuild-vmware-modules.service
- sudo systemctl enable rebuild-vmware-modules.path
- sudo systemctl start rebuild-vmware-modules.path
- /// test manually if you want; first run the script
- sudo /usr/local/bin/rebuild-vmware-modules.sh
- /// if it works, try triggering the service
- sudo systemctl start rebuild-vmware-modules.service
- /// check the status of the service to see if it ran successfully
- sudo systemctl status rebuild-vmware-modules.service
Advertisement
Add Comment
Please, Sign In to add comment