Merge pull request #1125 from samdivaio/backup

Installer Optimization
This commit is contained in:
Master Kwoth 2017-03-13 20:25:18 +01:00 committed by GitHub
commit 89f1e5af45
4 changed files with 89 additions and 55 deletions

View File

@ -1,24 +1,25 @@
@ECHO off @ECHO off
TITLE Downloading Latest Build of NadekoBot... TITLE Downloading Latest Build of NadekoBot...
::Setting convenient to read variables which don't delete the windows temp folder ::Setting convenient to read variables which don't delete the windows temp folder
SET root=%~dp0 SET "root=%~dp0"
CD /D %root% CD /D "%root%"
SET rootdir=%cd% SET "rootdir=%cd%"
SET build1=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Core\ 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 "build2=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Rest\"
SET build3=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.WebSocket\ 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 "build4=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Commands\"
SET build5=%root%NadekoInstall_Temp\NadekoBot\src\NadekoBot\ SET "build5=%root%NadekoInstall_Temp\NadekoBot\src\NadekoBot\"
SET installtemp=%root%NadekoInstall_Temp\ SET "installtemp=%root%NadekoInstall_Temp\"
::Deleting traces of last setup for the sake of clean folders, if by some miracle it still exists ::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 ::Checks that both git and dotnet are installed
dotnet --version >nul 2>&1 || GOTO :dotnet dotnet --version >nul 2>&1 || GOTO :dotnet
git --version >nul 2>&1 || GOTO :git git --version >nul 2>&1 || GOTO :git
::Creates the install directory to work in and get the current directory because spaces ruins everything otherwise ::Creates the install directory to work in and get the current directory because spaces ruins everything otherwise
:start :start
MKDIR NadekoInstall_Temp MKDIR "%root%NadekoInstall_Temp"
CD /D %installtemp% CD /D "%installtemp%"
::Downloads the latest version of Nadeko ::Downloads the latest version of Nadeko
ECHO Downloading Nadeko... ECHO Downloading Nadeko...
ECHO. ECHO.
@ -28,28 +29,28 @@ TITLE Installing NadekoBot, please wait...
ECHO. ECHO.
ECHO Installing Discord.Net(1/4)... ECHO Installing Discord.Net(1/4)...
::Building Nadeko ::Building Nadeko
CD /D %build1% CD /D "%build1%"
dotnet restore >nul 2>&1 dotnet restore >nul 2>&1
ECHO Installing Discord.Net(2/4)... ECHO Installing Discord.Net(2/4)...
CD /D %build2% CD /D "%build2%"
dotnet restore >nul 2>&1 dotnet restore >nul 2>&1
ECHO Installing Discord.Net(3/4)... ECHO Installing Discord.Net(3/4)...
CD /D %build3% CD /D "%build3%"
dotnet restore >nul 2>&1 dotnet restore >nul 2>&1
ECHO Installing Discord.Net(4/4)... ECHO Installing Discord.Net(4/4)...
CD /D %build4% CD /D "%build4%"
dotnet restore >nul 2>&1 dotnet restore >nul 2>&1
ECHO. ECHO.
ECHO Discord.Net installation completed successfully... ECHO Discord.Net installation completed successfully...
ECHO. ECHO.
ECHO Installing NadekoBot... ECHO Installing NadekoBot...
CD /D %build5% CD /D "%build5%"
dotnet restore >nul 2>&1 dotnet restore >nul 2>&1
dotnet build --configuration Release >nul 2>&1 dotnet build --configuration Release >nul 2>&1
ECHO. ECHO.
ECHO NadekoBot installation completed successfully... ECHO NadekoBot installation completed successfully...
::Attempts to backup old files if they currently exist in the same folder as the batch file ::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 :freshinstall
::Moves the NadekoBot folder to keep things tidy ::Moves the NadekoBot folder to keep things tidy
ECHO. ECHO.
@ -106,7 +107,7 @@ IF EXIST "%root%NadekoBot\" (GOTO :backupinstall)
:giterror :giterror
ECHO. ECHO.
ECHO Git clone failed, trying again ECHO Git clone failed, trying again
RMDIR %installtemp% /S /Q >nul 2>&1 RMDIR "%installtemp%" /S /Q >nul 2>&1
GOTO :start GOTO :start
:copyerror :copyerror
::If at any point a copy error is encountered ::If at any point a copy error is encountered
@ -127,12 +128,28 @@ ECHO.
ECHO Your System Architecture is 32bit... ECHO Your System Architecture is 32bit...
timeout /t 5 timeout /t 5
ECHO. 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" 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%'" powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/dev/src/NadekoBot/_libs/32/libsodium.dll -OutFile '%FILENAME%'"
ECHO libsodium.dll downloaded. ECHO libsodium.dll downloaded.
ECHO. ECHO.
timeout /t 5 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" 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%'" powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/dev/src/NadekoBot/_libs/32/opus.dll -OutFile '%FILENAME%'"
ECHO opus.dll downloaded. ECHO opus.dll downloaded.

