| # Copyright 2018 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 "Set up esdfs directories" |
| author "chromium-os-dev@chromium.org" |
| |
| # This job is started via arc-boot-continue.conf. |
| # The job runs "forever". |
| # See: http://upstart.ubuntu.com/cookbook/#jobs-that-run-forever |
| import CONTAINER_PID |
| |
| 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 "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 |