summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2017-05-11 14:29:52 +0800
committerYousong Zhou <yszhou4tech@gmail.com>2018-01-31 16:54:57 +0800
commitaa66aa0c9a77c115de0efcaf6ee59650b969b90d (patch)
tree9b8cc0e5e21d6192c19f5b0c69efba7bd0e55e2c /scripts
parentc9c2e4d78dc683b46b7f31b230afbdcdc13b81f6 (diff)
downloadmtk-20170518-aa66aa0c9a77c115de0efcaf6ee59650b969b90d.zip
mtk-20170518-aa66aa0c9a77c115de0efcaf6ee59650b969b90d.tar.gz
mtk-20170518-aa66aa0c9a77c115de0efcaf6ee59650b969b90d.tar.bz2
scripts/qemustart: more portable array operation
The following commands output 1,2,1,1 cmd0='a=("${a[@]}" 'a'); echo "${#a}"' cmd1='a+=('a'); echo "${#a}"' bash -c "$cmd0"; zsh -c "$cmd0" bash -c "$cmd1"; zsh -c "$cmd1" The following outputs 0,1,0,0 cmd2='f() { echo "$#"; }; f "${a[@]}"' cmd3="a=(); $cmd2" bash -c "$cmd2"; zsh -c "$cmd2" bash -c "$cmd3"; zsh -c "$cmd3" Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/qemustart8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/qemustart b/scripts/qemustart
index 6c2254e..5af93b9 100755
--- a/scripts/qemustart
+++ b/scripts/qemustart
@@ -117,6 +117,7 @@ rand_mac() {
}
parse_args() {
+ o_qemu_extra=()
while [ "$#" -gt 0 ]; do
case "$1" in
--kernel) o_kernel="$2"; shift 2 ;;
@@ -131,7 +132,7 @@ parse_args() {
elif [ -z "$o_subtarget" ]; then
o_subtarget="$1"
else
- o_qemu_extra=("${o_qemu_extra[@]}" "$1")
+ o_qemu_extra+=("$1")
fi
shift
;;
@@ -174,11 +175,10 @@ start_qemu_armvirt() {
if [ ! -f "$rootfs" -a -s "$rootfs.gz" ]; then
gunzip "$rootfs.gz"
fi
- o_qemu_extra=( \
+ o_qemu_extra+=( \
"-drive" "file=$rootfs,format=raw,if=virtio" \
"-append" "root=/dev/vda rootwait" \
- "${o_qemu_extra[@]}" \
- )
+ )
}
"$qemu_exe" -machine virt -cpu "$cpu" -nographic \