Skip to content

Commit 5dda29c

Browse files
committed
Makefile: update launchd commands
The new commands (available since macOS 10.10) show the detailed progress and error. Signed-off-by: Akihiro Suda <[email protected]>
1 parent 56efcbe commit 5dda29c

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ jobs:
3535
- name: Make Install (arm64)
3636
run: |
3737
# cross-compile for arm64
38-
sudo make PREFIX=/opt/socket_vmnet.arm64 ARCH=arm64 install
38+
# Skip installing launchd services
39+
sudo make PREFIX=/opt/socket_vmnet.arm64 ARCH=arm64 install.bin install.doc
3940
if file /opt/socket_vmnet.arm64/bin/* | grep -q x86_64 ; then false ; fi
4041
- name: Print launchd status (shared mode)
4142
run: launchctl print system/io.github.lima-vm.socket_vmnet

Makefile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,17 @@ ifneq ($(BRIDGED),)
6363
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"
6464
endif
6565

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+
6673
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)
6875
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))
7077
endif
7178

7279
install: install.bin install.doc install.launchd
@@ -80,11 +87,15 @@ uninstall.bin:
8087
uninstall.doc:
8188
rm -rf "$(DESTDIR)/$(PREFIX)/share/doc/socket_vmnet"
8289

90+
define unload_launchd
91+
launchctl bootout system "$(DESTDIR)/Library/LaunchDaemons/$(1).plist" || true
92+
endef
93+
8394
.PHONY: uninstall.launchd
8495
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)
8697
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))
8899
endif
89100

90101
uninstall.launchd.plist: uninstall.launchd

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ tmp-vm01 1 de:ad:be:ef:00:01 192.168.105.100
144144

145145
- Reload the DHCP daemon.
146146
```
147-
sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist
148-
sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist
147+
sudo /bin/launchctl kickstart -kp system/com.apple.bootpd
149148
```
150149

151150
- Run QEMU with the MAC address: `-device virtio-net-pci,netdev=net0,mac=de:ad:be:ef:00:01` .

0 commit comments

Comments
 (0)