Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
lima-vm
GitHub Repository: lima-vm/lima
Path: blob/master/hack/test-mount-home.sh
1637 views
1
#!/usr/bin/env bash
2
3
# SPDX-FileCopyrightText: Copyright The Lima Authors
4
# SPDX-License-Identifier: Apache-2.0
5
6
set -eu -o pipefail
7
8
scriptdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
# shellcheck source=common.inc.sh
10
source "${scriptdir}/common.inc.sh"
11
12
if [ "$#" -ne 1 ]; then
13
ERROR "Usage: $0 NAME"
14
exit 1
15
fi
16
17
NAME="$1"
18
hometmp="${HOME_HOST:-$HOME}/lima-test-tmp"
19
hometmpguest="${HOME_GUEST:-$HOME}/lima-test-tmp"
20
INFO "Testing home access (\"$hometmp\")"
21
rm -rf "$hometmp"
22
mkdir -p "$hometmp"
23
defer "rm -rf \"$hometmp\""
24
echo "random-content-${RANDOM}" >"$hometmp/random"
25
expected="$(cat "$hometmp/random")"
26
got="$(limactl shell "$NAME" cat "$hometmpguest/random")"
27
INFO "$hometmp/random: expected=${expected}, got=${got}"
28
if [ "$got" != "$expected" ]; then
29
ERROR "Home directory is not shared?"
30
exit 1
31
fi
32
33