blob: 0acce644660d08724abddc52301ec88a79ab5de9 [file] [log] [blame]
# Copyright 2016 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 "Run ureadahead for ARC++"
author "chromium-os-dev@chromium.org"
# Run this job in parallel with arc_setup_wrapper.sh run_oci hook. The job
# shouldn't be started until 'ureadahead' (which may be in tracing mode)
# is stopped, otherwise ureadahead may corrupt the $PACK file. Depending
# on start-arc-instance ensures that.
start on start-arc-instance
import DISABLE_UREADAHEAD
script
{
PACK=/opt/google/containers/android/ureadahead.pack
echo "Start arc-ureadahead"
set -x
# Read-ahead files in the image.
if [ -f "${PACK}" ]; then
if [ "${DISABLE_UREADAHEAD}" = "1" ]; then
logger -t "${UPSTART_JOB}" "Ureadahead is disabled"
else
ureadahead --pack-file="${PACK}" || \
echo "Failed to start ureadahead pack for ${PACK}"
fi
else
echo "ureadahead pack is not available at ${PACK}"
fi
} 2>&1 | logger -t "${UPSTART_JOB}"
end script