Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save class101/8ecb2c6dc8ebb7428a01eb56b2c5f9c5 to your computer and use it in GitHub Desktop.
Save class101/8ecb2c6dc8ebb7428a01eb56b2c5f9c5 to your computer and use it in GitHub Desktop.
Add Load-On-Demand support for the services of ArchLinux aur/vmware-workstation
From 31d0cce5d03127d69c5628881b300066f0602f94 Mon Sep 17 00:00:00 2001
From: Arnaud Dovi <mr.dovi@gmail.com>
Date: Wed, 9 Jun 2021 11:40:24 +0200
Subject: [PATCH] Add Load-On-Demand support for the services of
aur/vmware-workstation
PKGBUILD: added vmware-*.path files
vmware-*.service: removed the [Install] section in order to prevent the activation of the service by the user
vmware-*.install: enable path files automatically, disable service files
---
PKGBUILD | 12 +++++++++---
vmware-networks.path | 8 ++++++++
vmware-networks.service | 3 ---
vmware-usbarbitrator.path | 8 ++++++++
vmware-usbarbitrator.service | 3 ---
vmware-workstation.install | 10 ++++++----
6 files changed, 31 insertions(+), 13 deletions(-)
create mode 100644 vmware-networks.path
create mode 100644 vmware-usbarbitrator.path
diff --git a/PKGBUILD b/PKGBUILD
index acc40bc..86fb649 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -65,7 +65,9 @@ source=(
'vmware-networks-configuration.service'
'vmware-networks.service'
+ 'vmware-networks.path'
'vmware-usbarbitrator.service'
+ 'vmware-usbarbitrator.path'
'dkms.conf.in'
'Makefile'
@@ -82,8 +84,10 @@ sha256sums=(
'b94959a11b28e51b541321be0588190eb10825e9ff55cbd16eb01483a839a69f'
'9b4fbe0ba83f761a2eb9ecd05d48428f8b0a5b3abd8404ccbd928408e682f02b'
- 'c0a5aea785db06921fb350d36d5e0fd9a14f5eee0c835686ec6fea1af8c92245'
- 'd7a9fbf39a0345ae2f14f7f389f30b1110f605d187e0c241e99bbb18993c250d'
+ '359678bee407e4b9ed624af06fd7297bed0b7d904bc332dcd9937ff86f609a0d'
+ '7772e6860f055bf4fc0f6233a6ae61cdb3ee34817490319de811c1a42505b170'
+ '071fa1a0f8cd23a6b207e7c184af95bdcaf7f4c799fb575be87b9ba1b32f66b1'
+ '2e2b1780ad08bcac2f3bc216e0c19bb0cd90ec8dd885b57df8fef3cd13aaaf14'
'10562d11d50edab9abc2b29c8948714edcb9b084f99b3766d07ddd21259e372e'
'273d4357599a3e54259c78cc49054fef8ecfd2c2eda35cbcde3a53a62777a5ac'
@@ -283,7 +287,9 @@ fi
for service_file in \
vmware-networks-configuration.service \
vmware-networks.service \
- vmware-usbarbitrator.service
+ vmware-usbarbitrator.service \
+ vmware-networks.path \
+ vmware-usbarbitrator.path
do
install -Dm 644 \
"$srcdir/$service_file" \
diff --git a/vmware-networks.path b/vmware-networks.path
new file mode 100644
index 0000000..01beca6
--- /dev/null
+++ b/vmware-networks.path
@@ -0,0 +1,8 @@
+[Unit]
+Description=Monitor to Load-On-Demand the VMware Networks service
+
+[Path]
+PathModified=/run/vmware
+
+[Install]
+WantedBy=paths.target
diff --git a/vmware-networks.service b/vmware-networks.service
index 7d520a2..4e37157 100644
--- a/vmware-networks.service
+++ b/vmware-networks.service
@@ -8,6 +8,3 @@ Type=forking
ExecStartPre=-/sbin/modprobe vmnet
ExecStart=/usr/bin/vmware-networks --start
ExecStop=/usr/bin/vmware-networks --stop
-
-[Install]
-WantedBy=multi-user.target
diff --git a/vmware-usbarbitrator.path b/vmware-usbarbitrator.path
new file mode 100644
index 0000000..e79fa8e
--- /dev/null
+++ b/vmware-usbarbitrator.path
@@ -0,0 +1,8 @@
+[Unit]
+Description=Monitor to Load-On-Demand the VMware USB Arbitrator
+
+[Path]
+PathModified=/run/vmware
+
+[Install]
+WantedBy=paths.target
diff --git a/vmware-usbarbitrator.service b/vmware-usbarbitrator.service
index fd1d9ca..a2d4445 100644
--- a/vmware-usbarbitrator.service
+++ b/vmware-usbarbitrator.service
@@ -3,6 +3,3 @@ Description=VMware USB Arbitrator
[Service]
ExecStart=/usr/lib/vmware/bin/vmware-usbarbitrator -f
-
-[Install]
-WantedBy=multi-user.target
diff --git a/vmware-workstation.install b/vmware-workstation.install
index 87af854..e465b95 100644
--- a/vmware-workstation.install
+++ b/vmware-workstation.install
@@ -1,15 +1,17 @@
post_install() {
+ modprobe -a vmw_vmci vmmon > /dev/null 2>&1
+ systemctl enable --now vmware-networks.path vmware-usbarbitrator.path
cat << EOF
-==> Before using VMware, you need to reboot or load vmw_vmci and vmmon kernel modules (in a terminal on root: modprobe -a vmw_vmci vmmon)
-==> You may also need to enable some of these services:
-- vmware-networks.service: to have network access inside VMs
-- vmware-usbarbitrator.service: to connect USB devices inside VMs
+==> After the first installation, a reboot of the system might be necessary if you see vmware complaining about a missing vmmon device upon starting up a vm.
EOF
+# Ensure the old AUR users don't load the vmware service permanently anymore
+systemctl disable --now vmware-networks.service vmware-usbarbitrator.service > /dev/null 2>&1
}
post_remove() {
+ systemctl disable --now vmware-networks.path vmware-usbarbitrator.path
cat << EOF
==> To remove VMware settings, delete /etc/vmware and /etc/vmware-installer directories.
--
2.32.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment