$plugin->{host_localtime} = $1;
# pass on user namespace information:
- my ($id_map, $rootuid, $rootgid) = PVE::LXC::parse_id_maps($conf);
+ my ($id_map, $root_uid, $root_gid) = PVE::LXC::parse_id_maps($conf);
if (@$id_map) {
$plugin->{id_map} = $id_map;
- $plugin->{rootuid} = $rootuid;
- $plugin->{rootgid} = $rootgid;
+ $plugin->{root_uid} = $root_uid;
+ $plugin->{root_gid} = $root_gid;
+ }
+
+ # if arch is unset, we try to autodetect it
+ if (!defined($conf->{arch})) {
+ my $arch = eval { $self->protected_call(sub { $plugin->detect_architecture() }) };
+
+ if (my $err = $@) {
+ warn "Architecture detection failed: $err" if $err;
+ }
+
+ if (!defined($arch)) {
+ $arch = 'amd64';
+ print "Falling back to $arch.\nUse `pct set VMID --arch ARCH` to change.\n";
+ } else {
+ print "Detected container architecture: $arch\n";
+ }
+
+ $conf->{arch} = $arch;
}
return $self;
my ($self) = @_;
my $init = $self->protected_call(sub {
- my $init_path = "/sbin/init";
- if ($self->{plugin}->ct_is_symlink($init_path)) {
- $init_path = $self->{plugin}->ct_readlink($init_path);
- }
- return $init_path;
+ return $self->{plugin}->get_ct_init_path();
});
return $init;