annotate .bash_mozilla @ 553:752e5eea7ea8

.bash_mozilla
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 19 Nov 2013 13:09:36 -0800
parents 029c7c2c511d
children 8ef38b16dcb9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
551
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/bin/bash
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 # mozilla-specific bash customizations
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 MOZCONFIGS=${HOME}/mozilla/mozconfigs
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 mozconfig() {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 if [ ! -e ${MOZCONFIGS} ]
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 then
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 echo "MOZCONFIGS directory ${MOZCONFIGS} does not exist"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12 return 1
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 fi
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 if [[ "$#" == "0" ]]
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 then
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 # list the available configs
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 ls -1 ${MOZCONFIGS} | sort
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 elif [[ "$#" == "1" ]]
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20 then
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 # activate the chosen mozconfig
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22 name=$1
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23 for _MOZCONFIG in "${MOZCONFIGS}/${name}" "${MOZCONFIGS}/mozconfig.${name}"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 do
553
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
25 if [[ -e "${_MOZCONFIG}" ]]
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
26 then
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
27 echo "Using MOZCONFIG : ${_MOZCONFIG}"
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
28 break
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
29 fi
551
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
30 done
553
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
31 if [[ ! -e "${_MOZCONFIG}" ]]
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
32 then
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
33 echo "MOZCONFIG ${name} not found"
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
34 return 1
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
35 fi
551
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
36 else
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
37 # print usage
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
38 echo "Usage: mozconfig <configname>"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
39 return 1
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
40 fi
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
41
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
42 }