Mercurial > hg > config
comparison .bash_mozilla @ 554:8ef38b16dcb9
.bash_mozilla
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 19 Nov 2013 14:04:49 -0800 |
parents | 752e5eea7ea8 |
children | f98fe4362c84 |
comparison
equal
deleted
inserted
replaced
553:752e5eea7ea8 | 554:8ef38b16dcb9 |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # mozilla-specific bash customizations | 3 # mozilla-specific bash customizations |
4 | 4 |
5 MOZCONFIGS=${HOME}/mozilla/mozconfigs | 5 MOZCONFIGS=${HOME}/mozilla/mozconfigs |
6 MOZSRC=${HOME}/mozilla/src | |
6 | 7 |
7 mozconfig() { | 8 mozconfig() { |
8 | 9 |
9 if [ ! -e ${MOZCONFIGS} ] | 10 if [ ! -e ${MOZCONFIGS} ] |
10 then | 11 then |
22 name=$1 | 23 name=$1 |
23 for _MOZCONFIG in "${MOZCONFIGS}/${name}" "${MOZCONFIGS}/mozconfig.${name}" | 24 for _MOZCONFIG in "${MOZCONFIGS}/${name}" "${MOZCONFIGS}/mozconfig.${name}" |
24 do | 25 do |
25 if [[ -e "${_MOZCONFIG}" ]] | 26 if [[ -e "${_MOZCONFIG}" ]] |
26 then | 27 then |
27 echo "Using MOZCONFIG : ${_MOZCONFIG}" | |
28 break | 28 break |
29 fi | 29 fi |
30 done | 30 done |
31 if [[ ! -e "${_MOZCONFIG}" ]] | 31 if [[ ! -e "${_MOZCONFIG}" ]] |
32 then | 32 then |
33 echo "MOZCONFIG ${name} not found" | 33 echo "MOZCONFIG ${name} not found" |
34 return 1 | 34 return 1 |
35 fi | 35 fi |
36 | |
37 # get name of file | |
38 filename=$(basename $_MOZCONFIG) | |
39 if [[ "${filename}" == *.* ]] | |
40 then | |
41 name="${filename##*.}" | |
42 prefix="${name}" | |
43 else | |
44 name=".default." | |
45 prefix="obj" | |
46 fi | |
47 | |
48 # set environment variables | |
49 export MOZCONFIG=${_MOZCONFIG} | |
50 | |
51 # print info | |
52 echo "Using MOZCONFIG=${MOZCONFIG} [${name}] :" | |
53 cat "${MOZCONFIG}" | |
36 else | 54 else |
37 # print usage | 55 # print usage |
38 echo "Usage: mozconfig <configname>" | 56 echo "Usage: mozconfig <configname>" |
39 return 1 | 57 return 1 |
40 fi | 58 fi |