| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 XAUTH_FILE="/var/run/chromelogin.auth" | 7 XAUTH_FILE="/var/run/chromelogin.auth" |
| 8 SERVER_READY= | 8 SERVER_READY= |
| 9 | 9 |
| 10 user1_handler () { | 10 user1_handler () { |
| 11 echo "received SIGUSR1!" | 11 echo "received SIGUSR1!" |
| 12 SERVER_READY=y | 12 SERVER_READY=y |
| 13 } | 13 } |
| 14 | 14 |
| 15 trap user1_handler USR1 | 15 trap user1_handler USR1 |
| 16 MCOOKIE=$(head -c 8 /dev/random | openssl md5) | 16 MCOOKIE=$(head -c 8 /dev/urandom | openssl md5) # speed this up? |
| 17 /usr/bin/xauth -q -f ${XAUTH_FILE} add :0 . ${MCOOKIE} | 17 /usr/bin/xauth -q -f ${XAUTH_FILE} add :0 . ${MCOOKIE} |
| 18 | 18 |
| 19 /etc/init.d/xstart.sh ${XAUTH_FILE} $$& | 19 /etc/init.d/xstart.sh ${XAUTH_FILE} & |
| 20 | 20 |
| 21 while [ -z ${SERVER_READY} ]; do | 21 while [ -z ${SERVER_READY} ]; do |
| 22 sleep .1 | 22 sleep .1 |
| 23 done | 23 done |
| 24 | 24 |
| 25 # TODO: move this to a more appropriate place, once we actually start | 25 export USER=chronos |
| 26 # doing login for real in this code pathway. | 26 export DATA_DIR=/home/${USER} |
| 27 /sbin/initctl emit login-prompt-ready & | 27 mkdir -p ${DATA_DIR} && chown ${USER}:admin ${DATA_DIR} |
| 28 su chronos -c "/etc/init.d/start_login.sh ${MCOOKIE}" | 28 exec su ${USER} -c "/etc/init.d/start_login.sh ${MCOOKIE}" |
| 29 | 29 |
| OLD | NEW |