1
Fork 0

wsl: make creating new user optional

This commit is contained in:
Alan Faubert 2025-01-02 11:05:14 -05:00
parent 5b04867bc8
commit 496d67c9c3

View file

@ -1,8 +1,8 @@
@echo off
if not "%~1"=="" if not "%~2"=="" if not "%~3"=="" if not "%~4"=="" goto :run
echo Arguments: ^<filesystem.tar.gz^> ^<destination directory^> ^<distribution name^> ^<user name^>
if not "%~1"=="" if not "%~2"=="" if not "%~3"=="" goto :run
echo Arguments: ^<filesystem.tar.gz^> ^<destination directory^> ^<distribution name^> [user name]
exit /b 1
:run
wsl.exe --import %~3 "%~2" "%~1" --version 2
wsl.exe --distribution %~3 -- adduser %~4; adduser %~4 sudo; echo $'[user]\n\tdefault = %~4' ^> /etc/wsl.conf; chmod 644 /etc/wsl.conf
if not "%~4"=="" wsl.exe --distribution %~3 -- adduser %~4; adduser %~4 sudo; echo $'[user]\n\tdefault = %~4' ^> /etc/wsl.conf; chmod 644 /etc/wsl.conf
wsl.exe --terminate %~3