1#!/usr/bin/env bash 2# Copyright 2022 The ChromiumOS Authors 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6# Ensure there's only 1 instance of setup-user.sh running 7flock /tmp/entrypoint_lock /tools/setup-user.sh 8 9# Give KVM device correct permission 10if [ -e "/dev/kvm" ]; then 11 chmod 666 /dev/kvm 12fi 13 14# Give a vhost device correct permission 15if [ -e "/dev/vhost-vsock" ]; then 16 chmod 666 /dev/vhost-vsock 17fi 18 19# Run provided command or interactive shell 20if [[ $# -eq 0 ]]; then 21 sudo -u crosvmdev /bin/bash -l 22else 23 # Use "@Q" expansion to correctly quote the arguments. 24 # For more details, see the "${parameter@operator}" section of 25 # https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html. 26 sudo -u crosvmdev /bin/bash -l -c "${*@Q}" 27fi 28