| # Copyright 2020 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 "Mount the removable media directory using mount-passthrough." |
| author "chromium-os-dev@chromium.org" |
| |
| start on starting arcvm-post-login-services |
| stop on stopping arcvm-post-login-services |
| |
| # Do not allow OOM killer to terminate this job since it will break file |
| # sharing support (which e.g. our Photos app relies on) until ARCVM restarts. |
| # TODO(b/164939771): Choose a better OOM score which guarantees the Chrome |
| # browser process is always terminated before this one. |
| oom score never |
| |
| # Set VM size soft limit to 1 GB. See arcvm-mount-myfiles.conf for rationale. |
| # TODO(b/164936284): Specify a lower limit after improving mount-passthrough. |
| limit as 1000000000 unlimited |
| |
| expect fork |
| |
| env SOURCE=/media/removable |
| env DEST=/run/arcvm/media/removable |
| env UMASK=007 |
| env ANDROID_ROOT_UID=0 |
| env ANDROID_EXTERNAL_STORAGE_GID=1077 |
| |
| pre-start exec nsenter --mount=/run/namespaces/mnt_concierge --no-fork \ |
| -- mkdir -p "${DEST}" |
| |
| exec nsenter --mount=/run/namespaces/mnt_concierge --no-fork \ |
| -- /usr/sbin/syslog-cat --identifier="${UPSTART_JOB}" -- \ |
| mount-passthrough-jailed "${SOURCE}" "${DEST}" "${UMASK}" \ |
| "${ANDROID_ROOT_UID}" "${ANDROID_EXTERNAL_STORAGE_GID}" "full" |
| |
| post-stop script |
| # Termination by SIGKILL can result in a stale mount which needs clean-up. |
| nsenter --mount=/run/namespaces/mnt_concierge --no-fork \ |
| -- umount "${DEST}" || true |
| end script |