#!/bin/sh
#
#    Copyright (C) 2011  Rubén Rodríguez <ruben@trisquel.info>
#    Copyright (C) 2015  Santiago Rodríguez <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=1

. ./config

sed 's/] def/  [ "nds" "nds" "Plattdüütsch" ]\n[ "oc" "oc" "Occitan" ]\n[ "aym" "aym" "Aymara" ]\n[ "quz" "quz" "Qhiswa (quz)" ]\n] def/' langnames.inc -i

cp po/es.po po/quz.po
cp po/es.po po/aym.po

#for FILE in po/*.po*; do
#[ $FILE = "hi.po" ] && continue
#ACCESSLINE=$(expr $(grep -n \"Accessibility\" $FILE |cut -d: -f1|head -n 1) + 1)
#ACCESSWORD=$(sed -n ${ACCESSLINE}p $FILE |sed 's/msgstr \"//;s/\"//')
#
#LINE=$(expr $(grep -n "Try Ubuntu Netbook without installing" $FILE|cut -d: -f1) + 1 )
#sed "${LINE}s/\"$/ (+ $ACCESSWORD)\"/" -i $FILE
#LINE=$(expr $(grep -n "Install Ubuntu Netbook" $FILE|cut -d: -f1) + 1 )
#sed "${LINE}s/\"$/ (+ $ACCESSWORD)\"/" -i $FILE
#
#sed 's/Try Ubuntu Netbook without installing/Try Ubuntu Netbook without installing (+ Accessibility)/' -i $FILE
#done

replace Kubuntu Triskel .
replace "Ubuntu Netbook" Trisquel .
replace Edubuntu "Trisquel Sugar TOAST" .
replace Eubuntu "Trisquel Sugar TOAST" .
replace Eduubuntu "Trisquel Sugar TOAST" .
replace Xubuntu "Trisquel Mini" .
replace Xbuntu "Trisquel Mini" .
replace "Ubuntu MID" "Trisquel Edu" .
replace Mythbuntu "Trisquel Pro" .
replace Mythubuntu "Trisquel Pro" .
replace "Enterprise Cloud" "Gamer" .
#replace "Ubuntu Studio" "Trisquel ..."

replace Ubuntu Trisquel .

sed /txt_option_free/d dia_fulloptions.inc -i
sed /fulloptions.free/d dia_fulloptions.inc -i

#sed 's:\(.*\)120\(.*\):\181\2\n/timeout.time.x timeout.x 550 add def:' timeout.inc -i
cat << EOF | patch -p1
diff -ru gfxboot-theme-ubuntu-0.13.3.orig/common.inc gfxboot-theme-ubuntu-0.13.3/common.inc
--- gfxboot-theme-ubuntu-0.13.3.orig/common.inc	2012-05-14 23:53:21.000000000 +0000
+++ gfxboot-theme-ubuntu-0.13.3/common.inc	2012-11-10 22:00:04.000000000 +0000
@@ -431,6 +431,10 @@
     "maybe-ubiquity " bc.cmd dup length add sprintf
   } if
 
+  timeout.finished {
+    " access=v3 " bc.cmd dup length add sprintf
+  } if
+
   bc.cmd dropspaces
 
   debug 3 ge {
diff -ru gfxboot-theme-ubuntu-0.13.3.orig/timeout.inc gfxboot-theme-ubuntu-0.13.3/timeout.inc
--- gfxboot-theme-ubuntu-0.13.3.orig/timeout.inc	2012-05-14 23:53:21.000000000 +0000
+++ gfxboot-theme-ubuntu-0.13.3/timeout.inc	2012-11-10 23:17:37.000000000 +0000
@@ -24,6 +24,10 @@
 
     timeout.time.x timeout.time.y moveto timeout.buf showright
   } if
+
+  timeout.buf "0 s" eq {
+    /timeout.finished true def
+  } if
 } def
 
 
@@ -38,6 +42,8 @@
 
   /timeout.time.x timeout.x def
   /timeout.time.y timeout.y 120 add def
+  /timeout.time.y timeout.y 81 add def
+  /timeout.time.x timeout.x 550 add def
 } def
 
 
EOF

sed 's/gfxboot-theme-ubuntu/gfxboot-theme-trisquel/' debian/control -i
sed '1s/gfxboot-theme-ubuntu/gfxboot-theme-trisquel/' debian/changelog -i
mv debian/gfxboot-theme-ubuntu.install debian/gfxboot-theme-trisquel.install
sed 's/ubuntu/trisquel/' debian/gfxboot-theme-trisquel.install -i

changelog "Rebranded for Trisquel"

compile

