Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
launchd: support vde_switch >= 2021-08-31
Browse files Browse the repository at this point in the history
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
  • Loading branch information
AkihiroSuda committed Sep 1, 2021
1 parent 4787860 commit 55799ca
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
run: |
git clone https://github.com/virtualsquare/vde-2.git /tmp/vde-2
cd /tmp/vde-2
# Aug 6, 2021
git checkout 8c65ebc464b2f986d5f1f4e6ae829ef4480c9d5a
# Aug 31, 2021
git checkout 50964c3fb0776e82f8bd1ecdc527683966f3d52c
autoreconf -fis
./configure --prefix=/opt/vde
make
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Requires macOS 10.15 or later.

### Step 1: Install vde-2 (`vde_switch`)

The version of `vde-2` must be [commit 50964c3f](https://github.com/virtualsquare/vde-2/tree/50964c3f) (2021-08-31) or later.

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.

Expand Down
4 changes: 2 additions & 2 deletions etc_sudoers.d/vde_vmnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# - sudo /opt/vde/bin/vde_vmnet ...

# Entries for shared mode (192.168.105.0/24)
%staff ALL=(daemon:staff) NOPASSWD:NOSETENV: /opt/vde/bin/vde_switch --sock=/var/run/vde.ctl --pidfile=/var/run/vde.pid --group=staff --dirmode=0770
%staff ALL=(daemon:staff) NOPASSWD:NOSETENV: /opt/vde/bin/vde_switch --sock=/var/run/vde.ctl --pidfile=/var/run/vde.pid --group=staff --dirmode=0770 --nostdin
%staff ALL=(root:root) NOPASSWD:NOSETENV: /opt/vde/bin/vde_vmnet --vmnet-gateway=192.168.105.1 /var/run/vde.ctl

# Entries for bridged mode (en0)
%staff ALL=(daemon:staff) NOPASSWD:NOSETENV: /opt/vde/bin/vde_switch --sock=/var/run/vde.bridged.en0.ctl --pidfile=/var/run/vde.bridged.en0.pid --group=staff --dirmode=0770
%staff ALL=(daemon:staff) NOPASSWD:NOSETENV: /opt/vde/bin/vde_switch --sock=/var/run/vde.bridged.en0.ctl --pidfile=/var/run/vde.bridged.en0.pid --group=staff --dirmode=0770 --nostdin
%staff ALL=(root:root) NOPASSWD:NOSETENV: /opt/vde/bin/vde_vmnet --vmnet-mode=bridged --vmnet-interface=en0 /var/run/vde.bridged.en0.ctl
18 changes: 12 additions & 6 deletions launchd/io.github.virtualsquare.vde-2.vde_switch.bridged.en0.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@
<key>Label</key>
<string>io.github.virtualsquare.vde-2.vde_switch.bridged.en0.plist</string>
<key>Program</key>
<string>/bin/sh</string>
<string>/usr/local/bin/vde_switch</string>
<key>ProgramArguments</key>
<array>
<!-- vde_switch requires "daemon" flag for non-tty mode since 2014: https://github.com/virtualsquare/vde-2/issues/30 -->
<!-- we use `tail -f /dev/null` to keep the launchd job active -->
<string>/bin/sh</string>
<string>-euc</string>
<string>/opt/vde/bin/vde_switch --daemon --sock=/var/run/vde.bridged.en0.ctl --pidfile=/var/run/vde.bridged.en0.pid --group=staff --dirmode=0770 &amp;&amp; trap 'kill $(cat /var/run/vde.pid)' EXIT ; tail -f /dev/null</string>
<string>/opt/vde/bin/vde_switch</string>
<string>--sock</string>
<string>/var/run/vde.bridged.en0.ctl</string>
<string>--pidfile</string>
<string>/var/run/vde.bridged.en0.pid</string>
<string>--group</string>
<string>staff</string>
<string>--dirmode</string>
<string>0770</string>
<!-- Requires vde-2 2021-08-31 or later -->
<string>--nostdin</string>
</array>
<key>StandardErrorPath</key>
<string>/var/run/vde.bridged.en0.stderr</string>
Expand Down
18 changes: 12 additions & 6 deletions launchd/io.github.virtualsquare.vde-2.vde_switch.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@
<key>Label</key>
<string>io.github.virtualsquare.vde-2.vde_switch.plist</string>
<key>Program</key>
<string>/bin/sh</string>
<string>/usr/local/bin/vde_switch</string>
<key>ProgramArguments</key>
<array>
<!-- vde_switch requires "daemon" flag for non-tty mode since 2014: https://github.com/virtualsquare/vde-2/issues/30 -->
<!-- we use `tail -f /dev/null` to keep the launchd job active -->
<string>/bin/sh</string>
<string>-euc</string>
<string>/opt/vde/bin/vde_switch --daemon --sock=/var/run/vde.ctl --pidfile=/var/run/vde.pid --group=staff --dirmode=0770 &amp;&amp; trap 'kill $(cat /var/run/vde.pid)' EXIT ; tail -f /dev/null</string>
<string>/opt/vde/bin/vde_switch</string>
<string>--sock</string>
<string>/var/run/vde.ctl</string>
<string>--pidfile</string>
<string>/var/run/vde.pid</string>
<string>--group</string>
<string>staff</string>
<string>--dirmode</string>
<string>0770</string>
<!-- Requires vde-2 2021-08-31 or later -->
<string>--nostdin</string>
</array>
<key>StandardErrorPath</key>
<string>/var/run/vde.stderr</string>
Expand Down

0 comments on commit 55799ca

Please sign in to comment.