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

fix: Access virt-manager using polkit rules #39

Merged
merged 4 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions base/etc/firstboot/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,5 @@
"rpms": [
"1password"
],
"userGroups": [
"libvirt"
]
"userGroups": []
}
5 changes: 5 additions & 0 deletions base/etc/polkit-1/rules.d/100-libvirt-acl.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
polkit.addRule(function(action, subject) {
if (action.id == "org.libvirt.unix.manage" && subject.local && subject.active && subject.isInGroup("wheel")) {
return polkit.Result.YES;
}
});
10 changes: 7 additions & 3 deletions base/usr/libexec/firstboot
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@ install_rpms() {
echo "Installing RPMs..."
# Read list of RPMs from /etc/firstboot/config.json and install them
rpms=$(jq -r '.rpms[]' /etc/firstboot/config.json)
rpm-ostree install --idempotent -y "$rpms"

if [[ -n "$rpms" ]]; then
rpm-ostree install --idempotent -y "$rpms"
else
echo "No RPMs to install."
fi
}

configure_user_groups() {
echo "Configuring user groups..."
# Read list of groups from /etc/firstboot/config.json and add user to them permanently
# This must be done by appending to /etc/group, as usermod -aG doesn't work on firstboot
# Read list of user groups from /etc/firstboot/config.json and add them to the current user
groups=$(jq -r '.userGroups[]' /etc/firstboot/config.json)
for group in $groups; do
if ! grep -q "^$group:" /etc/group; then
Expand Down