open-src/xserver/xserver-common/Xserver
changeset 1018 baa7bc85407b
parent 970 272328fe1b4a
child 1097 243d7ed7a10c
equal deleted inserted replaced
1017:82e433208135 1018:baa7bc85407b
    46 CLASSES=""
    46 CLASSES=""
    47 TCP_LISTEN=""
    47 TCP_LISTEN=""
    48 SERVERARGS=""
    48 SERVERARGS=""
    49 XSERVER="/usr/bin/Xorg"
    49 XSERVER="/usr/bin/Xorg"
    50 CONSOLE=""
    50 CONSOLE=""
       
    51 CONFIG_FILE=""
    51 
    52 
    52 
    53 
    53 while getopts :c: opt; do
    54 while getopts :c: opt; do
    54     case $opt in
    55     case $opt in
    55 	c)	CLASSES+=" :${OPTARG}" ;;
    56 	c)	CLASSES+=" :${OPTARG}" ;;
   115 getprop options/default_depth DEFDEPTH
   116 getprop options/default_depth DEFDEPTH
   116 getprop options/server XSERVER
   117 getprop options/server XSERVER
   117 getprop options/server_args SERVERARGS
   118 getprop options/server_args SERVERARGS
   118 getprop options/tcp_listen TCP_LISTEN
   119 getprop options/tcp_listen TCP_LISTEN
   119 getprop options/display_0_on_console CONSOLE
   120 getprop options/display_0_on_console CONSOLE
       
   121 getprop options/config_file CONFIG_FILE
   120 
   122 
   121 ORIGINAL_XSERVER="${XSERVER}"
   123 ORIGINAL_XSERVER="${XSERVER}"
   122 
   124 
   123 if [[ -f ${XSERVER} ]] ; then
   125 if [[ -f ${XSERVER} ]] ; then
   124     # Canonicalize path, so that we don't break people who specified path
   126     # Canonicalize path, so that we don't break people who specified path
   203     CONSOLE="-C"
   205     CONSOLE="-C"
   204 else
   206 else
   205     CONSOLE=""
   207     CONSOLE=""
   206 fi
   208 fi
   207 
   209 
   208 ALLARGS="${DEPTHARG} ${LISTENARG} ${SERVERARGS} ${CONSOLE} $*"
   210 # Currently only Xorg accepts a command line flag for choosing config files.
       
   211 # If other X servers add such flags in the future, they should be added here.
       
   212 # Only filenames without directory paths are allowed (similar to when a 
       
   213 # non-root user runs Xorg -config) to avoid security issues.
       
   214 CONFIGARG=""
       
   215 if [[ ! -z "${CONFIG_FILE}" ]] ; then
       
   216     case ${CONFIG_FILE} in
       
   217 	*/*)	fatal_error "Illegal value for config_file property" ;;
       
   218     esac
       
   219     case ${XSERVER} in
       
   220 	*Xorg)	CONFIGARG="-config ${CONFIG_FILE}" ;;
       
   221     esac
       
   222 fi
       
   223 
       
   224 ALLARGS="${DEPTHARG} ${LISTENARG} ${SERVERARGS} ${CONSOLE} ${CONFIGARG} $*"
   209 
   225 
   210 exec ${XSERVER} :${DISPLAY} ${ALLARGS}
   226 exec ${XSERVER} :${DISPLAY} ${ALLARGS}