Skip to content

Commit 5d27819

Browse files
bootstrap: configure libvirt quirk on macOS
1 parent 3a208ce commit 5d27819

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

install/v12n/configure_libvirt.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
if is_macos; then
2+
edit_qemu_conf_property() {
3+
local file_path="$1"
4+
local prop_name="$2"
5+
local prop_value="$3"
6+
7+
if ! egrep -i "^${prop_name} =.*" "$file_path"; then
8+
sudo sed -i "s/#${prop_name} = .*/${prop_name} = ${prop_value}/g" "$conf_file"
9+
fi
10+
}
11+
12+
conf_file="$(brew --prefix)/etc/libvirt/qemu.conf"
13+
if test -f "$conf_file"; then
14+
edit_qemu_conf_property "$conf_file" "user" "root"
15+
edit_qemu_conf_property "$conf_file" "group" "root"
16+
# Drop unsuuported features on macOS
17+
# - https://www.naut.ca/blog/2020/08/26/ubuntu-vm-on-macos-with-libvirt-qemu/
18+
# -- https://gitlab.com/libvirt/libvirt/-/issues/241
19+
edit_qemu_conf_property "$conf_file" "security_driver" "none"
20+
edit_qemu_conf_property "$conf_file" "dynamic_ownership" "0"
21+
edit_qemu_conf_property "$conf_file" "remember_owner" "0"
22+
# FIXME: Networking:
23+
# - https://gist.github.com/davidandreoletti/af2a17ea095af9476ad012b4a2365a40
24+
# - https://gitlab.com/libvirt/libvirt/-/issues/75
25+
fi
26+
fi

0 commit comments

Comments
 (0)