mirror of
https://git.proxmox.com/git/pve-common
synced 2025-05-30 10:49:22 +00:00
tools: get_host_arch: return raw uname machine entry
The current version had only one user in LXC, so move the LXC-specific code there to reuse this in QemuServer. Also cache, since the host's architecture can't change during runtime. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
parent
a79f03d9a6
commit
ce007e99ff
@ -47,6 +47,7 @@ safe_print
|
|||||||
trim
|
trim
|
||||||
extract_param
|
extract_param
|
||||||
file_copy
|
file_copy
|
||||||
|
get_host_arch
|
||||||
O_PATH
|
O_PATH
|
||||||
O_TMPFILE
|
O_TMPFILE
|
||||||
);
|
);
|
||||||
@ -1630,18 +1631,10 @@ sub readline_nointr {
|
|||||||
return $line;
|
return $line;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_host_arch {
|
my $host_arch;
|
||||||
|
sub get_host_arch() {
|
||||||
my @uname = POSIX::uname();
|
$host_arch = (POSIX::uname())[4] if !$host_arch;
|
||||||
my $machine = $uname[4];
|
return $host_arch;
|
||||||
|
|
||||||
if ($machine eq 'x86_64') {
|
|
||||||
return 'amd64';
|
|
||||||
} elsif ($machine eq 'aarch64') {
|
|
||||||
return 'arm64';
|
|
||||||
} else {
|
|
||||||
die "unsupported host architecture '$machine'\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Devices are: [ (12 bits minor) (12 bits major) (8 bits minor) ]
|
# Devices are: [ (12 bits minor) (12 bits major) (8 bits minor) ]
|
||||||
|
Loading…
Reference in New Issue
Block a user