View File

@ -2,8 +2,8 @@
@TITLE NadekoBot @TITLE NadekoBot
SET root=%~dp0 SET "root=%~dp0"
CD /D %root% CD /D "%root%"
CLS CLS
ECHO Welcome to NadekoBot Auto Restart and Update! ECHO Welcome to NadekoBot Auto Restart and Update!
@ -25,28 +25,28 @@ IF ERRORLEVEL 1 GOTO latestar
:latestar :latestar
ECHO Auto Restart and Update with Dev Build (latest) ECHO Auto Restart and Update with Dev Build (latest)
ECHO Bot will auto update on every restart! ECHO Bot will auto update on every restart!
CD /D %~dp0NadekoBot\src\NadekoBot CD /D "%~dp0NadekoBot\src\NadekoBot"
dotnet run --configuration Release dotnet run --configuration Release
ECHO Updating... ECHO Updating...
SET "FILENAME=%~dp0\Latest.bat" SET "FILENAME=%~dp0\Latest.bat"
powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/master/scripts/Latest.bat -OutFile '%FILENAME%'" powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/dev/scripts/Latest.bat -OutFile '%FILENAME%'"
ECHO NadekoBot Dev Build (latest) downloaded. ECHO NadekoBot Dev Build (latest) downloaded.
SET root=%~dp0 SET "root=%~dp0"
CD /D %root% CD /D "%root%"
CALL Latest.bat CALL Latest.bat
GOTO latestar GOTO latestar
:stablear :stablear
ECHO Auto Restart and Update with Stable Build ECHO Auto Restart and Update with Stable Build
ECHO Bot will auto update on every restart! ECHO Bot will auto update on every restart!
CD /D %~dp0NadekoBot\src\NadekoBot CD /D "%~dp0NadekoBot\src\NadekoBot"
dotnet run --configuration Release dotnet run --configuration Release
ECHO Updating... ECHO Updating...
SET "FILENAME=%~dp0\Stable.bat" SET "FILENAME=%~dp0\Stable.bat"
powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/master/scripts/Stable.bat -OutFile '%FILENAME%'" powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/dev/scripts/Stable.bat -OutFile '%FILENAME%'"
ECHO NadekoBot Stable build downloaded. ECHO NadekoBot Stable build downloaded.
SET root=%~dp0 SET "root=%~dp0"
CD /D %root% CD /D "%root%"
CALL Stable.bat CALL Stable.bat
GOTO stablear GOTO stablear
@ -54,12 +54,12 @@ GOTO stablear
ECHO Normal Auto Restart ECHO Normal Auto Restart
ECHO Bot will not auto update on every restart! ECHO Bot will not auto update on every restart!
timeout /t 3 timeout /t 3
CD /D %~dp0NadekoBot\src\NadekoBot CD /D "%~dp0NadekoBot\src\NadekoBot"
dotnet run --configuration Release dotnet run --configuration Release
goto autorun goto autorun
:Exit :Exit
SET root=%~dp0 SET "root=%~dp0"
CD /D %root% CD /D "%root%"
del NadekoAutoRun.bat del NadekoAutoRun.bat
CALL NadekoInstaller.bat CALL NadekoInstaller.bat

View File

@ -1,9 +1,9 @@
@ECHO off @ECHO off
@TITLE NadekoBot @TITLE NadekoBot
CD /D %~dp0NadekoBot\src\NadekoBot CD /D "%~dp0NadekoBot\src\NadekoBot"
dotnet run --configuration Release dotnet run --configuration Release
ECHO NadekoBot has been succesfully stopped, press any key to close this window. ECHO NadekoBot has been succesfully stopped, press any key to close this window.
TITLE NadekoBot - Stopped TITLE NadekoBot - Stopped
CD /D %~dp0 CD /D "%~dp0"
PAUSE >nul 2>&1 PAUSE >nul 2>&1
del NadekoRunNormal.bat del NadekoRunNormal.bat

View File

