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