Combreal

dumpConfigureUbuntu.bat

Jun 2nd, 2020
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.00 KB | None | 0 0
  1. @echo off
  2. :start
  3. bash -c ls >nul: 2>nul:
  4. if %ERRORLEVEL% EQU 0 (
  5. del "%~f0"
  6. goto :eof
  7. )
  8.  
  9. set WSLExec=c:\Users\%username%\UbuntuWSL\ubuntu1804.exe
  10.  
  11. rem runas /trustlevel:0x20000 "cmd /c %WSLExec% install --root"
  12. %WSLExec% install --root"
  13. %WSLExec% run /mnt/c/Users/%username%/UbuntuWSL/install/configureUbuntu.sh %username%"
  14. %WSLExec% config --default-user %username%"
  15.  
  16. copy %WSLExec% c:\Users\%username%\Desktop
  17.  
  18. bash -c ls >nul: 2>nul:
  19. if %ERRORLEVEL% NEQ 0 (
  20.   wslconfig /u Ubuntu-18.04
  21. )
  22.  
  23. if exist %~dp0marker (
  24.    rem call :MessageBox "Something wrong happened during Ubuntu WSL installation"
  25.     del %~dp0marker
  26.     del "%~f0"
  27.     goto :eof
  28. )
  29.  
  30. bash -c ls >nul: 2>nul:
  31. if %ERRORLEVEL% NEQ 0 (
  32.   type nul >>%~dp0marker & copy %~dp0marker +,,
  33.   goto start
  34. ) else (
  35.   call :MessageBox "Ubuntu WSL installation is complete"
  36. )
  37.  
  38.  
  39. del "%~f0"
  40. exit 0
  41.  
  42. :MessageBox
  43. echo wscript.quit MsgBox ("%~1", 0, "UbuntuWSL") > "%~dp0infobox.vbs"
  44. wscript /nologo "%~dp0infobox.vbs"
  45. del "%~dp0infobox.vbs"
Add Comment
Please, Sign In to add comment