Skip to content

Commit

Permalink
Merge pull request #12 from AkihiroSuda/dev
Browse files Browse the repository at this point in the history
launchd: fix Label: `io.github.lima-vm.socket_vmnet.plist` -> `io.github.lima-vm.socket_vmnet`
  • Loading branch information
AkihiroSuda authored Nov 22, 2022
2 parents a530ed0 + 5dda29c commit efae138
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ jobs:
- name: Make Install (arm64)
run: |
# cross-compile for arm64
sudo make PREFIX=/opt/socket_vmnet.arm64 ARCH=arm64 install
# Skip installing launchd services
sudo make PREFIX=/opt/socket_vmnet.arm64 ARCH=arm64 install.bin install.doc
if file /opt/socket_vmnet.arm64/bin/* | grep -q x86_64 ; then false ; fi
- name: Print launchd status (shared mode)
run: launchctl print system/io.github.lima-vm.socket_vmnet.plist
run: launchctl print system/io.github.lima-vm.socket_vmnet
- name: Install test dependencies
run: brew install qemu bash coreutils
- name: Test (shared mode)
Expand Down
19 changes: 15 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,17 @@ ifneq ($(BRIDGED),)
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"
endif

define load_launchd
# Hint: try `launchctl enable system/$(1)` if the `launchctl bootstrap` command below fails
launchctl bootstrap system "$(DESTDIR)/Library/LaunchDaemons/$(1).plist"
launchctl enable system/$(1)
launchctl kickstart -kp system/$(1)
endef

install.launchd: install.launchd.plist
launchctl load -w "$(DESTDIR)/Library/LaunchDaemons/io.github.lima-vm.socket_vmnet.plist"
$(call load_launchd,io.github.lima-vm.socket_vmnet)
ifneq ($(BRIDGED),)
launchctl load -w "$(DESTDIR)/Library/LaunchDaemons/io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED).plist"
$(call load_launchd,io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED))
endif

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

define unload_launchd
launchctl bootout system "$(DESTDIR)/Library/LaunchDaemons/$(1).plist" || true
endef

.PHONY: uninstall.launchd
uninstall.launchd:
launchctl unload -w "$(DESTDIR)/Library/LaunchDaemons/io.github.lima-vm.socket_vmnet.plist"
$(call unload_launchd,io.github.lima-vm.socket_vmnet)
ifneq ($(BRIDGED),)
launchctl unload -w "$(DESTDIR)/Library/LaunchDaemons/io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED).plist"
$(call unload_launchd,io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED))
endif

uninstall.launchd.plist: uninstall.launchd
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ tmp-vm01 1 de:ad:be:ef:00:01 192.168.105.100

- Reload the DHCP daemon.
```
sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist
sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist
sudo /bin/launchctl kickstart -kp system/com.apple.bootpd
```

- Run QEMU with the MAC address: `-device virtio-net-pci,netdev=net0,mac=de:ad:be:ef:00:01` .
Expand Down
2 changes: 1 addition & 1 deletion launchd/io.github.lima-vm.socket_vmnet.bridged.en0.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<plist version="1.0">
<dict>
<key>Label</key>
<string>io.github.lima-vm.socket_vmnet.bridged.en0.plist</string>
<string>io.github.lima-vm.socket_vmnet.bridged.en0</string>
<key>Program</key>
<string>/opt/socket_vmnet/bin/socket_vmnet</string>
<key>ProgramArguments</key>
Expand Down
2 changes: 1 addition & 1 deletion launchd/io.github.lima-vm.socket_vmnet.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<plist version="1.0">
<dict>
<key>Label</key>
<string>io.github.lima-vm.socket_vmnet.plist</string>
<string>io.github.lima-vm.socket_vmnet</string>
<key>Program</key>
<string>/opt/socket_vmnet/bin/socket_vmnet</string>
<key>ProgramArguments</key>
Expand Down

0 comments on commit efae138

Please sign in to comment.