| # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Chrome OS factory startup stub" |
| author "chromium-os-dev@chromium.org" |
| |
| start on started system-services |
| stop on stopping system-services |
| |
| pre-start script |
| . /usr/share/cros/factory_utils.sh |
| if ! is_factory_mode; then |
| stop |
| fi |
| end script |
| |
| script |
| FACTORY_BASE=/usr/local/factory |
| TTY_VT=4 |
| TTY="/dev/tty$TTY_VT" |
| |
| (tput clear; echo -n "--- Starting Factory --- "; date) >$TTY |
| chvt $TTY_VT |
| # Sleep briefly for chvt to take effect and for the displayed |
| # messages to be seen |
| sleep .3 |
| "$FACTORY_BASE/bin/goofy_control" start >$TTY || true |
| |
| # This should never happen, since goofy never returns. Kill X |
| # and display an error on $TTY |
| ( |
| echo -n "--- Factory Aborted --- " |
| date |
| "$FACTORY_BASE/bin/goofy_control" stop |
| ) >$TTY |
| chvt $TTY_VT |
| end script |
| |
| pre-stop script |
| # Stops UI before we kill X |
| stop ui |
| pkill python |
| pkill X |
| end script |