551
|
1 #!/bin/bash
|
|
2
|
|
3 # mozilla-specific bash customizations
|
|
4
|
|
5 MOZCONFIGS=${HOME}/mozilla/mozconfigs
|
554
|
6 MOZSRC=${HOME}/mozilla/src
|
551
|
7
|
|
8 mozconfig() {
|
|
9
|
|
10 if [ ! -e ${MOZCONFIGS} ]
|
|
11 then
|
|
12 echo "MOZCONFIGS directory ${MOZCONFIGS} does not exist"
|
|
13 return 1
|
|
14 fi
|
|
15
|
|
16 if [[ "$#" == "0" ]]
|
|
17 then
|
|
18 # list the available configs
|
|
19 ls -1 ${MOZCONFIGS} | sort
|
|
20 elif [[ "$#" == "1" ]]
|
|
21 then
|
|
22 # activate the chosen mozconfig
|
|
23 name=$1
|
|
24 for _MOZCONFIG in "${MOZCONFIGS}/${name}" "${MOZCONFIGS}/mozconfig.${name}"
|
|
25 do
|
553
|
26 if [[ -e "${_MOZCONFIG}" ]]
|
|
27 then
|
|
28 break
|
|
29 fi
|
551
|
30 done
|
553
|
31 if [[ ! -e "${_MOZCONFIG}" ]]
|
|
32 then
|
|
33 echo "MOZCONFIG ${name} not found"
|
|
34 return 1
|
|
35 fi
|
554
|
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}"
|
551
|
54 else
|
|
55 # print usage
|
|
56 echo "Usage: mozconfig <configname>"
|
|
57 return 1
|
|
58 fi
|
|
59
|
|
60 } |