]> git.proxmox.com Git - pve-common.git/commitdiff
new helper get_host_arch
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 20 Sep 2018 04:21:55 +0000 (06:21 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 20 Sep 2018 04:21:55 +0000 (06:21 +0200)
src/PVE/Tools.pm

index 06da78be0d38a8ecc465d9a1363628b46e5cfb53..d4ab2ad30c41b6c3be8119749512b3ed44085a86 100644 (file)
@@ -1613,4 +1613,18 @@ sub readline_nointr {
     return $line;
 }
 
     return $line;
 }
 
+sub get_host_arch {
+
+    my @uname = POSIX::uname();
+    my $machine = $uname[4];
+
+    if ($machine eq 'x86_64') {
+       return 'amd64';
+    } elsif ($machine eq 'aarch64') {
+       return 'arm64';
+    } else {
+       die "unsupported host architecture '$machine'\n";
+    }
+}
+
 1;
 1;