blob: f3beb0b93dca981668a38842cd9ce4f4ff1c3cc5 [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.
AUTOTEST_DIR=/usr/local/autotest
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