mirror of
https://github.com/oooo-ps/i2pdbrowser.git
synced 2026-04-01 06:05:27 +00:00
104 lines
3.1 KiB
Bash
Executable file
104 lines
3.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# Copyright (c) 2013-2024, 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
|
|
|
|
# modified by @ps in 2026 just for privacy-oriented web-browsing.
|
|
|
|
dir=${0%/*}
|
|
if [ "$dir" = "$0" ]; then
|
|
dir="."
|
|
fi
|
|
cd $dir
|
|
|
|
arch=$(uname -m)
|
|
language=$(echo $LANG | cut -c-5 | sed s/_/-/g)
|
|
version="115.20.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
|
|
|
|
if [ "$language" != "en-US" ]; then
|
|
language="en-US"
|
|
fi
|
|
|
|
echo "This script is preparing $application $version using modified i2pdbrowser preset for privacy-oriented web-browsing"
|
|
|
|
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 "Verifying expected SHA512 checksum"
|
|
expect_sum=d13629789387670af9c042df06f4cfc0bf9174345e89408a02439dfdf7561c6b60cbdcda0a71c4ec7d2c7a8a189c3dec4e7c33775c684f027d592922ed81a055
|
|
target_sum=$(sha512sum $file | cut -c-128)
|
|
if [ $expect_sum != $target_sum ]; then
|
|
echo "[Error] File checksum failed!"
|
|
echo "current: $target_sum"
|
|
echo "expected: $expect_sum"
|
|
exit 1
|
|
else
|
|
echo "Checksum $file correct."
|
|
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 "Adding standard configs..."
|
|
cp -r preferences/* ../browser/
|
|
|
|
echo ... finished
|