i2pd browser bundle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

124 lines
4.2 KiB

#!/bin/sh
# Copyright (c) 2013-2022, The PurpleI2P Project
# This file is part of Purple I2P project and licensed under BSD3
# See full license text in LICENSE file at top of project tree
dir=${0%/*}
if [ "$dir" = "$0" ]; then
dir="."
fi
cd $dir
arch=$(uname -m)
language=$(echo $LANG | cut -c-5 | sed s/_/-/g)
version="102.3.0esr"
application="firefox"
ftpmirror="https://ftp.mozilla.org/pub/$application/releases/$version"
if [ "$arch" = "amd64" ]; then # OpenBSD (and maybe FreeBSD) returns amd64 as architecture instead x86_64
arch=x86_64
fi
curlfind=$(which curl)
if [ -z $curlfind ]; then
echo "'cURL' does not seem to be installed. The script needs it!"
exit 1
fi
# We support only English (US) and Russian
if [ "$language" != "ru" ]; then
language="en-US"
fi
echo "This script is preparing $application $version for use with I2Pd"
file="$application-$version.tar.bz2"
filepath="linux-$arch/$language/$file"
echo "Downloading $application..."
curl -L -f -# -O $ftpmirror/$filepath
if [ $? -ne 0 ]; then # Not found error, trying to cut language variable
echo "[TRY 2] I'll try downloading Firefox with shorter language code"
language=$(echo $language | cut -c-2)
# re-create variable with cutted lang
filepath="linux-$arch/$language/$file"
curl -L -f -# -O $ftpmirror/$filepath
if [ $? -ne 0 ]; then # Not found error, trying to download english version
echo "[TRY 3] I'll try downloading Firefox with the English language code"
language="en_US"
# re-create lang variable
filepath="linux-$arch/$language/$file"
curl -L -f -# -O $ftpmirror/$filepath
if [ $? -ne 0 ]; then # After that i can say only that user haven't internet connection
echo "[Error] Can't download file. Check your internet connectivity."
exit 1
fi
fi
fi
if [ ! -f $file ]; then
echo "[Error] Can't find downloaded file. Does it really exist?"
exit 1
fi
echo "Downloading checksum file and checking SHA512 checksum"
curl -L -f -# -O $ftpmirror/SHA512SUMS
recv_sum=$(grep "$filepath" SHA512SUMS | cut -c-128)
file_sum=$(sha512sum $file | cut -c-128)
if [ $recv_sum != $file_sum ]; then
echo "[Error] File checksum failed!"
exit 1
else
echo "Checksum correct."
rm SHA512SUMS
fi
echo "Extracting archive, please wait..."
tar xfj $file
rm $file
mv $application ../browser
mkdir ../browser/data
# Deleting some not needed files
rm ../browser/crashreporter*
rm ../browser/minidump-analyzer
rm ../browser/pingsender
rm ../browser/precomplete
rm ../browser/removed-files
rm ../browser/update*
rm ../browser/Throbber-small.gif
rm ../browser/browser/crashreporter-override.ini
rm ../browser/browser/features/formautofill@mozilla.org.xpi
rm ../browser/browser/features/screenshots@mozilla.org.xpi
rm -r ../browser/icons
# And edit some places
sed -i 's/Enabled=1/Enabled=0/g' ../browser/application.ini
sed -i 's/ServerURL=.*/ServerURL=-/' ../browser/application.ini
# Done!
echo "Downloading language packs..."
mkdir ../browser/browser/extensions
curl -L -f -# -o ../browser/browser/extensions/langpack-ru@firefox.mozilla.org.xpi https://addons.mozilla.org/firefox/downloads/file/3971589/russian_ru_language_pack-102.0.1buildid20220705.093820.xpi
curl -L -f -# -o ../browser/browser/extensions/ruspell-wiktionary@addons.mozilla.org.xpi https://addons.mozilla.org/firefox/downloads/file/3997957/2696307-1.41.xpi
curl -L -f -# -o ../browser/browser/extensions/langpack-en-US@firefox.mozilla.org.xpi https://addons.mozilla.org/firefox/downloads/file/3971625/english_us_language_pack-102.0.1buildid20220705.093820.xpi
curl -L -f -# -o ../browser/browser/extensions/en-US@dictionaries.addons.mozilla.org.xpi https://addons.mozilla.org/firefox/downloads/file/3893473/us_english_dictionary-91.0.xpi
echo "Downloading NoScript extension..."
curl -L -f -# -o ../browser/browser/extensions/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi https://addons.mozilla.org/firefox/downloads/file/4002416/noscript-11.4.11.xpi
echo "Adding standard configs..."
cp -r preferences/* ../browser/
cp -r profile/* ../browser/data/
if [ "$language" = "ru" ]; then
cp -r profile-ru/* ../browser/data/
else
cp -r profile-en/* ../browser/data/
fi
echo "Copying Desktop launch scripts..."
cp -r scripts/* ../browser/
cp scripts/start-i2pd-browser.desktop ../
echo ... finished