On 01/22/15 at 03:26pm, Dave Young wrote:
On 01/15/15 at 07:27pm, Minfei Huang wrote:
> Add a new lib to check whether the parameter is ipv4 or ipv6. Return
> true, if the parameter is ipv6, otherwise return false.
>
> Add a new lib to check whether the parameter is hostname/domain. Return
> turn, if the parameter is hostname/domain, otherwise return false.
>
> Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
> ---
> kdump-lib.sh | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/kdump-lib.sh b/kdump-lib.sh
> index 6ca2b3a..cb1bab7 100755
> --- a/kdump-lib.sh
> +++ b/kdump-lib.sh
> @@ -179,6 +179,12 @@ get_ip_address()
> echo $_ip_address
> }
>
> +is_ipv6_address()
> +{
> + local _server=$(get_ip_address $1)
> + echo $_server | grep -q ":"
> +}
> +
For the functions in kdump-lib, a function comment is necessary
so that we know what is the input, what is the expected output
Thanks.
Will attach the decription in the next version.
Thanks
Minfei
> # check the remote server ip address tpye
> is_ipv6_target()
> {
> @@ -195,3 +201,17 @@ is_ipv6_target()
>
> echo $(get_ip_address $_target) | grep -q ":"
> }
> +
> +is_hostname()
Function description is necessary
> +{
> + local _hostname=`echo $1 | grep ":"`
> +
> +# ipv6 address
Indent issue.
> + if [ -n "$_hostname" ]; then
> + return 1
> + else
> +# if contains the character, it is hostname,
> +# otherwise is ipv4 address
Ditto
> + echo $1 | grep -q "[a-zA-Z]"
> + fi
> +}
> --
> 1.9.3
>
> _______________________________________________
> kexec mailing list
> kexec(a)lists.fedoraproject.org
>
https://lists.fedoraproject.org/mailman/listinfo/kexec
>
>