make-firefox 13.2 KB
Newer Older
1
#!/bin/bash
2
#
3
#    Copyright (C) 2008-2019  Ruben Rodriguez <ruben@trisquel.info>
4
#    Copyright (C) 2015       Santiago Rodriguez <santi@trisquel.info>
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#
#    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
#

21
VERSION=65
22 23 24

. ./config

25 26
patch -p1 < debian/patches/partially-revert-google-search-update.patch
patch -p1 < debian/patches/no-region-overrides-for-google-search.patch
27

28 29
rm debian/control

30 31
# 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
32 33 34 35 36 37 38 39 40 41 42 43 44
ActivityStream=browser/components/newtab/lib/ActivityStream.jsm
sed '/^const DEFAULT_SITES/,/^])\;/c const DEFAULT_SITES = new Map\([[""]]\);' -i $ActivityStream
sed '/\["showSponsored/,/value/s/value: true/value: false/' -i $ActivityStream
sed '/\["telemetry"/,/value/s/value: true/value: false/' -i $ActivityStream
sed '/\["section.highlights.includePocket"/,/value/s/value: true/value: false/' -i $ActivityStream
sed '/\["telemetry.ping.endpoint"/,/value/s/value: .*/value: ""/' -i $ActivityStream
sed 's/\(read_more_endpoint:\) .http.*/\1 "",/' -i $ActivityStream
sed 's/\(stories_endpoint:\) .http.*/\1 "",/' -i $ActivityStream
sed 's/\(stories_referrer:\) .http.*/\1 "",/' -i $ActivityStream
sed 's/\(topics_endpoint:\) .http.*/\1 "",/' -i $ActivityStream
sed '/name: "telemetry"/,/value/s/value: true/value: false/' -i $ActivityStream
sed '/name: "section.topstories"/,/return/s/return.*/return false;/' -i $ActivityStream
sed 's/.Ubuntu., //' -i browser/components/newtab/css/activity-stream*.css
45

46 47 48 49 50 51 52
#cp $DATA/watermark.svg ./browser/extensions/onboarding/content/img/watermark.svg
#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
53 54 55 56 57 58

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
59

60 61
# Replace ubufox recommendation
sed 's/xul-ext-ubufox/xul-ext-youtube-html5-video-player/' -i debian/control.in
62

63 64 65 66
# Disable healtreport
cat << EOF > toolkit/components/telemetry/healthreport-prefs.js
pref("datareporting.healthreport.uploadEnabled", false);
pref("datareporting.healthreport.about.reportUrl", "https://trisquel.info/legal");
67 68
pref("datareporting.healthreport.infoURL", "https://trisquel.info/legal");
EOF
69
cp toolkit/components/telemetry/healthreport-prefs.js mobile/android/chrome/content/healthreport-prefs.js
70

71
sed 's%https://www.mozilla.org/legal/privacy/%https://trisquel.info/legal%' -i ./browser/app/profile/firefox.js ./toolkit/content/aboutRights.xhtml
72 73 74

#sed 's%https://www.mozilla.org/firefox/central/%https://trisquel.info/browser%' -i browser/base/content/browser-appmenu.inc

75
# Remove Google API key
76
sed '/Google API/,/google-api-keyfile/ d' debian/config/mozconfig.in -i
77

78
# Org branding
79 80
sed 's/com.ubuntu/org.trisquel/' -i debian/config/mozconfig.in

81 82
# Disable DRM support
echo ac_add_options --disable-eme >> debian/config/mozconfig.in
83
sed '/gmp-clearkey/d' -i ./debian/firefox.install.in
84

85 86 87
# Correct build error
echo ac_add_options --enable-stdcxx-compat >> debian/config/mozconfig.in

88
# Locale packages should provide firefox-locale-$LANG
89
sed "s/Provides.*/Provides: abrowser-locale-@LANGCODE@/" -i debian/control.langpacks
90

91
# Remove Ubuntu bookmarks
92
sed -i /ubuntu-bookmarks/d debian/patches/series
93 94 95
rm debian/patches/ubuntu-bookmarks*

#Unbrand url codes for google and amazon
96 97 98
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 {}

99
#Replace canonical referer with our own for duckduckgo
100 101 102
find |grep -e duckduckgo.xml -e ddg.xml | xargs -i /bin/sed 's/canonical/trisquel/' -i {}

