Magellan Linux

Diff of /trunk/include/mozilla.sminc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/core/include/mozilla.sminc revision 2861 by niro, Sun Jul 12 16:33:09 2009 UTC trunk/include/mozilla.sminc revision 15843 by niro, Fri Jan 11 09:31:10 2013 UTC
# Line 69  makemake2() Line 69  makemake2()
69    
70  msetpref()  msetpref()
71  {  {
72   : ${MOZILLA_PREF_CONFIG="magellan.js"}   : ${MOZILLA_PREF_CONFIG="01-magellan.js"}
73   : ${MOZILLA_PREF_PATH="/usr/$(mlibdir)/mozilla-firefox/defaults/pref"}   : ${MOZILLA_PREF_PATH="/usr/$(mlibdir)/${PNAME}/defaults/preferences"}
74   local pref   local pref="$1"
75   local value   local value="$2"
76    
77   [[ -z ${pref} ]] && die "msetpref(): no \$pref given"   [[ -z ${pref} ]] && die "msetpref(): no \$pref given"
78    
79   if [[ ${pref} = --init ]]   if [[ ${pref} = --init ]]
80   then   then
81   # only create an empty config   # only create an empty config
82     if [[ ! -d ${BINDIR}/${MOZILLA_PREF_PATH} ]]
83     then
84     install -d ${BINDIR}/${MOZILLA_PREF_PATH} || die
85     fi
86   :> ${BINDIR}/${MOZILLA_PREF_PATH}/${MOZILLA_PREF_CONFIG} || die   :> ${BINDIR}/${MOZILLA_PREF_PATH}/${MOZILLA_PREF_CONFIG} || die
87   else   else
88   # write a pref value   # write a pref value
89   [[ -z ${value} ]] && die "msetpref(): no \$value given"   [[ -z ${value} ]] && die "msetpref(): no \$value given"
90    
91   # handle escaped strings:   # handle escaped strings:
92    
93   # check if value is an integer -> no escaping   # check if value is an integer -> no escaping
94   if printf "%d" ${value} > /dev/null 2>&1   #if printf "%d" ${value} > /dev/null 2>&1
95     # the better way (only use one! bracket!!)
96     if [ "${value}" -eq "${value}" ] > /dev/null 2>&1
97   then   then
98   value="${value}"   value="${value}"
99    
100   # check for "false" or "true" -> no escaping   # check for "false" or "true" -> no escaping
101   elif [[ ${value} = false ]] || [[ ${value} = true ]]   elif [[ ${value} = false ]] || [[ ${value} = true ]]
102     then
103   value="${value}"   value="${value}"
104    
105   # all other values needs escaping   # all other values needs escaping
# Line 101  msetpref() Line 109  msetpref()
109    
110   # eg:   # eg:
111   # pref("general.useragent.vendor","Magellan-Linux");   # pref("general.useragent.vendor","Magellan-Linux");
112   echo "pref(\"${pref}\",${value});" >> ${BINDIR}/${MOZILLA_PREF_PATH}/${MOZILLA_PREF_CONFIG} || die   echo "pref(\"${pref}\", ${value});" >> ${BINDIR}/${MOZILLA_PREF_PATH}/${MOZILLA_PREF_CONFIG} || die
113   fi   fi
114  }  }

Legend:
Removed from v.2861  
changed lines
  Added in v.15843