Automated checkin: version bump remove "pre" from version number for firefox 4.0b4...
[mozilla-central.git] / testing / sisyphus / bin / install-extensions.sh
blob0c72593085130c332e7edac78358ce420cfdcb2e
1 #!/bin/bash -e
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
14 # License.
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) 2005.
21 # the Initial Developer. All Rights Reserved.
23 # Contributor(s):
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
42 TEST_STARTUP_TRIES=${TEST_STARTUP_TRIES:-3}
45 # options processing
47 options="p:b:x:N:E:d:"
48 function usage()
50 cat <<EOF
51 usage:
52 $SCRIPT -p product -b branch -x executablepath -N profilename -E extensiondir
53 [-d datafiles]
55 variable description
56 =============== ============================================================
57 -p product required. firefox.
58 -b branch required. supported branch. see library.sh
59 -x executablepath required. directory-tree containing executable named
60 'product'
61 -N profilename required. profile name
62 -E extensiondir required. path to directory containing xpis to be installed
63 -d datafiles optional. one or more filenames of files containing
64 environment variable definitions to be included.
66 note that the environment variables should have the same names as in the
67 "variable" column.
69 EOF
70 exit 1
73 unset product branch executablepath profilename extensiondir datafiles
75 while getopts $options optname ;
77 case $optname in
78 p) product=$OPTARG;;
79 b) branch=$OPTARG;;
80 x) executablepath=$OPTARG;;
81 N) profilename=$OPTARG;;
82 E) extensiondir=$OPTARG;;
83 d) datafiles=$OPTARG;;
84 esac
85 done
87 # include environment variables
88 loaddata $datafiles
90 if [[ -z "$product" || -z "$branch" || \
91 -z "$executablepath" || -z "$profilename" || -z "$extensiondir" ]]; then
92 usage
95 checkProductBranch $product $branch
97 if echo $profilename | egrep -qiv '[a-z0-9_]'; then
98 error "profile name must consist of letters, digits or _" $LINENO
101 executable=`get_executable $product $branch $executablepath`
102 executableextensiondir=`dirname $executable`/extensions
104 # create directory to contain installed extensions
105 if [[ ! -d /tmp/sisyphus/extensions ]]; then
106 create-directory.sh -n -d /tmp/sisyphus/extensions
109 for extensionloc in $extensiondir/all/*.xpi $extensiondir/$OSID/*.xpi; do
110 if [[ $extensionloc == "$extensiondir/all/*.xpi" ]]; then
111 continue
113 if [[ $extensionloc == "$extensiondir/$OSID/*.xpi" ]]; then
114 continue
117 extensionname=`xbasename $extensionloc .xpi`
118 extensioninstalldir=/tmp/sisyphus/extensions/$extensionname
120 if [[ "$OSID" == "nt" ]]; then
121 extensionosinstalldir=`cygpath -a -w $extensioninstalldir`
122 else
123 extensionosinstalldir=$extensioninstalldir
125 echo installing $extensionloc
127 # unzip the extension if it does not already exist.
128 if [[ ! -e $extensioninstalldir ]]; then
129 create-directory.sh -n -d $extensioninstalldir
130 unzip -d $extensioninstalldir $extensionloc
133 extensionuuid=`perl $TEST_DIR/bin/get-extension-uuid.pl $extensioninstalldir/install.rdf`
134 if [[ ! -e $executableextensiondir/$extensionuuid ]]; then
135 echo $extensionosinstalldir > $executableextensiondir/$extensionuuid
138 done
140 # restart to make extension manager happy
141 if ! $TEST_DIR/bin/timed_run.py ${TEST_STARTUP_TIMEOUT} "install extensions - first restart" \
142 $executable -P $profilename "http://${TEST_HTTP}/bin/install-extensions-1.html"; then
143 echo "Ignoring 1st failure to load the install-extensions page"
146 exit 0