From c552b30112a3c127e788cec57932189812dad683 Mon Sep 17 00:00:00 2001 From: Pathfinder Date: Tue, 27 Oct 2026 15:19:08 +0100 Subject: [PATCH] Advanced menu libvirt wiring: use SUDO_USER fallback like session prereqs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit usermod used $USER directly; under sudo $USER can be root. All other user-scoped calls already use ${SUDO_USER:-$USER} — aligned. No hardcoded usernames anywhere in the repo (verified by grep; only the dotfiles repo URL, which is overridable via DOTFILES_REPO). --- setup.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index 06bca69..8437f72 100755 --- a/setup.sh +++ b/setup.sh @@ -541,9 +541,10 @@ install_category_pkgs() { [[ "$item" == *libvirt* || "$item" == *virt-manager* || "$item" == *virt-install* ]] && wants_libvirt=true done if $wants_libvirt; then - info "Enabling libvirtd and adding $USER to the libvirt group..." + local real_user="${SUDO_USER:-$USER}" + info "Enabling libvirtd and adding $real_user to the libvirt group..." sudo systemctl enable --now libvirtd 2>/dev/null || true - sudo usermod -aG libvirt "$USER" || true + sudo usermod -aG libvirt "$real_user" || true warn "libvirt group membership applies after re-login." fi ;;