annotate .bash_mozilla @ 608:9a5cdd49af53

STUB: python/multiproc.py
author Jeff Hammel <k0scist@gmail.com>
date Sun, 02 Feb 2014 11:37:34 -0800
parents 8741c4241a4c
children
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
555
Jeff Hammel <jhammel@mozilla.com>
parents: 554
diff changeset
5 # mozilla env vairables
Jeff Hammel <jhammel@mozilla.com>
parents: 554
diff changeset
6 export MOZCONFIG=~/mozilla/mozconfigs/mozconfig
Jeff Hammel <jhammel@mozilla.com>
parents: 554
diff changeset
7 export MOZSOURCE=~/mozilla/src/mozilla-central
Jeff Hammel <jhammel@mozilla.com>
parents: 554
diff changeset
8 export MOZOBJ=~/mozilla/src/obj-browser
Jeff Hammel <jhammel@mozilla.com>
parents: 554
diff changeset
9 unsetmozenv() {
Jeff Hammel <jhammel@mozilla.com>
parents: 554
diff changeset
10 unset MOZCONFIG
Jeff Hammel <jhammel@mozilla.com>
parents: 554
diff changeset
11 unset MOZSOURCE
Jeff Hammel <jhammel@mozilla.com>
parents: 554
diff changeset
12 unset MOZOBJ
Jeff Hammel <jhammel@mozilla.com>
parents: 554
diff changeset
13 env | sort
Jeff Hammel <jhammel@mozilla.com>
parents: 554
diff changeset
14 }
551
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 MOZCONFIGS=${HOME}/mozilla/mozconfigs
554
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
16 MOZSRC=${HOME}/mozilla/src
551
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 mozconfig() {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20 if [ ! -e ${MOZCONFIGS} ]
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 then
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22 echo "MOZCONFIGS directory ${MOZCONFIGS} does not exist"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23 return 1
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 fi
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
25
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26 if [[ "$#" == "0" ]]
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
27 then
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
28 # list the available configs
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
29 ls -1 ${MOZCONFIGS} | sort
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
30 elif [[ "$#" == "1" ]]
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
31 then
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
32 # activate the chosen mozconfig
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
33 name=$1
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
34 for _MOZCONFIG in "${MOZCONFIGS}/${name}" "${MOZCONFIGS}/mozconfig.${name}"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
35 do
553
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
36 if [[ -e "${_MOZCONFIG}" ]]
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
37 then
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
38 break
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
39 fi
551
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
40 done
553
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
41 if [[ ! -e "${_MOZCONFIG}" ]]
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
42 then
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
43 echo "MOZCONFIG ${name} not found"
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
44 return 1
752e5eea7ea8 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 551
diff changeset
45 fi
554
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
46
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
47 # get name of file
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
48 filename=$(basename $_MOZCONFIG)
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
49 if [[ "${filename}" == *.* ]]
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
50 then
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
51 name="${filename##*.}"
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
52 prefix="${name}"
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
53 else
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
54 name=".default."
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
55 prefix="obj"
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
56 fi
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
57
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
58 # set environment variables
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
59 export MOZCONFIG=${_MOZCONFIG}
556
Jeff Hammel <jhammel@mozilla.com>
parents: 555
diff changeset
60 export PS1="[${name}]${PS1}"
554
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
61
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
62 # print info
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
63 echo "Using MOZCONFIG=${MOZCONFIG} [${name}] :"
8ef38b16dcb9 .bash_mozilla
Jeff Hammel <jhammel@mozilla.com>
parents: 553
diff changeset
64 cat "${MOZCONFIG}"
551
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
65 else
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
66 # print usage
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
67 echo "Usage: mozconfig <configname>"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
68 return 1
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
69 fi
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
70
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
71 }