#!/bin/sh
#
#    Copyright (C) 2015-2017  Ruben Rodriguez <ruben@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=3
EXTERNAL='deb-src http://devel.trisquel.info/repos/packages/icecat/ GNU main'
SIGNKEY="D7E04784"
REPOKEY="3C76EED7D7E04784"

. ./config

cat << EOF >> browser/app/profile/icecat.js
// Preferences for the Get Add-ons panel
pref ("extensions.webservice.discoverURL", "https://trisquel.info/browser-plain");
pref ("extensions.getAddons.search.url", "https://trisquel.info/browser-plain");

// 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%");

// I'm feeling Ducky.
pref("keyword.URL", "https://duckduckgo.com/html?t=trisquel&q=!+");
pref("browser.search.defaultenginename", "DuckDuckGo");
pref("browser.search.order.extra.duckduckgo", "DuckDuckGo");
EOF

find . -type f |grep duckduckgo |xargs sed -i '/value/s/gnu/trisquel/'

cat << EOF > debian/distribution.ini
[Global]
id=trisquel
version=1.0
about=IceCat for Trisquel GNU/Linux

[Preferences]
app.distributor = "trisquel"
app.distributor.channel = "trisquel"
app.partner.ubuntu = "trisquel"
EOF

cp $DATA/searchplugins/* debian/searchplugins

mv browser/locales/searchplugins/google-nocodes.xml browser/locales/searchplugins/google.xml

changelog "Customized for Trisquel"

compile
