i2pdbrowser-github/linux/i2pdbrowserportable.sh

72 lines
2.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
#
# This file is part of Purple i2pd project and licensed under BSD3
#
# 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="45.6.0esr"
2016-12-19 01:36:27 +00:00
application="firefox"
echo "This script prepearing $application $version for use with I2Pd"
file="$application-$version.tar.bz2"
url="https://ftp.mozilla.org/pub/$application/releases/$version/linux-$arch/$language/$file"
2016-12-19 01:36:27 +00:00
2016-12-20 16:53:35 +00:00
dir="$application-portable"
2016-12-19 01:36:27 +00:00
mkdir "$dir"
cd "$dir"
echo "Downloading $application..."
wget -q $url
if [ $? -ne 0 ]; then # Not found error, trying to cut language variable
language=$(echo $language | cut -c-2)
# re-create variable with cutted lang
url="https://ftp.mozilla.org/pub/$application/releases/$version/linux-$arch/$language/$file"
2016-12-19 01:36:27 +00:00
wget -q $url
fi
if [ ! -f $file ]; then
echo "Can't find downloaded file. Does FireFox support your system language?"
exit 1;
fi
echo "Extracting archive, please wait..."
tar xfj $file
rm $file
mv $application app
mkdir data
# Deleting some not needed files
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
sed -i 's/Enabled=1/Enabled=0/g' app/application.ini
sed -i 's/ServerURL=.*/ServerURL=-/' app/application.ini
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..."
wget -q https://addons.mozilla.org/firefox/downloads/latest/noscript/addon-722-latest.xpi?src=search -O app/browser/extensions/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi
echo "Adding standart configs..."
2016-12-20 16:53:35 +00:00
mv ../configs/* data/
rm -rf ../configs
2016-12-19 01:36:27 +00:00
echo '#!/bin/sh' > "${application}-portable"
echo 'dir=${0%/*}' >> "${application}-portable"
echo 'if [ "$dir" = "$0" ]; then' >> "${application}-portable"
2017-01-29 22:43:25 +00:00
echo ' dir="."' >> "${application}-portable"
2016-12-19 01:36:27 +00:00
echo 'fi' >> "${application}-portable"
echo 'cd "$dir/app"' >> "${application}-portable"
2017-01-29 22:43:25 +00:00
echo './firefox -profile ../data -no-remote' >> "${application}-portable"
2016-12-19 01:36:27 +00:00
chmod +x "$application-portable"
echo ... finished
2016-12-20 16:53:35 +00:00
rm ../$0