551
|
1 #!/bin/bash
|
|
2
|
|
3 # mozilla-specific bash customizations
|
|
4
|
555
|
5 # mozilla env vairables
|
|
6 export MOZCONFIG=~/mozilla/mozconfigs/mozconfig
|
|
7 export MOZSOURCE=~/mozilla/src/mozilla-central
|
|
8 export MOZOBJ=~/mozilla/src/obj-browser
|
|
9 unsetmozenv() {
|
|
10 unset MOZCONFIG
|
|
11 unset MOZSOURCE
|
|
12 unset MOZOBJ
|
|
13 env | sort
|
|
14 }
|
551
|
15 MOZCONFIGS=${HOME}/mozilla/mozconfigs
|
554
|
16 MOZSRC=${HOME}/mozilla/src
|
551
|
17
|
|
18 mozconfig() {
|
|
19
|
|
20 if [ ! -e ${MOZCONFIGS} ]
|
|
21 then
|
|
22 echo "MOZCONFIGS directory ${MOZCONFIGS} does not exist"
|
|
23 return 1
|
|
24 fi
|
|
25
|
|
26 if [[ "$#" == "0" ]]
|
|
27 then
|
|
28 # list the available configs
|
|
29 ls -1 ${MOZCONFIGS} | sort
|
|
30 elif [[ "$#" == "1" ]]
|
|
31 then
|
|
32 # activate the chosen mozconfig
|
|
33 name=$1
|
|
34 for _MOZCONFIG in "${MOZCONFIGS}/${name}" "${MOZCONFIGS}/mozconfig.${name}"
|
|
35 do
|
553
|
36 if [[ -e "${_MOZCONFIG}" ]]
|
|
37 then
|
|
38 break
|
|
39 fi
|
551
|
40 done
|
553
|
41 if [[ ! -e "${_MOZCONFIG}" ]]
|
|
42 then
|
|
43 echo "MOZCONFIG ${name} not found"
|
|
44 return 1
|
|
45 fi
|
554
|
46
|
|
47 # get name of file
|
|
48 filename=$(basename $_MOZCONFIG)
|
|
49 if [[ "${filename}" == *.* ]]
|
|
50 then
|
|
51 name="${filename##*.}"
|
|
52 prefix="${name}"
|
|
53 else
|
|
54 name=".default."
|
|
55 prefix="obj"
|
|
56 fi
|
|
57
|
|
58 # set environment variables
|
|
59 export MOZCONFIG=${_MOZCONFIG}
|
|
60
|
|
61 # print info
|
|
62 echo "Using MOZCONFIG=${MOZCONFIG} [${name}] :"
|
|
63 cat "${MOZCONFIG}"
|
551
|
64 else
|
|
65 # print usage
|
|
66 echo "Usage: mozconfig <configname>"
|
|
67 return 1
|
|
68 fi
|
|
69
|
|
70 } |