@@ -63,10 +63,17 @@ ifneq ($(BRIDGED),)
63
63
sed -e "s@/opt/socket_vmnet@$(PREFIX)@g" -e "s/en0/$(BRIDGED)/g" launchd/io.github.lima-vm.socket_vmnet.bridged.en0.plist > "$(DESTDIR)/Library/LaunchDaemons/io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED).plist"
64
64
endif
65
65
66
+ define load_launchd
67
+ # Hint: try `launchctl enable system/$(1)` if the `launchctl bootstrap` command below fails
68
+ launchctl bootstrap system "$(DESTDIR ) /Library/LaunchDaemons/$(1 ) .plist"
69
+ launchctl enable system/$(1 )
70
+ launchctl kickstart -kp system/$(1 )
71
+ endef
72
+
66
73
install.launchd : install.launchd.plist
67
- launchctl load -w " $( DESTDIR ) /Library/LaunchDaemons/ io.github.lima-vm.socket_vmnet.plist "
74
+ $( call load_launchd, io.github.lima-vm.socket_vmnet)
68
75
ifneq ($(BRIDGED ) ,)
69
- launchctl load -w "$(DESTDIR)/Library/LaunchDaemons/ io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED).plist"
76
+ $(call load_launchd, io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED))
70
77
endif
71
78
72
79
install : install.bin install.doc install.launchd
@@ -80,11 +87,15 @@ uninstall.bin:
80
87
uninstall.doc :
81
88
rm -rf " $( DESTDIR) /$( PREFIX) /share/doc/socket_vmnet"
82
89
90
+ define unload_launchd
91
+ launchctl bootout system "$(DESTDIR ) /Library/LaunchDaemons/$(1 ) .plist" || true
92
+ endef
93
+
83
94
.PHONY : uninstall.launchd
84
95
uninstall.launchd :
85
- launchctl unload -w " $( DESTDIR ) /Library/LaunchDaemons/ io.github.lima-vm.socket_vmnet.plist "
96
+ $( call unload_launchd, io.github.lima-vm.socket_vmnet)
86
97
ifneq ($(BRIDGED ) ,)
87
- launchctl unload -w "$(DESTDIR)/Library/LaunchDaemons/ io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED).plist"
98
+ $(call unload_launchd, io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED))
88
99
endif
89
100
90
101
uninstall.launchd.plist : uninstall.launchd
0 commit comments