]> git.proxmox.com Git - pve-container.git/commitdiff
check sh instead of file for templates architecture type
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 22 Jan 2016 17:34:57 +0000 (18:34 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Sat, 23 Jan 2016 07:54:34 +0000 (08:54 +0100)
/usr/bin/file may not be available, while that has no high
probability we already had bug reports regarding this.

To ensure better compatibility use /bin/sh which every Linux
has (POSIX 1003.1-2004).

See: http://pubs.opengroup.org/onlinepubs/009695399/utilities/sh.html

src/PVE/LXC/Create.pm

index c24bd80228be3c9ef0d2d51da3533a4c3bfa7ded..56ef471e31c918cc7de679e31dbc5c2eef4293b3 100644 (file)
@@ -51,7 +51,7 @@ sub restore_archive {
     die $@ if $@ && !$no_unpack_error;
     
     # determine file type of /usr/bin/file itself to get guests' architecture
-    $cmd = [@$userns_cmd, '/usr/bin/file', '-b', '-L', "$rootdir/usr/bin/file"];
+    $cmd = [@$userns_cmd, '/usr/bin/file', '-b', '-L', "$rootdir/bin/sh"];
     PVE::Tools::run_command($cmd, outfunc => sub {
        shift =~ /^ELF (\d{2}-bit)/; # safely assumes x86 linux
        my $arch_str = $1;