blob: 1731a25f201eb146c78b7f27edf4f00d118f5bc4 [file] [edit]
# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Set up esdfs directories"
author "chromium-os-dev@chromium.org"
# The job runs "forever".
# See: http://upstart.ubuntu.com/cookbook/#jobs-that-run-forever
import CHROMEOS_USER
import CONTAINER_PID
# Use 'never' since terminating this job fails ARC to start.
oom score never
pre-start script
{
echo "Pre-start arc-sdcard"
set -x
# Start the actual mounting process in a separate job. This allows
# arc-setup --mode=mount-sdcard to be interrupted cleanly if the container
# terminates.
exec start arc-sdcard-mount "CHROMEOS_USER=${CHROMEOS_USER}" \
"CONTAINER_PID=${CONTAINER_PID}"
} 2>&1 | logger -t "${UPSTART_JOB}"
end script
post-stop script
{
echo "Post-stop arc-sdcard"
set -x +e
# The arc-sdcard-mount job might still be running. Ensure it dies so that
# the next container invocation can continue cleanly.
stop arc-sdcard-mount
find "/sys/kernel/config/sdcardfs/" -mindepth 1 -maxdepth 1 \
-type d -not -name 'extensions' -exec rmdir {} \+
} 2>&1 | logger -t "${UPSTART_JOB}"
exec /usr/sbin/arc-setup --mode=unmount-sdcard "--log_tag=${UPSTART_JOB}"
end script