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