@ -1,24 +1,25 @@
@ECHO off @ECHO off
TITLE Downloading Stable Build of NadekoBot... TITLE Downloading Stable Build of NadekoBot...
::Setting convenient to read variables which don't delete the windows temp folder ::Setting convenient to read variables which don't delete the windows temp folder
SET root=%~dp0 SET "root=%~dp0"
CD /D %root% CD /D "%root%"
SET rootdir=%cd% SET "rootdir=%cd%"
SET build1=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Core\ 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 "build2=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Rest\"
SET build3=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.WebSocket\ 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 "build4=%root%NadekoInstall_Temp\NadekoBot\Discord.Net\src\Discord.Net.Commands\"
SET build5=%root%NadekoInstall_Temp\NadekoBot\src\NadekoBot\ SET "build5=%root%NadekoInstall_Temp\NadekoBot\src\NadekoBot\"
SET installtemp=%root%NadekoInstall_Temp\ SET "installtemp=%root%NadekoInstall_Temp\"
::Deleting traces of last setup for the sake of clean folders, if by some miracle it still exists ::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 ::Checks that both git and dotnet are installed
dotnet --version >nul 2>&1 || GOTO :dotnet dotnet --version >nul 2>&1 || GOTO :dotnet
git --version >nul 2>&1 || GOTO :git git --version >nul 2>&1 || GOTO :git
::Creates the install directory to work in and get the current directory because spaces ruins everything otherwise ::Creates the install directory to work in and get the current directory because spaces ruins everything otherwise
:start :start
MKDIR NadekoInstall_Temp MKDIR "%root%NadekoInstall_Temp"
CD /D %installtemp% CD /D "%installtemp%"
::Downloads the latest version of Nadeko ::Downloads the latest version of Nadeko
ECHO Downloading Nadeko... ECHO Downloading Nadeko...
ECHO. ECHO.
@ -28,28 +29,28 @@ TITLE Installing NadekoBot, please wait...
ECHO. ECHO.
ECHO Installing Discord.Net(1/4)... ECHO Installing Discord.Net(1/4)...
::Building Nadeko ::Building Nadeko
CD /D %build1% CD /D "%build1%"
dotnet restore >nul 2>&1 dotnet restore >nul 2>&1
ECHO Installing Discord.Net(2/4)... ECHO Installing Discord.Net(2/4)...
CD /D %build2% CD /D "%build2%"
dotnet restore >nul 2>&1 dotnet restore >nul 2>&1
ECHO Installing Discord.Net(3/4)... ECHO Installing Discord.Net(3/4)...
CD /D %build3% CD /D "%build3%"
dotnet restore >nul 2>&1 dotnet restore >nul 2>&1
ECHO Installing Discord.Net(4/4)... ECHO Installing Discord.Net(4/4)...
CD /D %build4% CD /D "%build4%"
dotnet restore >nul 2>&1 dotnet restore >nul 2>&1
ECHO. ECHO.
ECHO Discord.Net installation completed successfully... ECHO Discord.Net installation completed successfully...
ECHO. ECHO.
ECHO Installing NadekoBot... ECHO Installing NadekoBot...
CD /D %build5% CD /D "%build5%"
dotnet restore >nul 2>&1 dotnet restore >nul 2>&1
dotnet build --configuration Release >nul 2>&1 dotnet build --configuration Release >nul 2>&1
ECHO. ECHO.
ECHO NadekoBot installation completed successfully... ECHO NadekoBot installation completed successfully...
::Attempts to backup old files if they currently exist in the same folder as the batch file ::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 :freshinstall
::Moves the NadekoBot folder to keep things tidy ::Moves the NadekoBot folder to keep things tidy
ECHO. ECHO.
@ -106,7 +107,7 @@ IF EXIST "%root%NadekoBot\" (GOTO :backupinstall)
:giterror :giterror
ECHO. ECHO.
ECHO Git clone failed, trying again ECHO Git clone failed, trying again
RMDIR %installtemp% /S /Q >nul 2>&1 RMDIR "%installtemp%" /S /Q >nul 2>&1
GOTO :start GOTO :start
:copyerror :copyerror
::If at any point a copy error is encountered ::If at any point a copy error is encountered
@ -127,12 +128,28 @@ ECHO.
ECHO Your System Architecture is 32bit... ECHO Your System Architecture is 32bit...
timeout /t 5 timeout /t 5
ECHO. 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" 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%'" powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/dev/src/NadekoBot/_libs/32/libsodium.dll -OutFile '%FILENAME%'"
ECHO libsodium.dll downloaded. ECHO libsodium.dll downloaded.
ECHO. ECHO.
timeout /t 5 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" 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%'" powershell -Command "Invoke-WebRequest https://github.com/Kwoth/NadekoBot/raw/dev/src/NadekoBot/_libs/32/opus.dll -OutFile '%FILENAME%'"
ECHO opus.dll downloaded. ECHO opus.dll downloaded.