Skip to content

写了一个win10的一键安装 #107

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

Closed
rufengsuixing opened this issue Mar 3, 2019 · 0 comments
Closed

写了一个win10的一键安装 #107

rufengsuixing opened this issue Mar 3, 2019 · 0 comments

Comments

@rufengsuixing
Copy link

rufengsuixing commented Mar 3, 2019

start https://github.com/pymumu/smartdns
echo warn非开源软件,是否要安装,需要联网安装debian,总共占用C盘空间100mb左右,输入y继续
set choose=
set /p choose=
if not "%choose%"=="y" exit /b
powershell -Command "Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux" | findstr /c:"RestartNeeded : False"
if not %errorlevel%==0 (echo 开启了windows子系统选项需要重启,重启后再点本安装选项) & exit /b
echo 请安装debian,安装好后,打开debian进行设置用户名及密码,设置结束后(出现$和闪动光标),在本脚本按任意键继续,之后会多次输入用户名密码,稍安
start ms-windows-store://pdp/?PRODUCTID=9msvkqc78pk6
pause
cd /d "c:"
wsl wget --no-check-certificate https://raw.githubusercontent.com/rufengsuixing/bit-web-login/master/setdebian.sh
wsl sudo chmod 777 setdebian.sh
wsl sudo ./setdebian.sh
cd /d "smartdns\package\windows"

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
)

copy .\wsl-run.vbs "%STARTUP_PATH%/"
IF NOT %ERRORLEVEL% == 0 (
echo Install startupt script failed.
pause
)

echo 配置文件在,C:\smartdns\etc\smartdns\smartdns.conf 可以自行修改配置文件,c:\smartdns\package\windows ,为各种工具(可删除)
mklink /d "%~dp0\smartdnsconfig" "C:\smartdns\etc\smartdns"
mklink /d "%~dp0\smartdnstools" c:\smartdns\package\windows
echo 已创造配置文件的软连接和工具到运行位置
echo 正在启动,请修改配置文件之后输入密码(默认不一定适合所有人)

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
)

wsl sudo /etc/init.d/smartdns restart
IF NOT %ERRORLEVEL% == 0 (
echo reload smartdns failed.
pause
)

echo dns设置为127.0.0.1就可以使用本软件功能,输入n手动设定,其他自动设定
set choose=
set /p choose=
if "%choose%"=="n" (echo 安装结束) & exit /b
echo 设置dns中
for /f "skip=3 tokens=3,* delims= " %%a in ('netsh interface show interface') do (echo "%%b">>shipei.txt)
for /f "tokens=* delims= " %%a in (shipei.txt)do (netsh interface ip set dns name=%%a source=static address=127.0.0.1 register=primary validate=yes)
del shipei.txt
echo 设置dns为127.0.0.1完成,安装结束
exit /B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants