272 lines
12 KiB
Bash
272 lines
12 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Copyright (C) 2008-2018 Ruben Rodriguez <ruben@trisquel.info>
|
|
# Copyright (C) 2015 Santiago Rodriguez <santi@trisquel.info>
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
#
|
|
|
|
VERSION=59
|
|
|
|
. ./config
|
|
|
|
|
|
rm debian/control
|
|
|
|
# Disable activity-stream antifeatures.
|
|
# These are not condensed into a single sed script to make it fail on individual commands that didn't change the source
|
|
sed '/^const DEFAULT_SITES/,/^])\;/c const DEFAULT_SITES = new Map\([[""]]\);' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed '/\["showSponsored/,/value/s/value: true/value: false/' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed '/\["disableSnippets/,/value/s/value: false/value: true/' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed '/\["telemetry"/,/value/s/value: true/value: false/' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed '/\["section.highlights.includePocket"/,/value/s/value: true/value: false/' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed '/\["telemetry.ping.endpoint"/,/value/s/value: .*/value: ""/' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed '/\["tippyTop.service.endpoint"/,/value/s/value: .*/value: ""/' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed 's/\(read_more_endpoint:\) .http.*/\1 "",/' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed 's/\(stories_endpoint:\) .http.*/\1 "",/' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed 's/\(stories_referrer:\) .http.*/\1 "",/' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed 's/\(topics_endpoint:\) .http.*/\1 "",/' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed '/name: "snippets"/,/value/s/value: true/value: false/' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed '/name: "telemetry"/,/value/s/value: true/value: false/' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed '/name: "section.topstories"/,/return/s/return.*/return false;/' -i browser/extensions/activity-stream/lib/ActivityStream.jsm
|
|
sed 's/.Ubuntu., //' -i ./browser/extensions/activity-stream/css/activity-stream*.css
|
|
|
|
cp $DATA/onboarding/bootstrap.js browser/extensions/onboarding
|
|
cp $DATA/onboarding/onboarding.js browser/extensions/onboarding/content
|
|
cp $DATA/onboarding/onboarding.properties browser/extensions/onboarding/locales/en-US
|
|
for locale in $(ls -1 $DATA/onboarding/locales/); do
|
|
cp $DATA/onboarding/locales/$locale/onboarding.properties l10n/$locale/browser/extensions/onboarding
|
|
done
|
|
|
|
sed '/captivedetect.canonicalURL/s/http.*success.txt//' -i modules/libpref/init/all.js
|
|
|
|
# do not alter useragent/platform/oscpu/etc with fingerprinting countermeasure, it makes things worse
|
|
sed '/ShouldResistFingerprinting/,/}/s/^/\/\//' -i ./netwerk/protocol/http/nsHttpHandler.cpp
|
|
sed '/If fingerprinting resistance is on/,/}/s/^/\/\//' -i ./dom/base/Navigator.cpp
|
|
|
|
# Replace ubufox recommendation
|
|
sed 's/xul-ext-ubufox/xul-ext-youtube-html5-video-player/' -i debian/control.in
|
|
|
|
# Disable healtreport
|
|
cat << EOF > toolkit/components/telemetry/healthreport-prefs.js
|
|
pref("datareporting.healthreport.uploadEnabled", false);
|
|
pref("datareporting.healthreport.about.reportUrl", "https://trisquel.info/legal");
|
|
pref("datareporting.healthreport.infoURL", "https://trisquel.info/legal");
|
|
EOF
|
|
cp toolkit/components/telemetry/healthreport-prefs.js mobile/android/chrome/content/healthreport-prefs.js
|
|
|
|
sed 's%https://www.mozilla.org/legal/privacy/%https://trisquel.info/legal%' -i ./browser/app/profile/firefox.js ./toolkit/content/aboutRights.xhtml
|
|
|
|
#sed 's%https://www.mozilla.org/firefox/central/%https://trisquel.info/browser%' -i browser/base/content/browser-appmenu.inc
|
|
|
|
# Remove Google API key
|
|
sed '/Google API/,/google-api-keyfile/ d' debian/config/mozconfig.in -i
|
|
|
|
# Org branding
|
|
sed 's/com.ubuntu/org.trisquel/' -i debian/config/mozconfig.in
|
|
|
|
# Disable DRM support
|
|
echo ac_add_options --disable-eme >> debian/config/mozconfig.in
|
|
sed '/gmp-clearkey/d' -i ./debian/firefox.install.in
|
|
|
|
# Locale packages should provide firefox-locale-$LANG
|
|
sed "s/Provides.*/Provides: firefox-locale-@LANGCODE@/" -i debian/control.langpacks
|
|
|
|
# Remove Ubuntu bookmarks
|
|
sed -i /ubuntu-bookmarks/d debian/patches/series
|
|
rm debian/patches/ubuntu-bookmarks*
|
|
|
|
# Remove Ubuntu l10n search preferences
|
|
sed -i /ubuntu-search-defaults/d debian/patches/series
|
|
rm debian/patches/ubuntu-search-defaults*
|
|
|
|
#Unbrand url codes for google and amazon
|
|
find debian/searchplugins |grep google| xargs -i /bin/sed '/ubuntu/d; /channel/d' -i {}
|
|
find debian/searchplugins |grep amazon| xargs -i /bin/sed '/canoniccom/d;' -i {}
|
|
|
|
#Replace canonical referer with our own for duckduckgo
|
|
find debian/searchplugins |grep duck| xargs -i /bin/sed 's/canonical/trisquel/' -i {}
|
|
|
|
# contact link
|
|
#sed 's_https://input.mozilla.org/feedback_https://trisquel.info/contact_' -i browser/base/content/utilityOverlay.js
|
|
|
|
cat << EOF > debian/distribution.ini
|
|
[Global]
|
|
id=trisquel
|
|
version=$REVISION
|
|
about=Abrowser for Trisquel GNU/Linux
|
|
|
|
[Preferences]
|
|
app.distributor = "trisquel"
|
|
app.distributor.channel = "trisquel"
|
|
app.partner.ubuntu = "trisquel"
|
|
intl.locale.requested=""
|
|
EOF
|
|
|
|
sed "s/^MOZ_APP_NAME\t.*/MOZ_APP_NAME\t\t:= abrowser/;" debian/build/config.mk -i
|
|
sed "s/^MOZ_PKG_NAME\t.*/MOZ_PKG_NAME\t\t:= abrowser/;" debian/build/config.mk -i
|
|
|
|
############################################################################3
|
|
############################################################################3
|
|
############################################################################3
|
|
sed "s_^Maintainer.*_Maintainer: $DEBFULLNAME <$DEBEMAIL>_g" -i debian/control.in
|
|
|
|
# Replace Firefox branding
|
|
find -type d | grep firefox | xargs rename s/firefox/abrowser/
|
|
find -type d | grep firefox | xargs rename s/firefox/abrowser/
|
|
find -type f | grep firefox | xargs rename s/firefox/abrowser/
|
|
find -type f | grep Firefox | xargs rename s/Firefox/Abrowser/
|
|
|
|
SEDSCRIPT="
|
|
s/Mozilla Firefox/Abrowser/g;
|
|
s/firefox/abrowser/g;
|
|
s/Firefox/Abrowser/g;
|
|
s/FIREFOX/ABROWSER/g;
|
|
s/ Mozilla / Trisquel /g;
|
|
s|PACKAGES/abrowser|PACKAGES/firefox|g;
|
|
s/iceweasel, abrowser/iceweasel, firefox/g;
|
|
s/Replaces: abrowser/Replaces: firefox/g;
|
|
s/Adobe Flash/Flash/g;
|
|
s|www.mozilla.com/abrowser/central|trisquel.info/browser|g;
|
|
s|mozilla.com/plugincheck|trisquel.info/browser|g;
|
|
s|www.mozilla.com/legal/privacy|trisquel.info/legal|g;
|
|
|
|
s/Trisquel Public/Mozilla Public/g;
|
|
s/Trisquel Foundation/Mozilla Foundation/g;
|
|
s/Trisquel Corporation/Mozilla Corporation/g;
|
|
s/abrowser.com/firefox.com/g;
|
|
"
|
|
|
|
echo "Running batch replace operation"
|
|
find . -type f -not -iregex '.*changelog.*' -not -iregex '.*copyright.*' -not -iregex '.*third_party/rust.*' -execdir /bin/sed --follow-symlinks -i "$SEDSCRIPT" '{}' ';'
|
|
|
|
sed -i '2s/^Source:.*/Source: firefox/' debian/control.in
|
|
sed s/ubuntu/trisquel/g debian/distribution.ini -i
|
|
sed 's/ubuntu_version/trisquel_version/; s/Ubuntu 10.10/Trisquel 4.0/; s/1010/40/' -i debian/abrowser.postinst.in
|
|
|
|
# abrowser should provide firefox
|
|
sed '/Package: @MOZ_PKG_NAME@-dev/,/Description:/ s/Architecture: any/Architecture: any\nProvides: firefox-dev /' debian/control.in -i
|
|
sed '/Package: @MOZ_PKG_NAME@$/,/Description:/ s/Provides:/Provides: firefox, /' debian/control.in -i
|
|
|
|
# Branding files
|
|
rm browser/branding/{official,aurora,nightly,unofficial} -rf
|
|
cp -a $DATA/branding/ browser/branding/official
|
|
# Disable preprocessor
|
|
sed 's/_PP//' -i browser/branding/branding-common.mozbuild
|
|
cat << EOF >> debian/config/branch.mk
|
|
CHANNEL = release
|
|
MOZ_WANT_UNIT_TESTS = 0
|
|
MOZ_BUILD_OFFICIAL = 0
|
|
MOZ_ENABLE_BREAKPAD = 0
|
|
MOZ_ENABLE_TELEMETRY = 0
|
|
EOF
|
|
|
|
cp $DATA/watermark.svg ./browser/extensions/onboarding/content/img/watermark.svg
|
|
|
|
# Replace about:home
|
|
rm browser/base/content/abouthome -rf
|
|
cp $DATA/abouthome -a browser/base/content
|
|
sed '/abouthome/s/*/ /' -i ./browser/base/jar.mn
|
|
|
|
# Delete stuff we don't use and that may contain trademaked logos
|
|
rm -rf ./browser/metro ./addon-sdk/source/doc/static-files/media ./browser/themes/windows ./browser/themes/osx ./b2g
|
|
|
|
#Trisquel custom bookmarks
|
|
cp $DATA/bookmarks.html.in browser/locales/generic/profile/bookmarks.html.in
|
|
|
|
#Trisquel custom search engines
|
|
cp $DATA/searchplugins/*.xml debian/searchplugins/en-US/
|
|
cp $DATA/searchplugins/searchplugins.conf debian/config/
|
|
|
|
# install extensions
|
|
for extension in $(ls -1 $DATA/extensions/); do
|
|
cp $DATA/extensions/$extension -r debian
|
|
echo "debian/$extension @MOZ_ADDONDIR@/extensions/" >> debian/abrowser.install.in
|
|
done
|
|
|
|
# Disable search field at extensions panel
|
|
#sed '/header-search/d; /search.placeholder/d' -i toolkit/mozapps/extensions/content/extensions.xul
|
|
cat << EOF >> toolkit/mozapps/extensions/content/extensions.css
|
|
#header-search {
|
|
display:none;
|
|
}
|
|
EOF
|
|
|
|
# Hide mobile promo
|
|
echo ".fxaMobilePromo { display: none !important; }" >> browser/themes/shared/incontentprefs/preferences.inc.css
|
|
# Hide plugindeprecation-notice
|
|
echo "#plugindeprecation-notice { display: none !important; }" >> toolkit/mozapps/extensions/content/extensions.css
|
|
# Hide warnings on unsigned extensions
|
|
echo ".warning{display: none!important; } .addon[notification=warning]{background-image: none!important;}" >> toolkit/mozapps/extensions/content/extensions.css
|
|
# Hide extra links in about box
|
|
sed '/releaseNotes.link/d; /helpus/d' -i ./browser/base/content/aboutDialog.xul
|
|
|
|
find -wholename '*/brand.dtd' |xargs /bin/sed 's/trademarkInfo.part1.*/trademarkInfo.part1 "">/' -i
|
|
|
|
for STRING in community.end3 community.exp.end community.start2 community.mozillaLink community.middle2 community.creditsLink community.end2 contribute.start contribute.getInvolvedLink contribute.end channel.description.start channel.description.end
|
|
do
|
|
find -name aboutDialog.dtd | xargs sed -i "s/ENTITY $STRING.*/ENTITY $STRING \"\">/"
|
|
done
|
|
|
|
for STRING in rights.intro-point3-unbranded rights.intro-point4a-unbranded rights.intro-point4b-unbranded rights.intro-point4c-unbranded
|
|
do
|
|
find -name aboutRights.dtd | xargs sed -i "s/ENTITY $STRING.*/ENTITY $STRING \"\">/"
|
|
done
|
|
|
|
|
|
sed -i 's/<a\ href\=\"http\:\/\/www.mozilla.org\/\">Mozilla\ Project<\/a>/<a\ href\=\"http\:\/\/www.trisquel.info\/\"\>Trisquel\ Project<\/a>/g' browser/base/content/overrides/app-license.html
|
|
|
|
# We went too far...
|
|
#sed -i 's/iceweasel, abrowser, icecat,/iceweasel, firefox, icecat,/g' debian/control.in
|
|
sed '/Provides/s/abrowser-locale/firefox-locale/' -i debian/control.langpacks
|
|
|
|
# Restore useragent to Firefox
|
|
sed '/MOZILLA_UAVERSION/ s:Abrowser/:Firefox/:' -i netwerk/protocol/http/nsHttpHandler.cpp
|
|
|
|
# Set migrator scripts
|
|
sed 's/Abrowser/Firefox/g; s/abrowser/firefox/g' -i browser/components/migration/AbrowserProfileMigrator.js
|
|
sed s/ChromeProfileMigrator/_temp_/ -i browser/components/migration/moz.build
|
|
sed s/AbrowserProfileMigrator/ChromeProfileMigrator/ -i browser/components/migration/moz.build
|
|
sed s/_temp_/AbrowserProfileMigrator/ -i browser/components/migration/moz.build
|
|
|
|
# js settings
|
|
cat $DATA/settings.js >> debian/vendor-abrowser.js
|
|
|
|
# Postinst script to manage profile migration and system links
|
|
echo '
|
|
|
|
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] ; then
|
|
|
|
[ -f /usr/bin/firefox ] || ln -s /usr/bin/abrowser /usr/bin/firefox
|
|
|
|
for HOMEDIR in $(grep :/home/ /etc/passwd |grep -v usbmux |grep -v syslog|cut -d : -f 6)
|
|
do
|
|
[ -d $HOMEDIR/.mozilla/abrowser ] && continue || true
|
|
[ -d $HOMEDIR/.mozilla/firefox ] || continue
|
|
echo Linking $HOMEDIR/.mozilla/firefox into $HOMEDIR/.mozilla/abrowser
|
|
ln -s $HOMEDIR/.mozilla/firefox $HOMEDIR/.mozilla/abrowser
|
|
done
|
|
fi
|
|
exit 0 ' >> debian/abrowser.postinst.in
|
|
|
|
sed 's/1410/65/; s/1310/60/' -i debian/rules
|
|
|
|
debian/rules debian/control
|
|
touch -d "yesterday" debian/control
|
|
debian/rules debian/control
|
|
|
|
changelog "Rebranded for Trisquel"
|
|
|
|
compile
|