Newer
Older
#!/bin/bash
# Copyright (C) 2020 Ruben Rodriguez <ruben@trisquel.info>
# Copyright (C) 2019 David Trudgian <dave@trudgian.net>
#
# 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
#
# Copy in our local Trisquel branding files
cp $DATA/branding/* comm/mail/branding/nightly/ -r
for i in aurora nightly official unofficial; do
cp $DATA/branding/* browser/branding/$i/ -r
done
cat << EOF >> debian/vendor.js
// Trisquel settings
pref("app.releaseNotesURL", "http://trisquel.info/mailclient");
pref("app.vendorURL", "http://trisquel.info/mailclient");
// PFS url
pref("pfs.datasource.url", "https://trisquel.info/sites/pfs.php?mime=%PLUGIN_MIMETYPE%");
pref("pfs.filehint.url", "https://trisquel.info/sites/pfs.php?mime=%PLUGIN_MIMETYPE%");
// DuckDuckGo
pref("keyword.URL", "https://duckduckgo.com/?t=trisquel&q=!+");
pref("browser.search.defaultenginename", "DuckDuckGo");
pref("browser.search.order.1", "DuckDuckGo");
pref("browser.search.defaultenginename", "DuckDuckGo");
pref("browser.search.showOneOffButtons", false);
pref("browser.search.suggest.enabled",false);
// Disable third party cookies
pref("network.cookie.cookieBehavior", 1);
// Extensions cannot be updated without permission
pref("extensions.update.enabled", false);
pref("extensions.systemAddon.update.enabled", false);
pref("lightweightThemes.update.enabled", false);
// Don't show suggested provider list
pref("mail.provider.enabled", false);
pref("mail.provider.providerList", "");
pref("mail.provider.suggestFromName", "");
// Don't prompt if not default mail client
pref("mail.shell.checkDefaultClient", false);
// Preferences for the Get Add-ons panel
pref("extensions.webservice.discoverURL", "https://directory.fsf.org/wiki/Icedove");
pref("extensions.getAddons.search.url", "https://trisquel.info"
pref("extensions.blocklist.enabled", false);
// Dictionary download preference
pref("spellchecker.dictionaries.download.url", "http://dictionaries.mozdev.org/installation.html");
// Privacy protections
pref("mail.rights.version", 1);
pref("toolkit.telemetry.prompted", 2);
pref("toolkit.telemetry.rejected", true);
pref("mailnews.start_page.enabled", false);
pref("mailnews.start_page.url", "");
pref("mailnews.start_page.override_url", "");
pref("app.update.auto", false);
pref("app.update.enabled", false);
pref("browser.search.update", false);
pref("app.update.url.manual", "https://trisquel.info/wiki/icedove");
pref("mail.cloud_files.inserted_urls.footer.link", "https://trisquel.info/wiki/icedove");
pref("mail.cloud_files.learn_more_url", "https://trisquel.info/wiki/icedove");
pref("mail.ignore_thread.learn_more_url", "https://trisquel.info/wiki/icedove");
pref("mail.pgpmime.addon_url", "https://enigmail.net/");
pref("app.support.baseURL", "https://trisquel.info/wiki/icedove");
pref("app.update.url.manual", "https://trisquel.info/wiki/icedove");
pref("extensions.getAddons.link.url", "https://trisquel.info/en/browser-plain");
pref("extensions.getAddons.search.browseURL", "https://trisquel.info/en/browser-plain?keys=%TERMS%&tid=All");
pref("extensions.getAddons.search.url", "https://trisquel.info/en/browser-plain?keys=%TERMS%&tid=All");
EOF
# DDG as default search engine
sed 's/?q=/?t=trisquel&q=/' -i comm/mail/components/search/extensions/ddg/manifest.json
sed '/searchDefault/s/: \".*\"/: "DuckDuckGo"/g' -i comm/mail/components/search/extensions/list.json
sed '/visibleDefaultEngines/{n; s/"ddg",//; s/\"/"ddg", "/}' -i comm/mail/components/search/extensions/list.json
# ####################################################
# Privacy / branding brought in from abrowser for 60.x
#
# captive portal page
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
# 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
# Browser legal page
sed 's%https://www.mozilla.org/legal/privacy/%https://trisquel.info/legal%' -i ./browser/app/profile/firefox.js ./toolkit/content/aboutRights.xhtml
# 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 '/^MOZ_PKG_NAME/s/.*/MOZ_PKG_NAME=icedove/' -i debian/build/config.mk
cat << EOF >> debian/build/config.mk
# Trisquel settings
MOZ_FORCE_UNOFFICIAL_BRANDING = 1
MOZ_WANT_UNIT_TESTS = 0
MOZ_ENABLE_BREAKPAD = 0
# Replace Thunderbird branding
find -type d -name '*thunderbird*' | xargs rename s/thunderbird/icedove/
find -type f -name '*thunderbird*' | xargs rename s/thunderbird/icedove/
SEDSCRIPT="
s|Search addons.mozilla.org|Search|g;
s/Mozilla Thunderbird/Icedove/g;
s/thunderbird/icedove/g;
s/Thunderbird/Icedove/g;
s/THUNDERBIRD/ICEDOVE/g;
s/ Mozilla / Trisquel /g;
s|PACKAGES/icedove|PACKAGES/thunderbird|g;
s/iceweasel, icedove/iceweasel, thunderbird/g;
s/Replaces: icedove/Replaces: thunderbird/g;
s|www.mozilla.com/icedove/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;
"
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 's|https://www.icedove.net/features/|https://trisquel.info/wiki/icedove|' -i comm/mail/base/content/utilityOverlay.js
sed 's|https://www.icedove.net/get-involved/|https://trisquel.info/wiki/|' -i comm/mail/base/content/utilityOverlay.js
sed 's|https://donate.mozilla.org/.*help-menu|https://trisquel.info/donate/|' -i comm/mail/base/content/utilityOverlay.js
replace Daily Trisquel comm/mail/branding/
sed '/.*<description.*communityExperimentalDesc/,/\/description/d' -i ./comm/mail/base/content/aboutDialog.xul
sed '/.*<description.*communityDesc/,/\/description/d' -i ./comm/mail/base/content/aboutDialog.xul
sed '/.*<description.*contributeDesc/,/\/description/d' -i ./comm/mail/base/content/aboutDialog.xul
sed '/^Source/s/.*/Source: thunderbird/' -i debian/control.in
sed 's/Provides: mail-reader,/Provides: mail-reader, thunderbird,/' -i debian/control.in
sed "s/Provides.*/Provides: icedove-locale-@LANGCODE@/" -i debian/control.langpacks
cat << EOF > comm/mail/branding/nightly/locales/en-US/brand.properties
brandShortName=Icedove
brandShorterName=Icedove
brandFullName=Icedove Mail
vendorShortName=Icedove
EOF
cat << EOF > comm/mail/branding/nightly/locales/en-US/brand.dtd
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY brandShortName "Icedove">
<!ENTITY brandShorterName "Icedove">
<!ENTITY brandFullName "Icedove Mail">
<!-- LOCALIZATION NOTE (brandProductName):
This brand name can be used in messages where the product name needs to
remain unchanged across different versions (Trisquel, Beta, etc.). -->
<!ENTITY brandProductName "Icedove">
<!ENTITY vendorShortName "mozilla.org">
<!ENTITY trademarkInfo.part1 " ">
debian/rules debian/control
touch -d "yesterday" debian/control
debian/rules debian/control
changelog "Rebranded for Trisquel"