Skip to content

Commit 8fa183b

Browse files
committed
Add cosa supermin-run
This is very close to `cosa supermin-shell` but instead expects a command to run inside the supermin VM. Essentially, it's a very thin wrapper around the `runvm` family of functions in `cmdlib.sh`. By having it be a dedicated function, it becomes like a utility command to have easy access to a privileged environment, with the working dir automatically mounted in, podman remote proxying, etc... Note also this *does not* require a cosa workdir. The podman machine OS pipeline will be using this temporarily.
1 parent 3ab61dd commit 8fa183b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/cmd-supermin-run

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
set -eou pipefail
3+
4+
dn=$(dirname "$0")
5+
# shellcheck source=src/cmdlib.sh
6+
. "${dn}"/cmdlib.sh
7+
8+
if [ ! -d tmp ]; then
9+
echo 'Need tmp/ dir for supermin to work' >&2
10+
exit 1
11+
fi
12+
13+
workdir=$(pwd)
14+
export workdir
15+
16+
case "${CACHE:-}" in
17+
"") RUNVM=runvm;;
18+
on) RUNVM=runvm_with_cache;;
19+
snapshot) RUNVM=runvm_with_cache_snapshot;;
20+
*) echo "CACHE=$CACHE is invalid" >&2; exit 1;;
21+
esac
22+
23+
$RUNVM -- "$@"

0 commit comments

Comments
 (0)