Skip to content

Commit

Permalink
fix: build script incorrect path (#426)
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Alvarez <[email protected]>
pendo324 authored Nov 15, 2024

Verified

This commit was signed with the committer’s verified signature.
ekohl Ewoud Kohl van Wijngaarden
1 parent 1014e47 commit 5ab4908
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions bin/lima-and-qemu.pl
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
# This script creates a tarball containing lima and qemu, plus all their
# dependencies from /usr/local/** or /opt/homebrew/.
# Files opened by limactl and qemu are captured using https://github.com/objective-see/FileMonitor
# `limactl start examples/alpine.yaml; limactl stop alpine; limactrl delete alpine`.
# `limactl start templates/alpine.yaml; limactl stop alpine; limactrl delete alpine`.

# {"event":"ES_EVENT_TYPE_NOTIFY_WRITE","timestamp":"2022-11-02 02:19:42 +0000","file":
# {"destination":"/Users/siravara/.lima/default/cidata.iso","
@@ -50,14 +50,26 @@
sleep(1) until -s $filemonitor;

my $repo_root = join('/', dirname($FindBin::Bin), 'src', 'lima');
for my $example (@ARGV) {
my $config = "$repo_root/examples/$example.yaml", ;
my $templatedir = "$repo_root/templates";
if (qx"limactl --version" =~ m/^limactl version (\d+)\.(\d+)\.(\d+)(-.*)*$/) {
# version 1.0.0-alpha.0 was the last one with the old directory structure
if ($1 le 0 or ($1 eq 1 and $4 eq "-alpha.0")) {
print "limactl version ($1.$2.$3$4), falling back to pre-1.0 templatedir\n";
$templatedir = "$repo_root/examples";
}
} else {
print "unknown limactl version, falling back to pre-1.0 templatedir\n";
$templatedir = "$repo_root/examples";
}

for my $template (@ARGV) {
my $config = "$templatedir/$template.yaml", ;
die "Config $config not found" unless -f $config;
system("limactl delete -f $example") if -d "$ENV{HOME}/.lima/$example";
system("limactl delete -f $template") if -d "$ENV{HOME}/.lima/$template";
system("limactl start --tty=false $config");
system("limactl shell $example uname");
system("limactl stop $example");
system("limactl delete $example");
system("limactl shell $template uname");
system("limactl stop $template");
system("limactl delete $template");
}
system("sudo pkill FileMonitor");

0 comments on commit 5ab4908

Please sign in to comment.