| #!/bin/sh |
| # Copyright 2019 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. |
| |
| user=root |
| owner_id="$(dbus-send \ |
| --system \ |
| --dest=org.chromium.SessionManager \ |
| --print-reply \ |
| --type=method_call \ |
| /org/chromium/SessionManager \ |
| org.chromium.SessionManagerInterface.RetrievePrimarySession \ |
| | awk 'NR==3' \ |
| | cut -d "\"" -f2)" |
| if [ -z "${owner_id}" ]; then |
| echo "$0: Could not connect, cannot get owner_id" >&2 |
| exit 1 |
| fi |
| vm_name=arcvm |
| |
| # TODO(b/147857453): Use /system/bin/runcon. |
| |
| exec /usr/bin/vsh \ |
| --user="${user}" --owner_id="${owner_id}" --vm_name="${vm_name}" -- \ |
| /system/bin/env -i \ |
| ANDROID_ASSETS=/assets \ |
| ANDROID_DATA=/data \ |
| ANDROID_ROOT=/system \ |
| ANDROID_STORAGE=/storage \ |
| ASEC_MOUNTPOINT=/mnt/asec \ |
| EXTERNAL_STORAGE=/sdcard \ |
| PATH=/sbin:/vendor/bin:/system/bin:/system/xbin \ |
| /system/bin/sh "$@" |