# Make DuckDuckGo the default engine
103 104
rm debian/patches/no-region-overrides-for-google-search.patch debian/patches/partially-revert-google-search-update.patch
sed '/no-region-overrides-for-google-search/d; /partially-revert-google-search-update/d' -i debian/patches/series
105 106
sed '/searchDefault/s/: \".*\"/: "DuckDuckGo"/g' -i browser/components/search/extensions/list.json
sed '/visibleDefaultEngines/{n; s/"ddg",//; s/\"/"ddg", "/}'  -i browser/components/search/extensions/list.json
107

Ruben Rodriguez committed
108
# contact link
109
#sed 's_https://input.mozilla.org/feedback_https://trisquel.info/contact_' -i browser/base/content/utilityOverlay.js
Ruben Rodriguez committed
110

111 112 113 114 115 116 117 118 119 120
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"
121
intl.locale.requested=""
122 123
EOF

124 125
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
126 127 128 129

############################################################################3
############################################################################3
############################################################################3
130
sed "s_^Maintainer.*_Maintainer: $DEBFULLNAME <$DEBEMAIL>_g" -i debian/control.in
131

132
SEDSCRIPT="
133 134 135 136
s/Try Firefox/Try Abrowser/g;
s/Firefox Home/Abrowser Home/g;
s/Firefox Account/Sync Account/g;
s/Updates from Mozilla and Firefox/Updates from Mozilla/g;
137
s/Adobe Flash/Flash/g;
138
s|www.mozilla.com/firefox/central|trisquel.info/browser|g;
139 140 141 142 143
s|mozilla.com/plugincheck|trisquel.info/browser|g;
s|www.mozilla.com/legal/privacy|trisquel.info/legal|g;
"

echo "Running batch replace operation"
144
find . -type f -not -iregex '.*changelog.*' -not -iregex '.*copyright.*' -not -iregex '.*third_party/rust.*' -execdir /bin/sed --follow-symlinks -i "$SEDSCRIPT" '{}' ';'
145

146 147
echo "Replacing Firefox with Abrowser on ./l10n"
find l10n -type f  -not -iregex '.*changelog.*' -not -iregex '.*copyright.*' -execdir /bin/sed --follow-symlinks -i "s/Firefox/Abrowser/" '{}' ';'
148

149 150
sed s/ubuntu/trisquel/g debian/distribution.ini -i
sed "s/ubuntu_version/trisquel_version/; s/Ubuntu 10.10/Trisquel $REVISION/; s/1010/40/" -i debian/firefox.postinst.in
151

152
# Branding files
153
rm browser/branding/{official,aurora,nightly,unofficial} -rf
154
cp -a $DATA/branding/ browser/branding/official
155
cp -a $DATA/branding/ browser/branding/unofficial
156 157
# Disable preprocessor
sed 's/_PP//' -i browser/branding/branding-common.mozbuild
158
cat << EOF >> debian/config/branch.mk
159
CHANNEL                 = release
160
MOZ_WANT_UNIT_TESTS     = 0
161
MOZ_BUILD_OFFICIAL      = 0
162
MOZ_ENABLE_BREAKPAD     = 0
163
MOZ_ENABLE_TELEMETRY    = 0
164 165
EOF

166
# Delete stuff we don't use and that may contain trademaked logos
167
rm -rf ./browser/metro ./addon-sdk/source/doc/static-files/media ./browser/themes/windows ./browser/themes/osx ./b2g
168 169

#Trisquel custom bookmarks
Ruben Rodriguez committed
170
cp $DATA/bookmarks.html.in browser/locales/generic/profile/bookmarks.html.in
171

172
#Trisquel custom search engines
173
cp $DATA/searchplugins/*.xml debian/searchplugins/
174
sed '/additions/,$d' debian/config/searchplugins.conf -i
175 176 177 178 179
cat << EOF >> debian/config/searchplugins.conf
  "additions": [
    {
      "name": "Trisquel",
      "include_locales": [ "*" ],
180
      "engine": "trisquel"
181 182 183 184
    },
    {
      "name": "Trisquel packages",
      "include_locales": [ "*" ],
185
      "engine": "trisquel-packages"
186 187 188 189
    }
  ]
}
EOF
190

191 192 193 194 195
# 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
196

197
# Disable search field at extensions panel
198 199
#sed  '/header-search/d; /search.placeholder/d' -i toolkit/mozapps/extensions/content/extensions.xul
cat << EOF >> toolkit/mozapps/extensions/content/extensions.css
200 201 202 203 204
#header-search {
  display:none;
}
EOF

205 206 207 208 209 210 211
# 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
212 213
sed '/releaseNotes.link/d' -i ./browser/base/content/aboutDialog.xul
sed '/description.*helpus/,/description/d' -i ./browser/base/content/aboutDialog.xul
214

215
find -wholename '*/brand.dtd' |xargs /bin/sed 's/trademarkInfo.part1.*/trademarkInfo.part1 "">/' -i
216

