blob: 76e0ccead7fd3b880bd90374b38856f25d11d59c [file] [log] [blame]
# 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 post-mount-encrypted import data."
author "chromium-os-dev@chromium.org"
# This job handles delayed copying of CRX files into the CRX cache in a
# validated way. This is normally only performed on first boot, and so
# will be a nearly null operation after that.
start on started system-services
script
# If this is a factory installer image, don't run at all.
if [ -f /root/.factory_installer ]; then
exit 0
fi
# Note these paths are shared with platform/init/chromeos-cleanup-logs.
FROM=/mnt/stateful_partition/unencrypted/import_extensions
TO=/var/cache/external_cache
VALIDATION=/usr/share/import_extensions/validation
if [ ! -d "${TO}" ]; then
mkdir -m 700 "${TO}"
# If the source directory exists, and we can validate it... import.
if [ -d "${FROM}" ]; then
for val in "${VALIDATION}"/*; do
# If the import fails, we want to just keep going.
logger -t "${UPSTART_JOB}" "Performing CRX import for: ${val}"
encrypted_import "${FROM}" "${val}" "${TO}" 2>&1 | \
logger -t "${UPSTART_JOB}"
done
else
logger -t "${UPSTART_JOB}" "CRX Source not present. No import performed."
fi
chown -R chronos:chronos "${TO}"
else
logger -t "${UPSTART_JOB}" "CRX Cache exists. No import performed."
fi
# This .dot file tells the cache manager in Chrome that the import process
# has finished. It should be created, even if we weren't actually able to
# import anything.
touch "${TO}/.initialized"
end script