139 lines
4.8 KiB
Batchfile
Raw Normal View History

@echo off
2017-03-14 15:03:30 +03:00
2018-03-20 23:25:22 +03:00
REM Copyright (c) 2013-2018, The PurpleI2P Project
2017-03-14 15:03:30 +03:00
REM This file is part of Purple i2pd project and licensed under BSD3
REM See full license text in LICENSE file at top of project tree
setlocal enableextensions
set CURL=%~dp0curl.exe
2018-03-20 23:25:22 +03:00
set FFversion=52.7.2
set I2Pdversion=2.18.0
call :GET_LOCALE
call :GET_PROXY
call :GET_ARCH
if "%locale%"=="ru" (
2017-02-15 06:27:42 +03:00
echo <20><><EFBFBD>ઠ I2Pd Browser Portable
echo <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E3A7A5>: %locale%, <20><><EFBFBD><EFBFBD><EFBFBD><E2A5AA><EFBFBD><EFBFBD>: %xOS%
2017-02-15 06:27:42 +03:00
echo.
echo <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E2A0AD><EFBFBD> Firefox Portable ESR
) else (
echo Building I2Pd Browser Portable
echo Browser locale: %locale%, architecture: %xOS%
2017-02-15 06:27:42 +03:00
echo.
echo Downloading Firefox Portable ESR installer
)
"%CURL%" -L -f -# -o firefox.exe https://ftp.mozilla.org/pub/firefox/releases/%FFversion%esr/%xOS%/%locale%/Firefox%%20Setup%%20%FFversion%esr.exe %$X%
if errorlevel 1 (
echo ERROR:%ErrorLevel%
pause
2017-02-15 06:27:42 +03:00
exit
) else (echo OK!)
echo.
if "%locale%"=="ru" (
2017-02-15 06:27:42 +03:00
echo <20><><EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E2A0AD><EFBFBD> <20><><E3A4A0><EFBFBD><EFBFBD><EFBFBD> <20><> <20><EFBFBD><E3A6AD><><E4A0A9><EFBFBD>
) else (
2017-11-17 05:45:44 +03:00
echo Unpacking the installer and deleting unnecessary files
2017-02-15 06:27:42 +03:00
)
7z x -y -o..\Firefox\App firefox.exe > nul
del /Q firefox.exe
ren ..\Firefox\App\core Firefox
del /Q ..\Firefox\App\setup.exe
rmdir /S /Q ..\Firefox\App\Firefox\dictionaries
rmdir /S /Q ..\Firefox\App\Firefox\uninstall
del /Q ..\Firefox\App\Firefox\browser\blocklist.xml
del /Q ..\Firefox\App\Firefox\browser\crashreporter-override.ini
del /Q ..\Firefox\App\Firefox\crashreporter.*
del /Q ..\Firefox\App\Firefox\maintenanceservice*.*
del /Q ..\Firefox\App\Firefox\update*.*
if "%locale%"=="ru" (
2017-02-15 06:27:42 +03:00
echo <20><EFBFBD><EFBFBD><E7A5AD> <20><><EFBFBD><EFBFBD><20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
) else (
echo Disabling crash reports
)
sed -i "s/Enabled=1/Enabled=0/g" ..\Firefox\App\Firefox\application.ini
sed -i "s/ServerURL=.*/ServerURL=-/" ..\Firefox\App\Firefox\application.ini
2018-01-23 11:50:18 +03:00
if "%locale%"=="ru" (
echo <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EBAAAE><EFBFBD> <20><><EFBFBD><EFBFBD>
) else (
echo Downloading language packs
)
"%CURL%" -L -f -# -o ..\Firefox\App\Firefox\browser\extensions\langpack-ru@firefox.mozilla.org.xpi https://addons.mozilla.org/firefox/downloads/file/605634/russian_ru_language_pack-52.0-fx.xpi?src=version-history
if errorlevel 1 ( echo ERROR:%ErrorLevel% && pause && exit ) else (echo OK!)
"%CURL%" -L -f -# -o ..\Firefox\App\Firefox\browser\extensions\langpack-en-US@firefox.mozilla.org.xpi https://addons.mozilla.org/firefox/downloads/file/605596/english_us_language_pack-52.0-fx.xpi?src=version-history
if errorlevel 1 ( echo ERROR:%ErrorLevel% && pause && exit ) else (echo OK!)
echo.
if "%locale%"=="ru" (
2017-02-15 06:27:42 +03:00
echo <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NoScript
) else (
2017-02-15 06:27:42 +03:00
echo Downloading NoScript extension
)
2018-01-23 11:50:18 +03:00
"%CURL%" -L -f -# -o ..\Firefox\App\Firefox\browser\extensions\{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi https://addons.mozilla.org/firefox/downloads/file/806790/noscript_security_suite-5.1.8.3-fx+sm.xpi
2017-02-15 06:27:42 +03:00
if errorlevel 1 ( echo ERROR:%ErrorLevel% && pause && exit ) else (echo OK!)
echo.
if "%locale%"=="ru" (
2017-02-15 06:27:42 +03:00
echo <20><><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD><><E4A0A9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> Firefox
) else (
echo Copying Firefox launcher and settings
2017-02-15 06:27:42 +03:00
)
mkdir ..\Firefox\App\DefaultData\profile\ > nul
2017-04-25 17:32:18 +03:00
mkdir ..\Firefox\App\Firefox\browser\defaults\preferences\ > nul
copy /Y profile\* ..\Firefox\App\DefaultData\profile\ > nul
copy /Y firefox-portable\* ..\Firefox\ > nul
2017-04-25 17:32:18 +03:00
copy /Y preferences\* ..\Firefox\App\Firefox\browser\defaults\preferences\ > nul
if "%locale%"=="ru" (
2017-02-15 06:27:42 +03:00
echo <20><><EFBFBD><EFBFBD><EFBFBD> I2Pd
) else (
echo Downloading I2Pd
)
2017-04-25 17:32:18 +03:00
if "xOS"=="x86" (
"%CURL%" -L -f -# -O https://github.com/PurpleI2P/i2pd/releases/download/%I2Pdversion%/i2pd_%I2Pdversion%_win32_mingw.zip
2017-02-15 06:27:42 +03:00
if errorlevel 1 ( echo ERROR:%ErrorLevel% && pause && exit ) else (echo OK!)
7z x -y -o..\i2pd i2pd_%I2Pdversion%_win32_mingw.zip i2pd.exe > nul
del /Q i2pd_%I2Pdversion%_win32_mingw.zip
) else (
"%CURL%" -L -f -# -O https://github.com/PurpleI2P/i2pd/releases/download/%I2Pdversion%/i2pd_%I2Pdversion%_win64_mingw.zip
2017-02-15 06:27:42 +03:00
if errorlevel 1 ( echo ERROR:%ErrorLevel% && pause && exit ) else (echo OK!)
7z x -y -o..\i2pd i2pd_%I2Pdversion%_win64_mingw.zip i2pd.exe > nul
del /Q i2pd_%I2Pdversion%_win64_mingw.zip
)
xcopy /E /I /Y i2pd ..\i2pd > nul
echo.
if "%locale%"=="ru" (
2017-11-17 05:45:44 +03:00
echo I2Pd Browser Portable <20><><20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!
2017-02-15 06:27:42 +03:00
) else (
2017-11-17 05:45:44 +03:00
echo I2Pd Browser Portable is ready to start!
2017-02-15 06:27:42 +03:00
)
pause
exit
:GET_LOCALE
for /f "tokens=3" %%a in ('reg query "HKEY_USERS\.DEFAULT\Keyboard Layout\Preload"^|find "REG_SZ"') do (
if %%a==00000419 (set locale=ru) else (set locale=en-US)
goto :eof
)
goto :eof
:GET_PROXY
set $X=&set $R=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings
for /F "Tokens=1,3" %%i in ('reg query "%$R%"^|find "Proxy"') do set %%i=%%j
if %ProxyEnable%==0x1 set $X=-x %ProxyServer%
goto :eof
:GET_ARCH
set xOS=win32
2018-03-20 23:25:22 +03:00
if defined PROCESSOR_ARCHITEW6432 (set xOS=x64) else if "%PROCESSOR_ARCHITECTURE%" neq "x86" (set xOS=win64)
goto :eof
:eof