Skip to content

Commit efae138

Browse files
authored
Merge pull request #12 from AkihiroSuda/dev
launchd: fix Label: `io.github.lima-vm.socket_vmnet.plist` -> `io.github.lima-vm.socket_vmnet`
2 parents a530ed0 + 5dda29c commit efae138

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ 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)
41-
run: launchctl print system/io.github.lima-vm.socket_vmnet.plist
42+
run: launchctl print system/io.github.lima-vm.socket_vmnet
4243
- name: Install test dependencies
4344
run: brew install qemu bash coreutils
4445
- name: Test (shared mode)

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` .

launchd/io.github.lima-vm.socket_vmnet.bridged.en0.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<plist version="1.0">
55
<dict>
66
<key>Label</key>
7-
<string>io.github.lima-vm.socket_vmnet.bridged.en0.plist</string>
7+
<string>io.github.lima-vm.socket_vmnet.bridged.en0</string>
88
<key>Program</key>
99
<string>/opt/socket_vmnet/bin/socket_vmnet</string>
1010
<key>ProgramArguments</key>

launchd/io.github.lima-vm.socket_vmnet.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<plist version="1.0">
55
<dict>
66
<key>Label</key>
7-
<string>io.github.lima-vm.socket_vmnet.plist</string>
7+
<string>io.github.lima-vm.socket_vmnet</string>
88
<key>Program</key>
99
<string>/opt/socket_vmnet/bin/socket_vmnet</string>
1010
<key>ProgramArguments</key>

0 commit comments

Comments
 (0)