Hi,

On Fri, Jul 17, 2020 at 06:02:31PM +0200, Antonio Quartulli wrote:
> Right now t_net.sh depends on t_client.rc in order to source the
> RUN_SUDO variable only.

I was about to merge this ("nice and easy") but I think it's just
complicated.

> diff --git a/tests/t_net.sh b/tests/t_net.sh
> index c67c3df2..63732db9 100755
> --- a/tests/t_net.sh
> +++ b/tests/t_net.sh
> @@ -77,9 +77,7 @@ if [ -r "${top_builddir}"/t_client.rc ]; then
>  elif [ -r "${srcdir}"/t_client.rc ]; then
>      . "${srcdir}"/t_client.rc
>  else
> -    echo "$0: cannot find 't_client.rc' in build dir ('${top_builddir}')" >&2
> -    echo "$0: or source directory ('${srcdir}'). SKIPPING TEST." >&2
> -    exit 77
> +    RUN_SUDO="${RUN_SUDO:-sudo}"
>  fi

Leave off the whole else clause.

>  if [ ! -x "$openvpn" ]; then
> @@ -117,8 +115,7 @@ else
>  
>      if [ -z "$RUN_SUDO" ]
>      then
> -        echo "$0: this test must run be as root, or RUN_SUDO=... " >&2
> -        echo "      must be set correctly in 't_client.rc'. SKIP." >&2
> +        echo "$0: using t_client.rc, but RUN_SUDO=... is not defined 
> correctly. SKIP. " >&2
>          exit 77

In here, print & set

      if [ -z "$RUN_SUDO" ]
      then
 +        echo "$0: no RUN_SUDO=... in t_client.rc or environment, defaulting 
to 'sudo'." >&2
 +        echo "      if that does not work, set RUN_SUDO= correctly for your 
system." >&2
 +        RUN_SUDO=sudo"
      fi

done - less code, message conveyed if needed.
  
gert
-- 
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             g...@greenie.muc.de

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to