From 731330467b83dc166445ae2cd7d0631a1c7f6834 Mon Sep 17 00:00:00 2001 From: samvaio Date: Mon, 13 Mar 2017 10:45:51 +0530 Subject: [PATCH] better installation for 32bit users --- scripts/Latest.bat | 57 +++++++++++++++++++++++++-------------- scripts/NadekoAutoRun.bat | 22 +++++++-------- scripts/NadekoRun.bat | 4 +-- scripts/Stable.bat | 57 +++++++++++++++++++++++++-------------- 4 files changed, 87 insertions(+), 53 deletions(-) diff --git a/scripts/Latest.bat b/scripts/Latest.bat index 6460a618..13248a96 100644 --- a/scripts/Latest.bat +++ b/scripts/Latest.bat @@ -1,24 +1,25 @@ @ECHO off TITLE Downloading Latest Build of NadekoBot... ::Setting convenient to read variables which don't delete the windows temp folder -SET root=%~dp0 -CD /D %root% -SET rootdir=%cd% -SET build1=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Core\ -SET build2=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Rest\ -SET build3=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.WebSocket\ -SET build4=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Commands\ -SET build5=%root%NadekoInstall_Temp\NadekoBot\src\NadekoBot\ -SET installtemp=%root%NadekoInstall_Temp\ +SET "root=%~dp0" +CD /D "%root%" +SET "rootdir=%cd%" +SET "build1=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Core\" +SET "build2=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Rest\" +SET "build3=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.WebSocket\" +SET "build4=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Commands\" +SET "build5=%root%NadekoInstall_Temp\NadekoBot\src\NadekoBot\" +SET "installtemp=%root%NadekoInstall_Temp\" ::Deleting traces of last setup for the sake of clean folders, if by some miracle it still exists -IF EXIST %installtemp% ( RMDIR %installtemp% /S /Q >nul 2>&1) +IF EXIST "%installtemp%" ( RMDIR "%installtemp%" /S /Q >nul 2>&1) +timeout /t 5 ::Checks that both git and dotnet are installed dotnet --version >nul 2>&1 || GOTO :dotnet git --version >nul 2>&1 || GOTO :git ::Creates the install directory to work in and get the current directory because spaces ruins everything otherwise :start -MKDIR NadekoInstall_Temp -CD /D %installtemp% +MKDIR "%root%NadekoInstall_Temp" +CD /D "%installtemp%" ::Downloads the latest version of Nadeko ECHO Downloading Nadeko... ECHO. @@ -28,28 +29,28 @@ TITLE Installing NadekoBot, please wait... ECHO. ECHO Installing Discord.Net(1/4)... ::Building Nadeko -CD /D %build1% +CD /D "%build1%" dotnet restore >nul 2>&1 ECHO Installing Discord.Net(2/4)... -CD /D %build2% +CD /D "%build2%" dotnet restore >nul 2>&1 ECHO Installing Discord.Net(3/4)... -CD /D %build3% +CD /D "%build3%" dotnet restore >nul 2>&1 ECHO Installing Discord.Net(4/4)... -CD /D %build4% +CD /D "%build4%" dotnet restore >nul 2>&1 ECHO. ECHO Discord.Net installation completed successfully... ECHO. ECHO Installing NadekoBot... -CD /D %build5% +CD /D "%build5%" dotnet restore >nul 2>&1 dotnet build --configuration Release >nul 2>&1 ECHO. ECHO NadekoBot installation completed successfully... ::Attempts to backup old files if they currently exist in the same folder as the batch file -IF EXIST "%root%NadekoBot\" (GOTO :backupinstall) +IF EXIST "%root%NadekoBot\" (GOTO :backupinstall) ELSE (GOTO :freshinstall) :freshinstall ::Moves the NadekoBot folder to keep things tidy ECHO. @@ -106,7 +107,7 @@ IF EXIST "%root%NadekoBot\" (GOTO :backupinstall) :giterror ECHO. ECHO Git clone failed, trying again - RMDIR %installtemp% /S /Q >nul 2>&1 + RMDIR "%installtemp%" /S /Q >nul 2>&1 GOTO :start :copyerror ::If at any point a copy error is encountered @@ -127,12 +128,28 @@ ECHO. ECHO Your System Architecture is 32bit... timeout /t 5 ECHO. -ECHO Downloading libsodium.dll and opus.dll... +ECHO Getting 32bit libsodium.dll and opus.dll... +IF EXIST "%root%NadekoBot\src\NadekoBot\_libs\32\libsodium.dll" (GOTO copysodium) ELSE (GOTO downloadsodium) +:copysodium +del "%root%NadekoBot\src\NadekoBot\libsodium.dll" +copy "%root%NadekoBot\src\NadekoBot\_libs\32\libsodium.dll" "%root%NadekoBot\src\NadekoBot\libsodium.dll" +ECHO libsodium.dll copied. +ECHO. +timeout /t 5 +IF EXIST "%root%NadekoBot\src\NadekoBot\_libs\32\opus.dll" (GOTO copyopus) ELSE (GOTO downloadopus) +:downloadsodium SET "FILENAME=%~dp0\NadekoBot\src\NadekoBot\libsodium.dll" powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/dev/src/NadekoBot/_libs/32/libsodium.dll -OutFile '%FILENAME%'" ECHO libsodium.dll downloaded. ECHO. timeout /t 5 +IF EXIST "%root%NadekoBot\src\NadekoBot\_libs\32\opus.dll" (GOTO copyopus) ELSE (GOTO downloadopus) +:copyopus +del "%root%NadekoBot\src\NadekoBot\opus.dll" +copy "%root%NadekoBot\src\NadekoBot\_libs\32\opus.dll" "%root%NadekoBot\src\NadekoBot\opus.dll" +ECHO opus.dll copied. +GOTO end +:downloadopus SET "FILENAME=%~dp0\NadekoBot\src\NadekoBot\opus.dll" powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/dev/src/NadekoBot/_libs/32/opus.dll -OutFile '%FILENAME%'" ECHO opus.dll downloaded. diff --git a/scripts/NadekoAutoRun.bat b/scripts/NadekoAutoRun.bat index 69060962..4441e25b 100644 --- a/scripts/NadekoAutoRun.bat +++ b/scripts/NadekoAutoRun.bat @@ -2,8 +2,8 @@ @TITLE NadekoBot -SET root=%~dp0 -CD /D %root% +SET "root=%~dp0" +CD /D "%root%" CLS ECHO Welcome to NadekoBot Auto Restart and Update! @@ -25,28 +25,28 @@ IF ERRORLEVEL 1 GOTO latestar :latestar ECHO Auto Restart and Update with Dev Build (latest) ECHO Bot will auto update on every restart! -CD /D %~dp0NadekoBot\src\NadekoBot +CD /D "%~dp0NadekoBot\src\NadekoBot" dotnet run --configuration Release ECHO Updating... SET "FILENAME=%~dp0\Latest.bat" powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/dev/scripts/Latest.bat -OutFile '%FILENAME%'" ECHO NadekoBot Dev Build (latest) downloaded. -SET root=%~dp0 -CD /D %root% +SET "root=%~dp0" +CD /D "%root%" CALL Latest.bat GOTO latestar :stablear ECHO Auto Restart and Update with Stable Build ECHO Bot will auto update on every restart! -CD /D %~dp0NadekoBot\src\NadekoBot +CD /D "%~dp0NadekoBot\src\NadekoBot" dotnet run --configuration Release ECHO Updating... SET "FILENAME=%~dp0\Stable.bat" powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/dev/scripts/Stable.bat -OutFile '%FILENAME%'" ECHO NadekoBot Stable build downloaded. -SET root=%~dp0 -CD /D %root% +SET "root=%~dp0" +CD /D "%root%" CALL Stable.bat GOTO stablear @@ -54,12 +54,12 @@ GOTO stablear ECHO Normal Auto Restart ECHO Bot will not auto update on every restart! timeout /t 3 -CD /D %~dp0NadekoBot\src\NadekoBot +CD /D "%~dp0NadekoBot\src\NadekoBot" dotnet run --configuration Release goto autorun :Exit -SET root=%~dp0 -CD /D %root% +SET "root=%~dp0" +CD /D "%root%" del NadekoAutoRun.bat CALL NadekoInstaller.bat diff --git a/scripts/NadekoRun.bat b/scripts/NadekoRun.bat index 207fb278..73c66b17 100644 --- a/scripts/NadekoRun.bat +++ b/scripts/NadekoRun.bat @@ -1,9 +1,9 @@ @ECHO off @TITLE NadekoBot -CD /D %~dp0NadekoBot\src\NadekoBot +CD /D "%~dp0NadekoBot\src\NadekoBot" dotnet run --configuration Release ECHO NadekoBot has been succesfully stopped, press any key to close this window. TITLE NadekoBot - Stopped -CD /D %~dp0 +CD /D "%~dp0" PAUSE >nul 2>&1 del NadekoRunNormal.bat diff --git a/scripts/Stable.bat b/scripts/Stable.bat index b2f6a9eb..a3ffb6f4 100644 --- a/scripts/Stable.bat +++ b/scripts/Stable.bat @@ -1,24 +1,25 @@ @ECHO off TITLE Downloading Stable Build of NadekoBot... ::Setting convenient to read variables which don't delete the windows temp folder -SET root=%~dp0 -CD /D %root% -SET rootdir=%cd% -SET build1=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Core\ -SET build2=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Rest\ -SET build3=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.WebSocket\ -SET build4=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Commands\ -SET build5=%root%NadekoInstall_Temp\NadekoBot\src\NadekoBot\ -SET installtemp=%root%NadekoInstall_Temp\ +SET "root=%~dp0" +CD /D "%root%" +SET "rootdir=%cd%" +SET "build1=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Core\" +SET "build2=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Rest\" +SET "build3=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.WebSocket\" +SET "build4=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Commands\" +SET "build5=%root%NadekoInstall_Temp\NadekoBot\src\NadekoBot\" +SET "installtemp=%root%NadekoInstall_Temp\" ::Deleting traces of last setup for the sake of clean folders, if by some miracle it still exists -IF EXIST %installtemp% ( RMDIR %installtemp% /S /Q >nul 2>&1) +IF EXIST "%installtemp%" ( RMDIR "%installtemp%" /S /Q >nul 2>&1) +timeout /t 5 ::Checks that both git and dotnet are installed dotnet --version >nul 2>&1 || GOTO :dotnet git --version >nul 2>&1 || GOTO :git ::Creates the install directory to work in and get the current directory because spaces ruins everything otherwise :start -MKDIR NadekoInstall_Temp -CD /D %installtemp% +MKDIR "%root%NadekoInstall_Temp" +CD /D "%installtemp%" ::Downloads the latest version of Nadeko ECHO Downloading Nadeko... ECHO. @@ -28,28 +29,28 @@ TITLE Installing NadekoBot, please wait... ECHO. ECHO Installing Discord.Net(1/4)... ::Building Nadeko -CD /D %build1% +CD /D "%build1%" dotnet restore >nul 2>&1 ECHO Installing Discord.Net(2/4)... -CD /D %build2% +CD /D "%build2%" dotnet restore >nul 2>&1 ECHO Installing Discord.Net(3/4)... -CD /D %build3% +CD /D "%build3%" dotnet restore >nul 2>&1 ECHO Installing Discord.Net(4/4)... -CD /D %build4% +CD /D "%build4%" dotnet restore >nul 2>&1 ECHO. ECHO Discord.Net installation completed successfully... ECHO. ECHO Installing NadekoBot... -CD /D %build5% +CD /D "%build5%" dotnet restore >nul 2>&1 dotnet build --configuration Release >nul 2>&1 ECHO. ECHO NadekoBot installation completed successfully... ::Attempts to backup old files if they currently exist in the same folder as the batch file -IF EXIST "%root%NadekoBot\" (GOTO :backupinstall) +IF EXIST "%root%NadekoBot\" (GOTO :backupinstall) ELSE (GOTO :freshinstall) :freshinstall ::Moves the NadekoBot folder to keep things tidy ECHO. @@ -106,7 +107,7 @@ IF EXIST "%root%NadekoBot\" (GOTO :backupinstall) :giterror ECHO. ECHO Git clone failed, trying again - RMDIR %installtemp% /S /Q >nul 2>&1 + RMDIR "%installtemp%" /S /Q >nul 2>&1 GOTO :start :copyerror ::If at any point a copy error is encountered @@ -127,12 +128,28 @@ ECHO. ECHO Your System Architecture is 32bit... timeout /t 5 ECHO. -ECHO Downloading libsodium.dll and opus.dll... +ECHO Getting 32bit libsodium.dll and opus.dll... +IF EXIST "%root%NadekoBot\src\NadekoBot\_libs\32\libsodium.dll" (GOTO copysodium) ELSE (GOTO downloadsodium) +:copysodium +del "%root%NadekoBot\src\NadekoBot\libsodium.dll" +copy "%root%NadekoBot\src\NadekoBot\_libs\32\libsodium.dll" "%root%NadekoBot\src\NadekoBot\libsodium.dll" +ECHO libsodium.dll copied. +ECHO. +timeout /t 5 +IF EXIST "%root%NadekoBot\src\NadekoBot\_libs\32\opus.dll" (GOTO copyopus) ELSE (GOTO downloadopus) +:downloadsodium SET "FILENAME=%~dp0\NadekoBot\src\NadekoBot\libsodium.dll" powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/dev/src/NadekoBot/_libs/32/libsodium.dll -OutFile '%FILENAME%'" ECHO libsodium.dll downloaded. ECHO. timeout /t 5 +IF EXIST "%root%NadekoBot\src\NadekoBot\_libs\32\opus.dll" (GOTO copyopus) ELSE (GOTO downloadopus) +:copyopus +del "%root%NadekoBot\src\NadekoBot\opus.dll" +copy "%root%NadekoBot\src\NadekoBot\_libs\32\opus.dll" "%root%NadekoBot\src\NadekoBot\opus.dll" +ECHO opus.dll copied. +GOTO end +:downloadopus SET "FILENAME=%~dp0\NadekoBot\src\NadekoBot\opus.dll" powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/dev/src/NadekoBot/_libs/32/opus.dll -OutFile '%FILENAME%'" ECHO opus.dll downloaded.