[pve-devel] [PATCH container] check sh instead of file for templates architecture type

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Jan 22 18:34:57 CET 2016


/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/
---
 src/PVE/LXC/Create.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Create.pm b/src/PVE/LXC/Create.pm
index c24bd80..56ef471 100644
--- a/src/PVE/LXC/Create.pm
+++ b/src/PVE/LXC/Create.pm
@@ -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;
-- 
2.1.4





More information about the pve-devel mailing list