Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在 wsl 中使用指定的 Linux 发行版. #335

Closed
wants to merge 10 commits into from
11 changes: 9 additions & 2 deletions package/windows/install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ 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 -d ubuntu sudo %DIR_IN_WSL%/../../install -i
bash ./init.sh
IF %ERRORLEVEL% == 0 (
wsl sudo %DIR_IN_WSL%/../../install -i
)^
ELSE (
wsl -d ubuntu sudo %DIR_IN_WSL%/../../install -i
)
IF NOT %ERRORLEVEL% == 0 (
echo Install smartdns failed.
pause
exit 1
)

md "%programdata%\smartdns\"
copy %CURR_PATH%\init.sh "%programdata%\smartdns\"
peaceshi marked this conversation as resolved.
Show resolved Hide resolved
copy %CURR_PATH%\wsl-run.vbs "%STARTUP_PATH%/"
IF NOT %ERRORLEVEL% == 0 (
echo Install startupt script failed.
Expand Down
16 changes: 8 additions & 8 deletions package/windows/reload.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ 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 -d ubuntu sudo cp -avf %DIR_IN_WSL%/../../etc/smartdns/* /etc/smartdns/
IF NOT %ERRORLEVEL% == 0 (
echo copy smartdns configuration file failed.
pause
exit 1
bash ./init.sh
IF %ERRORLEVEL% == 0 (
wsl sudo cp -avf %DIR_IN_WSL%/../../etc/smartdns/* /etc/smartdns/
wsl sudo /etc/init.d/smartdns restart
)^
ELSE (
wsl -d ubuntu sudo cp -avf %DIR_IN_WSL%/../../etc/smartdns/* /etc/smartdns/
wsl -d ubuntu sudo /etc/init.d/smartdns restart
)


wsl -d ubuntu sudo /etc/init.d/smartdns restart
IF NOT %ERRORLEVEL% == 0 (
echo reload smartdns failed.
pause
Expand Down
9 changes: 8 additions & 1 deletion package/windows/uninstall.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ 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 -d ubuntu sudo %DIR_IN_WSL%/../../install -u
bash ./init.sh
IF %ERRORLEVEL% == 0 (
wsl sudo %DIR_IN_WSL%/../../install -u
)^
ELSE (
wsl -d ubuntu sudo %DIR_IN_WSL%/../../install -u
)
IF NOT %ERRORLEVEL% == 0 (
echo Uninstall smartdns failed.
pause
exit 1
)

del "%STARTUP_PATH%\wsl-run.vbs"
del "%programdata%\smartdns\init.sh"
IF NOT %ERRORLEVEL% == 0 (
echo Uninstall startup script failed.
pause
Expand Down