[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 10/11] Fix lopartsetup for util-linux >= 2.27.1



On Fri, 24 Mar 2017, Géza Gémes wrote:
> fdisk from util-linux >= 2.27.1 returns units in a slightly different
> structure than earlier versions
> 
> Signed-off-by: Géza Gémes <geza.gemes@xxxxxxxxx>
> ---
>  scripts/lopartsetup | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/lopartsetup b/scripts/lopartsetup
> index 04ce3cc..b675e03 100755
> --- a/scripts/lopartsetup
> +++ b/scripts/lopartsetup
> @@ -53,7 +53,23 @@ then
>      exit 1
>  fi
>  
> -unit="`fdisk -lu $filename 2>/dev/null | grep -e "^Units = " | cut -d " " -f 
> 9`"
> +unitstring=""
> +column=0
> +if [ `fdisk -lu $filename 2>/dev/null | grep -e "^Units = " | wc -l` -eq 1 ]
> +then
> +    unitstring="^Units = "
> +    column=9
> +else if [ `fdisk -lu $filename 2>/dev/null | grep -e "^Units:" | wc -l` -eq 
> 1 ]
> +then
> +    unitstring="^Units:"
> +    column=8
> +else
> +    exit 1
> +fi
> +fi

two fi?

Aside from that, the patch looks good, so I fixed it myself and
committed it.


> +unit="`fdisk -lu $filename 2>/dev/null | grep -e "$unitstring" | cut -d " " 
> -f $column`"
> +
>  index=0
>  for i in "`fdisk -lu $filename 2>/dev/null | grep -e "^$filename"`"
>  do
> -- 
> 2.7.4
> 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.