scripts/qemustart

the function do_setup is never used except if the script is changed
manually. It's used to easily setup bridges and traffic forwarding.
Adding the parameter --do-config simplifies the deployment.

The scripts defaults to the ext4 filesystem which is an unrealistic in
most cases. Now defaults to the squashfs img if exists.

Signed-off-by: Paul Spooren <p...@spooren.de>
---
 scripts/qemustart | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/scripts/qemustart b/scripts/qemustart
index 5cadd7d6a8..f77c674a9c 100755
--- a/scripts/qemustart
+++ b/scripts/qemustart
@@ -84,6 +84,7 @@ check_setup() {
 usage() {
        cat >&2 <<EOF
 Usage: $SELF [-h|--help]
+          $SELF [--do-setup]
        $SELF <target>
          [<subtarget> [<extra-qemu-options>]]
          [--kernel <kernel>]
@@ -119,6 +120,11 @@ rand_mac() {
 parse_args() {
        while [ "$#" -gt 0 ]; do
                case "$1" in
+                       --do-setup) 
+                          echo "running setup"
+                          do_setup 
+                          exit 0
+                          ;;
                        --kernel) o_kernel="$2"; shift 2 ;;
                        --rootfs) o_rootfs="$2"; shift 2 ;;
                        --help|-h)
@@ -216,9 +222,13 @@ start_qemu_x86() {
        local qemu_exe
 
        [ -n "$rootfs" ] || {
-               
rootfs="$o_bindir/lede-$o_target-${o_subtarget%-*}-combined-ext4.img"
-               if [ ! -f "$rootfs" -a -s "$rootfs.gz" ]; then
-                       gunzip "$rootfs.gz"
+               
rootfs="$o_bindir/lede-$o_target-${o_subtarget%-*}-combined-squashfs.img"
+               if [ ! -f "$rootfs" ]; then
+                       
rootfs="$o_bindir/lede-$o_target-${o_subtarget%-*}-combined-ext4.img"
+
+                       if [ ! -f "$rootfs" -a -s "$rootfs.gz" ]; then
+                               gunzip "$rootfs.gz"
+                       fi
                fi
        }
        #
@@ -276,6 +286,6 @@ start_qemu() {
        esac
 }
 
-check_setup \
-       && parse_args "$@" \
+parse_args "$@" \
+       && check_setup \
        && start_qemu
-- 
2.11.0


_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to