Add 'plugmein.bat'

This commit is contained in:
lnkr 2022-05-06 17:05:35 +03:00
parent 0d31f5113b
commit 8e4ce618b5

68
plugmein.bat Normal file
View file

@ -0,0 +1,68 @@
echo OFF
::working folder name (would be created if not exist)
set fld=plugmein
::generate new config every launch or reuse the same one (0 or 1, 0=reuse)
set gen=0
color 0C
NET SESSION >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
echo administrator priveleges: OK
) ELSE (
echo ####### ERROR: ADMINISTRATOR PRIVILEGES REQUIRED #########
echo This script must be run as administrator to work properly!
echo If you're seeing this after clicking on a start menu icon, then right click on the shortcut and select "Run As Administrator".
echo ##########################################################
PAUSE
EXIT /B 1
)
pushd %~dp0
if not exist %fld% mkdir %fld%
IF EXIST %fld%\yggdrasil.exe (
echo yggdrasil: OK
) ELSE (
echo yggdrasil: not found, downloading...
start /wait bitsadmin /transfer yggdrasil /download /priority FOREGROUND "https://github.com/popura-network/Popura/releases/download/v0.4.3+auto1/yggdrasil-0.4.3+auto1-windows-amd64.exe" "%CD%\%fld%\yggdrasil.exe"
)
IF EXIST %fld%\wintun.dll (
echo wintun: OK
) ELSE (
echo wintun: not found, downloading...
start /wait bitsadmin /transfer wintun /download /priority FOREGROUND "https://www.wintun.net/builds/wintun-0.14.1.zip" "%CD%\%fld%\wintun.zip"
tar.exe -xf %fld%\wintun.zip
MOVE wintun\bin\amd64\wintun.dll %fld%\wintun.dll
del %fld%\wintun.zip
rmdir /s /q wintun
)
IF "%gen%"=="0" (
IF EXIST %fld%\yggdrasil.conf (
echo yggdrasil config: OK
) ELSE (
echo yggdrasil config: not found, generating new config...
%fld%\yggdrasil.exe -genconf > %fld%\yggdrasil.conf
)
) ELSE (
echo yggdrasil config: generating new config[forced]...
%fld%\yggdrasil.exe -genconf > %fld%\yggdrasil.conf
)
%fld%\yggdrasil.exe -useconffile %fld%\yggdrasil.conf -address > %fld%\address.txt
::start notepad.exe address.txt
set /p address=< %fld%\address.txt
echo %address%| clip
echo NOW RUNNING. YOUR ADDRESS IS: %address% (copied to the clipboard)
echo Close the window to disconnect.
echo ##########################################################
color 0A
call %fld%\yggdrasil.exe -useconffile %fld%\yggdrasil.conf -autopeer