2 # -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*-
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
16 # The Original Code is mozilla.org code.
18 # The Initial Developer of the Original Code is
19 # Mozilla Corporation.
20 # Portions created by the Initial Developer are Copyright (C) 2006.
21 # the Initial Developer. All Rights Reserved.
24 # Bob Clary <bob@bclary.com>
26 # Alternatively, the contents of this file may be used under the terms of
27 # either the GNU General Public License Version 2 or later (the "GPL"), or
28 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 # in which case the provisions of the GPL or the LGPL are applicable instead
30 # of those above. If you wish to allow use of your version of this file only
31 # under the terms of either the GPL or the LGPL, and not to allow others to
32 # use your version of this file under the terms of the MPL, indicate your
33 # decision by deleting the provisions above and replace them with the notice
34 # and other provisions required by the GPL or the LGPL. If you do not delete
35 # the provisions above, a recipient may use your version of this file under
36 # the terms of any one of the MPL, the GPL or the LGPL.
38 # ***** END LICENSE BLOCK *****
40 source $TEST_DIR/bin
/library.sh
50 $SCRIPT -p product -b branch -x executablepath -i talkbackid [-d datafiles]
53 =============== ============================================================
54 -p product required. firefox|thunderbird
55 -b branch required. 1.8.0|1.8.1|1.9.0|1.9.1
56 -x executablepath required. directory-tree containing executable named
58 -i talkbackid required. identifier to add to talkback url
59 -d datafiles optional. one or more filenames of files containing
60 environment variable definitions to be included.
62 note that the environment variables should have the same names as in the
69 unset product branch executablepath talkbackid datafiles
71 while getopts $options optname
;
76 x
) executablepath
=$OPTARG;;
77 i
) talkbackid
=$OPTARG;;
78 d
) datafiles
=$OPTARG;;
82 # include environment variables
85 if [[ -z "$product" ||
-z "$branch" || \
86 -z "$executablepath" ||
-z "$talkbackid" ]]; then
90 executable
=`get_executable $product $branch $executablepath`
92 executablepath
=`dirname $executable`
94 # escape & in talkback id to prevent replacements
95 talkbackid
=`echo $talkbackid | sed 's@&@\\\\&@g'`
98 # edit talkback to automatically submit
102 if [[ -e "$executablepath/extensions/talkback@mozilla.org/components/master.ini" ]]; then
103 cd "$executablepath/extensions/talkback@mozilla.org/components/"
104 elif [[ -e "$executablepath/extensions/talkback@mozilla.org/components/talkback/master.ini" ]]; then
105 cd "$executablepath/extensions/talkback@mozilla.org/components/talkback/"
106 elif [[ -e "$executablepath/components/master.ini" ]]; then
107 cd "$executablepath/components"
113 if [[ $talkback -eq 1 ]]; then
114 # edit to automatically send talkback incidents
115 if [[ ! -e master.
sed ]]; then
116 #echo "$0: editing talkback master.ini in `pwd`"
117 cp $TEST_DIR/bin
/master.
sed .
118 sed -f master.
sed -i.bak master.ini
123 vendorid
=`dos2unix < master.ini | grep '^VendorID = "' | sed 's@VendorID = "\([^"]*\)"@\1@'`
124 productid
=`dos2unix < master.ini | grep '^ProductID = "' | sed 's@ProductID = "\([^"]*\)"@\1@'`
125 platformid
=`dos2unix < master.ini | grep '^PlatformID = "' | sed 's@PlatformID = "\([^"]*\)"@\1@'`
126 buildid
=`dos2unix < master.ini | grep '^BuildID = "' | sed 's@BuildID = "\([^"]*\)"@\1@'`
127 appdata
=`cygpath -a -d "$APPDATA"`
128 talkbackdir
="`cygpath -a -u $appdata`/Talkback"
131 vendorid
=`dos2unix < master.ini | grep '^VendorID = "' | sed 's@VendorID = "\([^"]*\)"@\1@'`
132 productid
=`dos2unix < master.ini | grep '^ProductID = "' | sed 's@ProductID = "\([^"]*\)"@\1@'`
133 platformid
=`dos2unix < master.ini | grep '^PlatformID = "' | sed 's@PlatformID = "\([^"]*\)"@\1@'`
134 buildid
=`dos2unix < master.ini | grep '^BuildID = "' | sed 's@BuildID = "\([^"]*\)"@\1@'`
135 talkbackdir
="$HOME/.fullcircle"
138 # hack around Mac's use of spaces in directory names
139 vendorid
=`grep '^VendorID = "' master.ini | sed 's@VendorID = "\([^"]*\)"@\1@'`
140 productid
=`grep '^ProductID = "' master.ini | sed 's@ProductID = "\([^"]*\)"@\1@'`
141 platformid
=`grep '^PlatformID = "' master.ini | sed 's@PlatformID = "\([^"]*\)"@\1@'`
142 buildid
=`grep '^BuildID = "' master.ini | sed 's@BuildID = "\([^"]*\)"@\1@'`
143 talkbackdir
="$HOME/Library/Application Support/FullCircle"
147 error
"unknown os $OSID" $LINENO
151 if [[ -z "$talkbackdir" ]]; then
152 error
"empty talkback directory" $LINENO
155 mkdir
-p "$talkbackdir"
159 talkbackinidir
="$talkbackdir/$vendorid/$productid/$platformid/$buildid"
162 talkbackinidir
="$talkbackdir/$vendorid$productid$platformid$buildid"
166 if [[ ! -d "$talkbackinidir" ]]; then
167 create-directory.sh
-d "$talkbackinidir" -n
172 cp ${TEST_DIR}/talkback
/$OSID/Talkback.ini .
176 sed -i.bak
"s@URLEdit .*@URLEdit = \"mozqa:$talkbackid\"@" Talkback.ini
179 sed -i.bak
"s@URLEditControl .*@URLEditControl = \"mozqa:$talkbackid\"@" Talkback.ini
182 sed -i.bak
"s@URLEditControl .*@URLEditControl = \"mozqa:$talkbackid\"@" Talkback.ini
185 error
"unknown os=$OSID" $LINENO