217 218 219
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 \"\">/"
220 221
done

222
for STRING in rights-intro-point-2 rights-intro-point-3 rights-intro-point-4 rights-intro-point-5 rights-intro-point-6 rights-webservices rights-safebrowsing
223
do
224
 find -name aboutRights.ftl | xargs sed -i "s/^$STRING.*/$STRING = /"
225 226
done

227 228
for STRING in helpus community-2 community-exp
do
229
 find -name aboutDialog.ftl | xargs sed -i "s/^$STRING.*/$STRING = /"
230
done
231

232
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
233 234

# We went too far...
235
#sed -i 's/iceweasel, abrowser, icecat,/iceweasel, firefox, icecat,/g' debian/control.in
236
sed '/Provides/s/abrowser-locale/firefox-locale/' -i debian/control.langpacks
237 238
/bin/sed '/intro-point2-a/s/Abrowser/Firefox/' -i l10n/*/toolkit/chrome/global/aboutRights.dtd
/bin/sed '/trademarkInfo/s/Abrowser/Firefox/' -i l10n/*/browser/branding/official/brand.ftl
239

240
/bin/sed 's/prefs_snippets_description=.*/prefs_snippets_description=Mozilla snippets/' -i l10n/*/browser/chrome/browser/activity-stream/newtab.properties
241 242

# Set migrator scripts
243 244 245 246
#sed 's/Abrowser/Firefox/g; s/abrowser/firefox/g' -i browser/components/migration/FirefoxProfileMigrator.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
247

248
# js settings
249
cat $DATA/settings.js >> debian/vendor-firefox.js
250

251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
#################
# Android stuff #
#################

# Settings
cat << EOF >> mobile/android/confvars.sh
# Abrowser settings
MOZ_APP_BASENAME=Abrowser
MOZ_APP_VENDOR=Trisquel
MOZ_PAY=0
MOZ_SERVICES_HEALTHREPORT=0
MOZ_SERVICES_HEALTHREPORTER=0
MOZ_SERVICES_METRICS=0
MOZ_DATA_REPORTING=0
MOZ_DEVICES=0
MOZ_ANDROID_GOOGLE_PLAY_SERVICES=0
MOZ_TELEMETRY_REPORTING=0
MOZ_ADDON_SIGNING=0
EOF

sed '/SENDERID/d' -i mobile/android/app/mobile.js

# Fix locale
cat << EOF >> mobile/locales/en-US/chrome/region.properties
browser.search.defaultenginename=DuckDuckGo
browser.search.order.1=DuckDuckGo
browser.search.order.2=Google
browser.search.order.3=Yahoo
browser.suggestedsites.restricted_mozilla.url=https://www.trisquel.info
browser.suggestedsites.webmaker.title=GNU Project
browser.suggestedsites.webmaker.url=https://www.gnu.org
EOF

sed -i '/aboutPage.logoTrademark/d' \
mobile/android/locales/en-US/chrome/about.dtd
echo -e '\n<!ENTITY aboutPage.logoTrademark "">' >> \
mobile/android/locales/en-US/chrome/about.dtd

# Branding
rm mobile/android/branding/{official,unofficial,beta,nightly} -rf
cp -a $DATA/android/branding/ mobile/android/branding/official
cp $DATA/android/mobile.ico mobile/android/app/
cp $DATA/android/images/* mobile/android/themes/core/images/
cp -a $DATA/android/res/main/* mobile/android/app/src/main/res/

296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
# 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

313 314
sed 's/1410/65/; s/1310/60/' -i debian/rules

315 316
sed 's/^Source:.*/Source: firefox/' -i debian/control.in

317 318
debian/rules debian/control
touch -d "yesterday" debian/control
319 320 321 322 323
debian/rules debian/control

changelog  "Rebranded for Trisquel"

compile