Support Windows Subsystem for Linux

This commit is contained in:
Nick Peng
2019-02-16 19:39:25 +08:00
parent e8b920fb18
commit 9f3926e048
7 changed files with 219 additions and 12 deletions

View File

@@ -0,0 +1,21 @@
@echo off
set "CURR_PATH=%~dp0"
set "STARTUP_PATH=%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
FOR /F %%i IN ('wsl pwd') DO @set DIR_IN_WSL=%%i
wsl sudo %DIR_IN_WSL%/../../install -i
IF NOT %ERRORLEVEL% == 0 (
echo Install smartdns failed.
pause
exit 1
)
copy %CURR_PATH%\wsl-run.vbs "%STARTUP_PATH%/"
IF NOT %ERRORLEVEL% == 0 (
echo Install startupt script failed.
pause
exit 1
)
echo Install smartdns success
pause

View File

@@ -0,0 +1,21 @@
@echo off
set "CURR_PATH=%~dp0"
set "STARTUP_PATH=%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
FOR /F %%i IN ('wsl pwd') DO @set DIR_IN_WSL=%%i
wsl sudo cp -avf %DIR_IN_WSL%/../../etc/smartdns/* /etc/smartdns/
IF NOT %ERRORLEVEL% == 0 (
echo copy smartdns configuration file failed.
pause
exit 1
)
wsl sudo /etc/init.d/smartdns restart
IF NOT %ERRORLEVEL% == 0 (
echo reload smartdns failed.
pause
exit 1
)
echo reload smartdns success
pause

View File

@@ -0,0 +1,22 @@
@echo off
set "CURR_PATH=%~dp0"
set "STARTUP_PATH=%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
FOR /F %%i IN ('wsl pwd') DO @set DIR_IN_WSL=%%i
wsl sudo %DIR_IN_WSL%/../../install -u
IF NOT %ERRORLEVEL% == 0 (
echo Uninstall smartdns failed.
pause
exit 1
)
del "%STARTUP_PATH%\wsl-run.vbs"
IF NOT %ERRORLEVEL% == 0 (
echo Uninstall startup script failed.
pause
exit 1
)
echo uninstall success
pause

View File

@@ -0,0 +1,2 @@
Set ws = WScript.CreateObject("WScript.Shell")
ws.run "wsl sudo /etc/init.d/smartdns restart", vbhide