From fd24be8d963314d6a3fa15c437f7e955ee8300c7 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 16 May 2023 16:57:38 +0200 Subject: [PATCH] nocloud: create temp mount dir under /run The /run is usually a tmpfs which is automatically removed on reboot. Use this for the temp mount dir so we don't leave any /mnt/cidata-* temp leftovers. Also explicitly create the parent directory of the temp dir, which may no exist. This solved a weird case where running tests locally ended up hanging in mount. --- lib/tiny-cloud/cloud/nocloud/imds | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tiny-cloud/cloud/nocloud/imds b/lib/tiny-cloud/cloud/nocloud/imds index 4db1aef..0eef9bd 100644 --- a/lib/tiny-cloud/cloud/nocloud/imds +++ b/lib/tiny-cloud/cloud/nocloud/imds @@ -47,7 +47,8 @@ _load_nocloud_cmdline() { } _load_nocloud_volume() { - local mntdir=$(mktemp -d "$ROOT/mnt/cidata-XXXXXX") + mkdir -p "$ROOT"/run/tiny-cloud + local mntdir=$(mktemp -d "$ROOT/run/tiny-cloud/cidata-XXXXXX") local data mounted mkdir -p "$mntdir"