forked from crc-org/snc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrc-needs-tap.sh
More file actions
45 lines (37 loc) · 1.03 KB
/
Copy pathcrc-needs-tap.sh
File metadata and controls
45 lines (37 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
set -o pipefail
set -o errexit
set -o nounset
set -o errtrace
set -x
source /etc/sysconfig/crc-env || echo "WARNING: crc-env not found"
EXIT_NEED_TAP=0
EXIT_DONT_NEED_TAP=77
EXIT_ERROR=1
if /usr/local/bin/crc-self-sufficient-env.sh; then
echo "Running a self-sufficient bundle. Don't need tap0"
exit "$EXIT_DONT_NEED_TAP"
fi
if /usr/local/bin/crc-user-mode-networking.sh system; then
echo "Running with CRC and system-mode networking. Don't need tap0. (Fairly rare case.)"
exit "$EXIT_DONT_NEED_TAP"
fi
# running with CRC (not a self-sufficient bundle)
# running with user-mode networking
# --> vfkit doesn't need tap0
# --> other platforms do need it
virt="$(systemd-detect-virt || true)"
case "${virt}" in
apple)
echo "Running with vfkit ($virt) virtualization. Don't need tap0."
exit "$EXIT_DONT_NEED_TAP"
;;
none)
echo "Bare metal detected. Don't need tap0."
exit "$EXIT_DONT_NEED_TAP"
;;
*)
echo "Running with '$virt' virtualization. Need tap0."
exit "$EXIT_NEED_TAP"
;;
esac