Bug 460926 A11y hierachy is broken on Ubuntu 8.10 (GNOME 2.24), r=Evan.Yan sr=roc
[wine-gecko.git] / testing / sisyphus / bin / create-profile.sh
blob309ce05d63bc9f83150cafee3a29200bfc480fcb
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) 2006.
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
43 # options processing
45 options="p:b:x:D:N:L:U:d:"
46 function usage()
48 cat <<EOF
49 usage:
50 $SCRIPT -p product -b branch -x executablepath -D directory -N profilename
51 [-L profiletemplate] [-U user] [-d datafiles]
53 variable description
54 =============== ============================================================
55 -p product required. firefox, thunderbird or fennec
56 -b branch required. 1.8.0|1.8.1|1.9.0|1.9.1
57 -x executablepath required. directory-tree containing executable 'product'
58 -D directory required. directory where profile is to be created.
59 -N profilename required. profile name
60 -L profiletemplate optional. location of a template profile to be used.
61 -U user optional. user.js preferences file.
62 -d datafiles optional. one or more filenames of files containing
63 environment variable definitions to be included.
65 note that the environment variables should have the same names as in the
66 "variable" column.
68 EOF
69 exit 1
72 unset product branch executablepath directory profilename profiletemplate user datafiles
74 while getopts $options optname ;
75 do
76 case $optname in
77 p) product=$OPTARG;;
78 b) branch=$OPTARG;;
79 x) executablepath=$OPTARG;;
80 D) directory=$OPTARG;;
81 N) profilename=$OPTARG;;
82 L) profiletemplate=$OPTARG;;
83 U) user=$OPTARG;;
84 d) datafiles=$OPTARG;;
85 esac
86 done
88 # include environment variables
89 loaddata $datafiles
91 if [[ -z "$product" || -z "$branch" || -z "$executablepath" || \
92 -z "$directory" || -z "$profilename" ]]; then
93 usage
96 if [[ "$product" != "firefox" && "$product" != "thunderbird" && "$product" != "fennec" ]]; then
97 error "product \"$product\" must be one of firefox, thunderbird or fennec" $LINENO
100 if [[ "$branch" != "1.8.0" && "$branch" != "1.8.1" && "$branch" != "1.9.0" && "$branch" != "1.9.1" ]];
101 then
102 error "branch \"$branch\" must be one of 1.8.0, 1.8.1, 1.9.0 1.9.1" $LINENO
105 executable=`get_executable $product $branch $executablepath`
107 $TEST_DIR/bin/create-directory.sh -d "$directory" -n
109 if echo "$profilename" | egrep -qiv '[a-z0-9_]'; then
110 error "profile name \"$profilename\" must consist of letters, digits or _" $LINENO
113 if [ $OSID == "nt" ]; then
114 directoryospath=`cygpath -a -w $directory`
115 if [[ -z "$directoryospath" ]]; then
116 error "unable to convert unix path to windows path" $LINENO
118 else
119 directoryospath="$directory"
122 echo "creating profile $profilename in directory $directory"
124 tries=1
125 while ! $TEST_DIR/bin/timed_run.py ${TEST_STARTUP_TIMEOUT} "-" \
126 $EXECUTABLE_DRIVER \
127 $executable -CreateProfile "$profilename $directoryospath"; do
128 let tries=tries+1
129 if [ "$tries" -gt $TEST_STARTUP_TRIES ]; then
130 error "Failed to create profile $directory Exiting..." $LINENO
132 sleep 30
133 done
135 if [[ -n $profiletemplate ]]; then
136 if [[ ! -d $profiletemplate ]]; then
137 error "profile template directory $profiletemplate does not exist" $LINENO
139 echo "copying template profile $profiletemplate to $directory"
140 cp -R $profiletemplate/* $directory
143 if [[ ! -z $user ]]; then
144 cp $user $directory/user.js