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 [-d datafiles]
53 =============== ============================================================
54 -p product required. firefox, thunderbird or fennec
55 -b branch required. 1.8.0|1.8.1|1.9.0|1.9.1
56 -x executablepath required. directory where build is installed
57 -d datafiles optional. one or more filenames of files containing
58 environment variable definitions to be included.
60 note that the environment variables should have the same names as in the
63 Uninstalls build located in directory-tree 'executablepath'
64 then removes the directory upon completion.
70 unset product branch executablepath datafiles
72 while getopts $options optname
;
77 x
) executablepath
=$OPTARG;;
78 d
) datafiles
=$OPTARG;;
82 # include environment variables
85 if [[ -z "$product" ||
-z "$branch" ||
-z "$executablepath" ]]
91 if [[ ! ls "$executablepath/*" 2> /dev
/null
]]; then
95 executable
=`get_executable $product $branch $executablepath`
97 executabledir
=`dirname $executable`
99 if [[ $OSID == "nt" ]]; then
100 # see http://nsis.sourceforge.net/Docs/Chapter3.html
102 # if the directory already exists, attempt to uninstall
103 # any existing installation.
105 if [[ -d "$executabledir/uninstall" ]]; then
107 if [[ "$branch" == "1.8.0" ]]; then
108 uninstallexe
="$executabledir/uninstall/uninstall.exe"
109 uninstallini
="$executabledir/uninstall/uninstall.ini"
110 if [[ -n "$uninstallexe" && -e "$uninstallexe" ]]; then
111 if sed -i.bak
's/Run Mode=Normal/Run Mode=Silent/' $uninstallini;
113 # uninstall.exe will return non zero exit codes
114 # for no damn reason.
115 if $uninstallexe; then
120 elif [[ "$branch" == "1.8.1" ||
"$branch" == "1.9.0" ||
"$branch" == "1.9.1" ]]; then
121 uninstalloldexe
="$executabledir/uninstall/uninst.exe"
122 uninstallnewexe
="$executabledir/uninstall/helper.exe"
123 if [[ -n "$uninstallnewexe" && -e "$uninstallnewexe" ]]; then
124 $uninstallnewexe /S
/D
=`cygpath -a -w $executabledir | sed 's@\\\\@\\\\\\\\@g'`
125 elif [[ -n "$uninstalloldexe" && -e "$uninstalloldexe" ]]; then
126 $uninstalloldexe /S
/D
=`cygpath -a -w $executabledir | sed 's@\\\\@\\\\\\\\@g'`
128 uninstallexe
="$executabledir/$product/uninstall/uninstaller.exe"
129 if [[ -n "$uninstallexe" && -e "$uninstallexe" ]]; then
130 $uninstallexe /S
/D
=`cygpath -a -w "$executabledir" | sed 's@\\\\@\\\\\\\\@g'`
134 error
"Unknown branch $branch" $LINENO
136 # the NSIS uninstaller will copy itself, then fork to the new
137 # copy so that it can delete itself. This causes a race condition
138 # between the uninstaller deleting the files and the rm command below
139 # sleep for 10 seconds to give the uninstaller time to complete before
140 # the installation directory is removed.
146 # safely creates/deletes a directory. If we pass this,
147 # then we know it is safe to remove the directory.
149 $TEST_DIR/bin
/create-directory.sh
-d "$executablepath" -n
151 rm -fR "$executablepath"