This is useful when the uploaded CT does not contain a full OS. When the autodetection detects an OS, that OS is returned. When it does not successfully detect a supported OS, but /etc/os-release exists and has an ID other than 'unmanaged', then the setup fails.
Perhaps it would be even more consistent to make 'unmanaged' a plugin next to the various OS plugins, but I wanted to keep the change as simple as possible for now. I'm afraid the whitespace gets munged by my email client, sorry about that... Signed-off-by: Arnout Engelen <arn...@bzzt.net> --- src/PVE/LXC/Setup.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm index c738e64..56ccd90 100644 --- a/src/PVE/LXC/Setup.pm +++ b/src/PVE/LXC/Setup.pm @@ -39,7 +39,7 @@ my $autodetect_type = sub { my ($self, $rootdir, $os_release) = @_; if (my $id = $os_release->{ID}) { - return $id if $plugins->{$id}; + return $id if $plugins->{$id} or $id eq "unmanaged"; return $plugin_alias->{$id} if $plugin_alias->{$id}; warn "unknown ID '$id' in /etc/os-release file, trying fallback detection\n"; } @@ -70,8 +70,11 @@ my $autodetect_type = sub { return "alpine"; } elsif (-f "$rootdir/etc/gentoo-release") { return "gentoo"; + } elsif (-f "$rootdir/etc/os-release") { + die "unable to detect OS distribution\n"; + } else { + return "unmanaged"; } - die "unable to detect OS distribution\n"; }; sub new { @@ -94,6 +97,11 @@ sub new { if $type ne $expected_type; } + if ($type eq 'unmanaged') { + $conf->{ostype} = $type; + return $self; + } + my $plugin_class = $plugins->{$type} || "no such OS type '$type'\n"; -- 2.26.2 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel