From 7e8bc5fa19dc6e20db80f8634cd6551fba0c6a5a Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Mon, 25 Nov 2024 12:18:39 +0100 Subject: [PATCH] bugfix: fix command to add user to sudoers group --- util/wsl.psm1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/wsl.psm1 b/util/wsl.psm1 index db417e6..de29625 100644 --- a/util/wsl.psm1 +++ b/util/wsl.psm1 @@ -35,8 +35,8 @@ function WSLInstall wsl.exe --install -d Ubuntu # Add newly created user to sudoers group - $user = wsl.exe cut "-d:" "-f1" /etc/passwd - wsl.exe -u root echo "echo ""$user ALL=(ALL) NOPASSWD:ALL"" >> /etc/sudoers.d/$user" + $user = wsl.exe cut "-d:" "-f1" /etc/passwd | Select-Object -Last 1 + wsl.exe -u root echo "$user ALL=(ALL) NOPASSWD:ALL" ">>" "/etc/sudoers.d/$user" # Update packages and install from list wsl.exe sudo apt update "&&" sudo apt upgrade "-y"