use PVE::LXC::Setup::Gentoo;
use PVE::LXC::Setup::SUSE;
use PVE::LXC::Setup::Ubuntu;
+use PVE::LXC::Setup::Unmanaged;
my $plugins = {
alpine => 'PVE::LXC::Setup::Alpine',
gentoo => 'PVE::LXC::Setup::Gentoo',
opensuse => 'PVE::LXC::Setup::SUSE',
ubuntu => 'PVE::LXC::Setup::Ubuntu',
+ unmanaged => 'PVE::LXC::Setup::Unmanaged',
};
# a map to allow supporting related distro flavours
my $os_release = $self->get_ct_os_release();
if ($conf->{ostype} && $conf->{ostype} eq 'unmanaged') {
- return $self;
+ $type = 'unmanaged';
} elsif (!defined($type)) {
# try to autodetect type
$type = &$autodetect_type($self, $rootdir, $os_release);
}
}
- if ($type eq 'unmanaged') {
- $conf->{ostype} = $type;
- return $self;
- }
-
my $plugin_class = $plugins->{$type} || die "no such OS type '$type'\n";
my $plugin = $plugin_class->new($conf, $rootdir, $os_release);
sub template_fixup {
my ($self) = @_;
-
- return if !$self->{plugin}; # unmanaged
-
$self->protected_call(sub { $self->{plugin}->template_fixup($self->{conf}) });
}
sub setup_network {
my ($self) = @_;
-
- return if !$self->{plugin}; # unmanaged
-
$self->protected_call(sub { $self->{plugin}->setup_network($self->{conf}) });
}
sub set_hostname {
my ($self) = @_;
-
- return if !$self->{plugin}; # unmanaged
-
$self->protected_call(sub { $self->{plugin}->set_hostname($self->{conf}) });
}
sub set_dns {
my ($self) = @_;
-
- return if !$self->{plugin}; # unmanaged
-
$self->protected_call(sub { $self->{plugin}->set_dns($self->{conf}) });
}
sub set_timezone {
my ($self) = @_;
-
- return if !$self->{plugin}; # unmanaged
-
$self->protected_call(sub { $self->{plugin}->set_timezone($self->{conf}) });
}
sub setup_init {
my ($self) = @_;
-
- return if !$self->{plugin}; # unmanaged
-
$self->protected_call(sub { $self->{plugin}->setup_init($self->{conf}) });
}
sub set_user_password {
my ($self, $user, $pw) = @_;
-
- return if !$self->{plugin}; # unmanaged
-
$self->protected_call(sub { $self->{plugin}->set_user_password($self->{conf}, $user, $pw) });
}
sub post_create_hook {
my ($self, $root_password, $ssh_keys) = @_;
- return if !$self->{plugin}; # unmanaged
-
$self->protected_call(sub {
$self->{plugin}->post_create_hook($self->{conf}, $root_password, $ssh_keys);
});
--- /dev/null
+package PVE::LXC::Setup::Unmanaged;
+
+use strict;
+use warnings;
+
+use PVE::LXC::Setup::Plugin;
+use base qw(PVE::LXC::Setup::Plugin);
+
+sub new {
+ my ($class, $conf, $rootdir) = @_;
+
+ my $self = { conf => $conf, rootdir => $rootdir };
+
+ $conf->{ostype} = "unmanaged";
+
+ return bless $self, $class;
+}
+
+sub template_fixup {
+ my ($self, $conf) = @_;
+}
+
+sub setup_network {
+ my ($self, $conf) = @_;
+}
+
+sub set_hostname {
+ my ($self, $conf) = @_;
+}
+
+sub set_dns {
+ my ($self, $conf) = @_;
+}
+
+sub set_timezone {
+ my ($self, $conf) = @_;
+}
+
+sub setup_init {
+ my ($self, $conf) = @_;
+}
+
+sub set_user_password {
+ my ($self, $conf, $user, $opt_password) = @_;
+}
+
+sub unified_cgroupv2_support {
+ my ($self) = @_;
+ return 1; # faking it won't normally hurt ;-)
+}
+
+sub ssh_host_key_types_to_generate {
+ my ($self) = @_;
+}
+
+# hooks
+
+sub pre_start_hook {
+ my ($self, $conf) = @_;
+}
+
+sub post_clone_hook {
+ my ($self, $conf) = @_;
+}
+
+sub post_create_hook {
+ my ($self, $conf, $root_password, $ssh_keys) = @_;
+}
+
+1;