[LEDE-DEV] [PATCH] add --do-setup arg and default to squasfs

Paul Spooren paul at spooren.de
Wed May 17 12:40:14 PDT 2017


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 <paul at 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




More information about the Lede-dev mailing list