From 2fd1bb62db7b8ff210dedc16a4466935ad2e9aa7 Mon Sep 17 00:00:00 2001 From: "ye.sijun" Date: Thu, 10 Mar 2022 20:56:58 +0800 Subject: [PATCH] add vde-2 submodule for install Signed-off-by: Ye Sijun --- .gitmodules | 3 +++ Makefile | 12 ++++++++++-- README.md | 29 +++++++---------------------- vde-2 | 1 + 4 files changed, 21 insertions(+), 24 deletions(-) create mode 100644 .gitmodules create mode 160000 vde-2 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5933736 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vde-2"] + path = vde-2 + url = https://github.com/virtualsquare/vde-2 diff --git a/Makefile b/Makefile index cfb17ce..7c14726 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,10 @@ vde_vmnet: $(OBJS) install.bin: vde_vmnet install vde_vmnet "$(DESTDIR)/$(PREFIX)/bin/vde_vmnet" +install.vde-2: + git submodule update --init + cd vde-2 && autoreconf -fis && CFLAGS="" LDFLAGS="" ./configure --prefix=$(VDEPREFIX) && make && make install + install.launchd.plist: launchd/*.plist sed -e "s@/opt/vde@$(PREFIX)@g" launchd/io.github.virtualsquare.vde-2.vde_switch.plist > "$(DESTDIR)/Library/LaunchDaemons/io.github.virtualsquare.vde-2.vde_switch.plist" sed -e "s@/opt/vde@$(PREFIX)@g" launchd/io.github.lima-vm.vde_vmnet.plist > "$(DESTDIR)/Library/LaunchDaemons/io.github.lima-vm.vde_vmnet.plist" @@ -44,12 +48,16 @@ ifneq ($(BRIDGED),) launchctl load -w "$(DESTDIR)/Library/LaunchDaemons/io.github.lima-vm.vde_vmnet.bridged.$(BRIDGED).plist" endif -install: install.bin install.launchd +install: install.vde-2 install.bin install.launchd .PHONY: uninstall.bin uninstall.bin: rm -f "$(DESTDIR)/$(PREFIX)/bin/vde_vmnet" +.PHONY: uninstall.vde-2 +uninstall.vde-2: + cd vde-2 && make uninstall + .PHONY: uninstall.launchd uninstall.launchd: launchctl unload -w "$(DESTDIR)/Library/LaunchDaemons/io.github.lima-vm.vde_vmnet.plist" @@ -67,7 +75,7 @@ ifneq ($(BRIDGED),) rm -f "$(DESTDIR)/Library/LaunchDaemons/io.github.virtualsquare.vde-2.vde_switch.bridged.$(BRIDGED).plist" endif -uninstall: uninstall.launchd.plist uninstall.bin +uninstall: uninstall.launchd.plist uninstall.bin uninstall.vde-2 .PHONY: clean clean: diff --git a/README.md b/README.md index e0bcb3e..9f674e1 100644 --- a/README.md +++ b/README.md @@ -10,34 +10,19 @@ Requires macOS 10.15 or later. -### Step 1: Install vde-2 (`vde_switch`) - -The version of `vde-2` must be [commit 74278b9b](https://github.com/virtualsquare/vde-2/tree/74278b9b) (2021-12-12) or later. +Install [vde-2](https://github.com/virtualsquare/vde-2) and vde_vmnet from source. +```bash +sudo make PREFIX=/opt/vde install +``` -The `--prefix` dir below does not necessarily need to be `/opt/vde`, however, it is highly recommended +The `PREFIX` dir below does not necessarily need to be `/opt/vde`, however, it is highly recommended to set the prefix to a directory that can be only written by the root. Note that `/usr/local` is typically chowned for a non-root user on Homebrew environments, so `/usr/local` is *not* an appropriate prefix. -```bash -git clone https://github.com/virtualsquare/vde-2.git -cd vde-2 -autoreconf -fis -./configure --prefix=/opt/vde -make -sudo make install -``` - -### Step 2: Install `vde_vmnet` -```bash -git clone https://github.com/lima-vm/vde_vmnet -cd vde_vmnet -make PREFIX=/opt/vde -sudo make PREFIX=/opt/vde install -``` - The following files will be installed: +- `/opt/vde/bin/vde_switch` (from vde-2) - `/opt/vde/bin/vde_vmnet` - `/Library/LaunchDaemons/io.github.virtualsquare.vde-2.vde_switch.plist` - `/Library/LaunchDaemons/io.github.lima-vm.vde_vmnet.plist` @@ -86,7 +71,7 @@ Use `/var/run/vde.bridged.en0.ctl` as the VDE socket path. ### Testing without launchd ```console -make +make install.vde-2 make install.bin ``` diff --git a/vde-2 b/vde-2 new file mode 160000 index 0000000..74278b9 --- /dev/null +++ b/vde-2 @@ -0,0 +1 @@ +Subproject commit 74278b9b7cf816f0356181f387012fdeb6d65b52