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

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Jan 22 18:36:58 CET 2016



On 01/22/2016 06:34 PM, Thomas Lamprecht wrote:
> /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/
Searching after sh leads to:

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

Silly iframes on the page...

> ---
>   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;





More information about the pve-devel mailing list