Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/include/common.global.class.in

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

revision 2485 by niro, Thu Sep 10 12:29:57 2015 UTC revision 2767 by niro, Wed Feb 10 15:26:23 2016 UTC
# Line 149  clearconfig() Line 149  clearconfig()
149  # this wrapper runs a command in the xsession of the unpriv_user  # this wrapper runs a command in the xsession of the unpriv_user
150  x11runas()  x11runas()
151  {  {
152   if [[ -n $(pidof X) ]] || [[ -n $(pidof Xorg) ]]   if [[ -n $(pidof X) ]] || [[ -n $(pidof Xorg) ]] || [[ -n $(pidof Xorg.bin) ]]
153   then   then
154   su - "${MCORE_UNPRIV_USER}" -c "DISPLAY=${MCORE_XORG_DISPLAY} $@"   su - "${MCORE_UNPRIV_USER}" -c "DISPLAY=${MCORE_XORG_DISPLAY} $@"
155     else
156     decho "x11runas(): No running X, Xorg or Xorg.bin process found"
157   fi   fi
158  }  }
159    
# Line 400  nsslsay_queue_run_fingerprint() Line 402  nsslsay_queue_run_fingerprint()
402  {  {
403   nsslsay_fingerprint "$(nsslsay_queue_print)"   nsslsay_fingerprint "$(nsslsay_queue_print)"
404  }  }
405    
406    # read_cmdline "$variable"
407    # eg: read_cmdline "lang="
408    #       returns the value of the cmdline variable lang
409    # eg: read_cmdline "rd.info"
410    #      returns bool 1 if the variable was defined
411    #
412    read_cmdline()
413    {
414     local variable="$1"
415     local retval
416     local i
417    
418     if [[ -z ${variable} ]]
419     then
420     eecho "no variable given"
421     return 1
422     fi
423    
424     if [ ! -e /proc/cmdline ]
425     then
426     eecho "read_cmdline(): /proc/cmdline does not exists"
427     return 1
428     fi
429    
430     for i in $(</proc/cmdline)
431     do
432     if [[ ${i} = ${variable}* ]]
433     then
434     case ${variable} in
435     *=*) retval="${i#*=}" ;;
436     *) retval=1 ;; # bool
437     esac
438     fi
439     done
440    
441     echo "${retval}"
442     return 0
443    }

Legend:
Removed from v.2485  
changed lines
  Added in v.2767