flatcar-scripts/mod_for_factory_scripts/200patchInitScript
Nick Sanders c750ac2c4d crosutils/mod_for_factory_scripts: don't change VT on factory service stop
In http://codereview.chromium.org/6567004 in order to help developers stopping
factory UI, we've added an "chvt 2". However changing foreground terminal may
hang when executing "shutdown -r" inside Wipe test.

Removing the "chvt" call solved this issue. The only side effect is that
developers executing "initctl stop factory" may end seeing a black scren - and
they need to hit Ctrl-Alt-F2 to get the console back.

BUG=chrome-os-partner:2631
TEST=build a factory image then verified following steps:
     (1) in VT2, do "initctl stop factory, then C-A-F2: screen changed to VT2.
     (2) Execute factory tests until Wipe: reboots immediately when X closed
     (3) Execute Reboot in HWID test: reboots immediately when 'reboot' is ACTIVE

Change-Id: Ib6f44a6ad07db08862929179d0fe21cbbcc2b22a

Review URL: http://codereview.chromium.org/6621041
2011-03-07 10:06:31 -08:00

101 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# Copyright (c) 2010 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.
echo "Applying patch to init scripts."
touch "${ROOT_FS_DIR}/root/.factory_test"
patch -d "${ROOT_FS_DIR}" -Np1 <<EOF
--- old/etc/init/ui.conf 2010-04-28 21:28:38.886069000 -0700
+++ new/etc/init/ui.conf 2010-04-28 21:29:42.676163000 -0700
@@ -11 +11 @@
-start on stopping startup
+start on never
EOF
patch -d "${ROOT_FS_DIR}" -Np1 <<EOF
diff -Naur old/etc/init/boot-complete.conf new/etc/init/boot-complete.conf
--- old/etc/init/boot-complete.conf 2010-07-21 11:22:30.000000000 +0800
+++ new/etc/init/boot-complete.conf 2010-07-21 22:13:36.000000000 +0800
@@ -15 +15 @@
-start on login-prompt-visible
+start on started udev
EOF
cat >"${ROOT_FS_DIR}/etc/init/factory.conf" <<EOF
# Copyright (c) 2010 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 stopped udev-addon
stop on starting halt or starting reboot
script
cd /usr/local/autotest
eval \$(./site_tests/suite_Factory/startx.sh)
date >>/var/log/factory.log
if [ ! -e factory_started ]; then
touch factory_started
cp -f site_tests/suite_Factory/control .
./bin/autotest -t factory control >>/var/log/factory.log 2>&1
else
./bin/autotest -t factory -c control >>/var/log/factory.log 2>&1
fi
end script
pre-stop script
pkill python
pkill X
end script
EOF
cat >"${ROOT_FS_DIR}/etc/init/factorylog.conf" <<EOF
# Copyright (c) 2010 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 "Print Chrome OS factory log to tty3"
author "chromium-os-dev@chromium.org"
start on started factory
stop on starting halt or starting reboot
respawn
script
tail -n 48 -F /var/log/factory.log >/dev/tty3
end script
EOF
if [ -r "${ROOT_FS_DIR}/etc/init/chrontel.conf" ]; then
patch -d "${ROOT_FS_DIR}" -Np1 <<EOF
diff -Nau old/etc/init/chrontel.conf new/etc/init/
--- old/etc/init/chrontel.conf 2010-08-05 16:32:55.000000000 -0700
+++ new/etc/init/chrontel.conf 2010-08-05 16:32:45.000000000 -0700
@@ -7 +7 @@
-start on started udev
+start on never
EOF
fi
if [ -r "${ROOT_FS_DIR}/etc/init/nvrm.conf" ]; then
patch -d "${ROOT_FS_DIR}" -Np1 << EOF
--- old/etc/init/nvrm.conf 2010-11-19 14:57:16.000000000 -0800
+++ new/etc/init/nvrm.conf 2010-11-19 16:52:48.000000000 -0800
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-start on starting ui
+start on starting factory
respawn
EOF
fi