From 7b01d7fbbdf6b10f13af6b4cd622d1b3bfb5ebe8 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Aug 11 2016 15:07:43 +0000 Subject: arm-image-installer: added --list-targets option As we have over 80 boards supported simple printing them ended in unreadable list. Instead of doing it we now have option to list all supported boards grouped by SoC. --- diff --git a/arm-image-installer b/arm-image-installer index d222161..9e0a024 100755 --- a/arm-image-installer +++ b/arm-image-installer @@ -14,7 +14,7 @@ Usage: $(basename ${0}) --image=IMAGE - xz compressed image file name --target=TARGET - target board - [${TARGETS}] + --list-targets - list supported boards --media=DEVICE - media device file (/dev/[sdX|mmcblkX]) --selinux=ON/OFF - Turn SELinux off/on as needed --norootpass - Remove the root password @@ -35,8 +35,6 @@ else DIR=$(dirname $0) BOARDDIR="${DIR}/boards.d" fi -TARGETS=$(ls -1 ${BOARDDIR}) -TARGETS=$(echo ${TARGETS} | sed -e 's/[[:space:]]/|/g') # check the args while [ $# -gt 0 ]; do @@ -89,6 +87,9 @@ while [ $# -gt 0 ]; do --addconsole) CONSOLE=1 ;; + --list-targets) + LISTTARGETS=1 + ;; --version) echo "$(basename ${0})-"$VERSION"" exit 0 @@ -105,6 +106,56 @@ while [ $# -gt 0 ]; do shift done +contains() { + string="$1" + substring="$2" + if test "${string#*$substring}" != "$string" + then + return 0 # $substring is in $string + else + return 1 # $substring is not in $string + fi +} + +if [ ! -z "$LISTTARGETS" ]; then + echo "Supported boards are:" + echo "" + echo "AllWinner SoC based:" + ALLWINNER=$(find boards.d/ -type l -ls|grep AllWinner|cut -d" " -f32|cut -d"/" -f2|sort) + echo $ALLWINNER | sed -e 's/[[:space:]]/ /g' | fold -w 80 -s + + echo "" + echo "i.Mx6 SoC based:" + MX6=$(find boards.d/ -type l -ls|grep /imx6|cut -d" " -f32|cut -d"/" -f2|sort) + echo $MX6 | sed -e 's/[[:space:]]/ /g' | fold -w 80 -s + + echo "" + echo "TI SoC based:" + OMAP=$(find boards.d/ -type l -ls|grep /omap|cut -d" " -f32|cut -d"/" -f2|sort) + echo $OMAP | sed -e 's/[[:space:]]/ /g' | fold -w 80 -s + + echo "" + echo "Marvell SoC based:" + MVEBU=$(find boards.d/ -type l -ls|grep /mvebu|cut -d" " -f32|cut -d"/" -f2|sort) + echo $MVEBU | sed -e 's/[[:space:]]/ /g' | fold -w 80 -s + + TARGETS=$(ls -1 ${BOARDDIR}) + TARGETS=$(echo ${TARGETS} | sed -e 's/[[:space:]]/ /g') + + for board in $TARGETS + do + if [[ none == $board || $ALLWINNER =~ $board || $MX6 =~ $board || $OMAP =~ $board || $MVEBU =~ $board ]]; then + A=1 + else + OTHER="$OTHER $board" + fi + done + echo "" + echo "Other SoC based:" + echo $OTHER + exit 0 +fi + # ensure sudo user if [ "$(sudo whoami)" != "root" ] ; then echo "Error: This script requires 'sudo' privileges in order to write to disk & mount media."