blob: 69ac53a8f33682dddc92fba2d56346a4a4eb2962 [file] [log] [blame]
# Copyright (c) 2014 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 "Setup autotest runtime directory."
author "chromium-os-dev@chromium.org"
start on started boot-services
script
echo 0 > /proc/sys/kernel/hung_task_timeout_secs
# TODO(sbasi) (crbug.com/345138) - Switch to running only after autoupdate
# rather than every boot.
# M56 creates a logs directory that needs to be moved out of the way so
# the simlink to /var/log/autotest can be installed. crbug/709697
# TODO(haddowk) remove this check when no one could possibly do upgrade from
# M56
AUTOTEST_DIR=/usr/local/autotest
if [ -d "${AUTOTEST_DIR}/logs" ]; then
mv "${AUTOTEST_DIR}/logs" "${AUTOTEST_DIR}/logs.$(date +%F_%R)"
fi
rsync -a /autotest/ "${AUTOTEST_DIR}/"
# If the shadow_config does no exist, create one.
if [ ! -s "${AUTOTEST_DIR}"/shadow_config.ini ]; then
cat > "${AUTOTEST_DIR}"/shadow_config.ini <<EOF
[AUTOTEST_WEB]
host: localhost
password: moblab_db_passwd
readonly_host: localhost
readonly_user: chromeosqa-admin
readonly_password: moblab_db_passwd
wmatrix_url=/wmatrix
[CROS]
dev_server: http://192.168.231.1:8080
devserver_dir: /usr/lib/devserver/
[SERVER]
hostname: localhost
[SCHEDULER]
drones: localhost
drone_build_externals: False
EOF
fi
# Make the logs directory and give ownership to moblab.
mkdir -p /var/log/autotest
chown -R moblab:moblab /var/log/autotest
chmod 660 "${AUTOTEST_DIR}"/shadow_config.ini
# Give moblab ownership of the autotest directory and make sure it has
# rights to execute the scripts.
chown -R moblab:moblab "${AUTOTEST_DIR}"
# The autotest files try to exec all sorts of scripts. The ebuild only
# installs them with 644 perms because historically the servers have just
# clobbered all the perms to +x anyways. Until we clean up the autotest
# ebuild to install files with the right perms, we have to keep this hack.
find "${AUTOTEST_DIR}" -type f ! -perm /1 -exec chmod a+x {} +
end script