| # 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 "Mount /home/chronos/user/MyFiles for ARC." |
| author "chromium-os-dev@chromium.org" |
| |
| start on starting arcpp-media-sharing-services |
| stop on stopping arcpp-media-sharing-services |
| |
| # Default score for Android system processes. |
| oom score -100 |
| |
| import IS_ANDROID_CONTAINER_RVC |
| import MEDIA_PROVIDER_UID |
| |
| env SOURCE=/home/chronos/user/MyFiles |
| env DEST=/run/arc/media/MyFiles-write |
| env UMASK=007 |
| env ANDROID_ROOT_UID=0 |
| env ANDROID_EVERYBODY_GID=9997 |
| |
| pre-start exec logger -t "${UPSTART_JOB}" "Pre-start ${UPSTART_JOB}" |
| |
| script |
| optional_args="" |
| if [ "${IS_ANDROID_CONTAINER_RVC}" = "true" ]; then |
| # Verify input string provided by chronos. See crbug/1414511. |
| if ! expr "${MEDIA_PROVIDER_UID}" : "^[0-9]\+$" > /dev/null; then |
| logger -t "${UPSTART_JOB}" \ |
| "Invalid MEDIA_PROVIDER_UID: ${MEDIA_PROVIDER_UID}" |
| exit 1 |
| fi |
| optional_args="--media_provider_uid=${MEDIA_PROVIDER_UID}" |
| optional_args="${optional_args} --enable_casefold_lookup" |
| fi |
| |
| # syslog-cat is used to redirect stdio from sdcard to the logging daemon. |
| # minijail is used in the mount-passthrough-jailed script. |
| exec /usr/sbin/syslog-cat --identifier="${UPSTART_JOB}" -- \ |
| mount-passthrough-jailed --source="${SOURCE}" --dest="${DEST}" \ |
| --fuse_umask="${UMASK}" --fuse_uid="${ANDROID_ROOT_UID}" \ |
| --fuse_gid="${ANDROID_EVERYBODY_GID}" --android_app_access_type="write" \ |
| ${optional_args} |
| end script |
| |
| post-stop exec logger -t "${UPSTART_JOB}" "Post-stop ${UPSTART_JOB}" |