<br><br>On Thursday, 25 April 2019, Hans Dedecker <<a href="mailto:dedeckeh@gmail.com">dedeckeh@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Yousong,<br>
<br>
On Thu, Apr 25, 2019 at 4:29 PM Yousong Zhou <<a href="mailto:yszhou4tech@gmail.com">yszhou4tech@gmail.com</a>> wrote:<br>
><br>
> Before this change, we have no way to have network on as both bash and<br>
> zsh have zero exit status for "[ -n ]" and "[ -z ]"<br>
><br>
> By running qemu without network by default we make common usage of and<br>
> first encounter with qemustart script more comfortable.  With networking<br>
> only two characters argument away.<br>
><br>
> Cc: Petr Štetiar <<a href="mailto:ynezz@true.cz">ynezz@true.cz</a>><br>
> Signed-off-by: Yousong Zhou <<a href="mailto:yszhou4tech@gmail.com">yszhou4tech@gmail.com</a>><br>
> ---<br>
>  scripts/qemustart | 12 +++++++-----<br>
>  1 file changed, 7 insertions(+), 5 deletions(-)<br>
><br>
> diff --git a/scripts/qemustart b/scripts/qemustart<br>
> index 951f225272..f0ffc64734 100755<br>
> --- a/scripts/qemustart<br>
> +++ b/scripts/qemustart<br>
> @@ -74,7 +74,7 @@ check_setup_() {<br>
>  }<br>
><br>
>  check_setup() {<br>
> -       [ -z $o_nonetwork ] || return 0<br>
> +       [ -z "$o_network" ] || return 0<br>
>         check_setup_ || {<br>
>                 __errmsg "please check the script content to see the environment requirement"<br>
>                 return 1<br>
> @@ -90,6 +90,7 @@ Usage: $SELF [-h|--help]<br>
>           [--kernel <kernel>]<br>
>           [--rootfs <rootfs>]<br>
>           [--machine <machine>]<br>
> +         [-n|--network]<br>
><br>
>  <subtarget> will default to "generic" and must be specified if<br>
>  <extra-qemu-options> are present<br>
> @@ -120,13 +121,14 @@ rand_mac() {<br>
>  }<br>
><br>
>  parse_args() {<br>
> +       o_network=<br>
>         o_qemu_extra=()<br>
>         while [ "$#" -gt 0 ]; do<br>
>                 case "$1" in<br>
> -                       --no-network|-n) o_nonetwork=1; shift ;;<br>
>                         --kernel) o_kernel="$2"; shift 2 ;;<br>
>                         --rootfs) o_rootfs="$2"; shift 2 ;;<br>
>                         --machine|-machine|-M) o_mach="$2"; shift 2 ;;<br>
> +                       --network|-n) o_network=1; shift ;;<br>
>                         --help|-h)<br>
>                                 usage<br>
>                                 exit 0<br>
> @@ -187,7 +189,7 @@ start_qemu_armvirt() {<br>
>                 )<br>
>         }<br>
><br>
> -       [ -n $o_nonetwork ] || {<br>
> +       [ -z "$o_network" ] || {<br>
>                 o_qemu_extra+=( \<br>
>                         "-netdev" "bridge,id=lan,br=$BR_LAN,<wbr>helper=$HELPER" \<br>
>                             "-device" "virtio-net-pci,id=devlan,<wbr>netdev=lan,mac=$MAC_LAN" \<br>
> @@ -229,7 +231,7 @@ start_qemu_malta() {<br>
>         # NOTE: order of wan, lan -device arguments matters as it will affect which<br>
>         # one will be actually used as the wan, lan network interface inside the<br>
>         # guest machine<br>
> -       [ -n $o_nonetwork ] || {<br>
> +       [ -z "$o_network" ] || {<br>
>                 o_qemu_extra+=( \<br>
>                         "-netdev" "bridge,id=wan,br=$BR_WAN,<wbr>helper=$HELPER" "-device" \<br>
>                             "virtio-net-pci,id=devwan,<wbr>netdev=wan,mac=$MAC_WAN" \<br>
> @@ -276,7 +278,7 @@ start_qemu_x86() {<br>
>             )<br>
>         }<br>
><br>
> -       [ -n $o_nonetwork ] || {<br>
> +       [ -z "$o_network" ] || {<br>
>                 o_qemu_extra+=( \<br>
>                         "-netdev" "bridge,id=lan,br=$BR_LAN,<wbr>helper=$HELPER" \<br>
>                             "-device" "virtio-net-pci,id=devlan,<wbr>netdev=lan,mac=$MAC_LAN" \<br>
><br>
I pushed a patch<br>
(<a href="https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=9424b6f998917e2926c0b7afb8d7a968590da335" target="_blank">https://git.openwrt.org/?p=<wbr>openwrt/openwrt.git;a=commit;<wbr>h=<wbr>9424b6f998917e2926c0b7afb8d7a9<wbr>68590da335</a>)<br>
yesterday which fixes the [ -n ] and [ -z ] issues<br>
<br>
Hans<br>
> ______________________________<wbr>_________________<br>
> openwrt-devel mailing list<br>
> <a href="mailto:openwrt-devel@lists.openwrt.org">openwrt-devel@lists.openwrt.org</a><br>
> <a href="https://lists.openwrt.org/mailman/listinfo/openwrt-devel" target="_blank">https://lists.openwrt.org/<wbr>mailman/listinfo/openwrt-devel</a><br>
</blockquote><br><br>-- <br>                yousong<br>