i2pdbrowser-github/linux/build/build.sh

103 lines
3.2 KiB
Bash
Raw Normal View History

2016-12-19 01:36:27 +00:00
#!/bin/sh
2017-01-22 12:14:13 +00:00
# Copyright (c) 2013-2017, The PurpleI2P Project
#
2017-10-19 00:28:51 +00:00
# This file is part of Purple I2P project and licensed under BSD3
2017-01-22 12:14:13 +00:00
#
# See full license text in LICENSE file at top of project tree
2016-12-19 01:36:27 +00:00
arch=$(uname -m)
language=$(echo $LANG | cut -c-5 | sed s/_/-/g)
version="52.6.0esr"
2016-12-19 01:36:27 +00:00
application="firefox"
2017-03-23 13:34:35 +00:00
ftpmirror="https://ftp.mozilla.org/pub/$application/releases/$version"
2016-12-19 01:36:27 +00:00
2017-02-26 18:49:43 +00:00
curlfind=$(which curl)
2017-02-15 17:17:48 +00:00
if [ -z $curlfind ]; then
2017-11-17 02:45:44 +00:00
echo "'cURL' does not seem to be installed. The script needs it!";
2017-02-15 17:17:48 +00:00
exit 1;
fi
2017-11-17 02:45:44 +00:00
echo "This script is preparing $application $version for use with I2Pd"
2016-12-19 01:36:27 +00:00
file="$application-$version.tar.bz2"
2017-03-23 13:34:35 +00:00
filepath="linux-$arch/$language/$file"
2016-12-19 01:36:27 +00:00
echo "Downloading $application..."
2017-03-23 13:34:35 +00:00
curl -L -f -# -O $ftpmirror/$filepath
2016-12-19 01:36:27 +00:00
if [ $? -ne 0 ]; then # Not found error, trying to cut language variable
2017-11-17 02:45:44 +00:00
echo "[TRY 2] I'll try downloading Firefox with shorter language code";
2016-12-19 01:36:27 +00:00
language=$(echo $language | cut -c-2)
# re-create variable with cutted lang
2017-03-23 13:34:35 +00:00
filepath="linux-$arch/$language/$file"
curl -L -f -# -O $ftpmirror/$filepath
if [ $? -ne 0 ]; then # Not found error, trying to download english version
2017-11-17 02:45:44 +00:00
echo "[TRY 3] I'll try downloading Firefox with the English language code";
2017-03-14 12:03:30 +00:00
language="en_US"
# re-create lang variable
2017-03-23 13:34:35 +00:00
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
2017-02-26 18:49:43 +00:00
fi
2017-03-23 13:34:35 +00:00
2016-12-19 01:36:27 +00:00
if [ ! -f $file ]; then
2017-11-17 02:45:44 +00:00
echo "[Error] Can't find downloaded file. Does it really exist?"
2017-03-23 13:34:35 +00:00
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!"
2016-12-19 01:36:27 +00:00
exit 1;
2017-03-23 13:34:35 +00:00
else
echo "Checksum correct."
rm SHA512SUMS
2016-12-19 01:36:27 +00:00
fi
2017-02-26 18:49:43 +00:00
2016-12-19 01:36:27 +00:00
echo "Extracting archive, please wait..."
tar xfj $file
rm $file
2017-02-07 13:32:31 +00:00
mv $application ../app
mkdir ../data
2016-12-19 01:36:27 +00:00
# Deleting some not needed files
2017-02-07 13:32:31 +00:00
rm ../app/crashreporter*
rm ../app/removed-files
rm ../app/run-mozilla.sh
rm ../app/update*
rm ../app/browser/blocklist.xml
rm -r ../app/dictionaries
# And edit some places
2017-02-07 13:32:31 +00:00
sed -i 's/Enabled=1/Enabled=0/g' ../app/application.ini
sed -i 's/ServerURL=.*/ServerURL=-/' ../app/application.ini
2017-04-25 14:32:18 +00:00
# sed -i 's/Enabled=1/Enabled=0/g' ../app/webapprt/webapprt.ini
# sed -i 's/ServerURL=.*/ServerURL=-/' ../app/webapprt/webapprt.ini
# Done!
2016-12-19 01:36:27 +00:00
echo "Downloading NoScript extension..."
2017-12-09 14:47:07 +00:00
curl -L -f -# -O https://secure.informaction.com/download/releases/noscript-5.1.8.2.xpi
mv noscript-5.1.8.2.xpi ../app/browser/extensions/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi
2016-12-19 01:36:27 +00:00
2017-11-17 02:45:44 +00:00
echo "Adding standard configs..."
2017-04-25 16:05:34 +00:00
cp profile/* ../data/
mkdir -p ../app/browser/defaults
2017-04-25 16:14:08 +00:00
cp -r preferences ../app/browser/defaults/
2016-12-19 01:36:27 +00:00
2017-02-07 13:32:31 +00:00
echo '#!/bin/sh' > "../${application}-portable"
echo 'dir=${0%/*}' >> "../${application}-portable"
echo 'if [ "$dir" = "$0" ]; then' >> "../${application}-portable"
echo ' dir="."' >> "../${application}-portable"
echo 'fi' >> "../${application}-portable"
echo 'cd "$dir/app"' >> "../${application}-portable"
echo './firefox -profile ../data -no-remote' >> "../${application}-portable"
2016-12-19 01:36:27 +00:00
2017-02-07 13:32:31 +00:00
chmod +x "../$application-portable"
2016-12-19 01:36:27 +00:00
echo ... finished