aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2017-12-26 16:46:38 +0100
committerMichał Łyszczek <michal.lyszczek@bofc.pl>2017-12-26 16:46:38 +0100
commit20036bd93d857af53f08a1954b7c0fa230895b23 (patch)
treeb265b09e90ca5cb5503dc78213a65a451a462157
parent0f9868beb62e7a69aa1b93c5402de81996208d6e (diff)
downloadbuilder-tc-20036bd93d857af53f08a1954b7c0fa230895b23.tar.gz
builder-tc-20036bd93d857af53f08a1954b7c0fa230895b23.tar.bz2
builder-tc-20036bd93d857af53f08a1954b7c0fa230895b23.zip
Refactored select-toolchain a bit
-rw-r--r--readme.md17
-rwxr-xr-xselect-toolchain.sh34
2 files changed, 33 insertions, 18 deletions
diff --git a/readme.md b/readme.md
index d58b043..e6591dd 100644
--- a/readme.md
+++ b/readme.md
@@ -13,13 +13,16 @@ Select what compiler to create using select-toolchain.sh script like
~~~
$ ./select-toolchain.sh
-available configs:
- 1) config.cross-armv7
- 2) config.cross-i686
- 3) config.native-armv7a
- 4) config.native-i686
-4
-.config -> config.native-i686
+usage: ./select-toolchain.sh <config_number>
+
+supported configs are:
+ 0) cross.armv7a9-builder-linux-gnueabihf
+ 1) cross.i686-builder-linux-gnu
+ 2) native.armv7a9-builder-linux-gnueabihf
+ 3) native.i686-builder-linux-gnu
+
+$ ./select-toolchain.sh 1
+.config -> config.cross.i686-builder-linux-gnu
~~~
and then execute "make". This will build toolchain and create opkg package.
diff --git a/select-toolchain.sh b/select-toolchain.sh
index d605642..31bc5ea 100755
--- a/select-toolchain.sh
+++ b/select-toolchain.sh
@@ -3,28 +3,40 @@
configs=()
n=0
-echo "available configs:"
+###
+# add all configs to array
+#
for c in config.*
do
- ((n++))
configs+=($c)
- echo -e "\t$n) $c"
done
-if [ $# -eq 0 ]
+###
+# if config is no passed, print usage and list available configs
+#
+
+if [ $# -ne 1 ]
then
- read choice
-else
- choice="$1"
+ echo "usage: ${0} <config_number>"
+ echo ""
+ echo "supported configs are:"
+
+ for c in "${configs[@]}"
+ do
+ echo -e "\t$n) `echo $c | cut -f2- -d.`"
+ ((n++))
+ done
+
+ exit $n
fi
-if [ $choice -lt 1 ] || [ $choice -gt $n ]
+if [ ! -f ${configs[${1}]} ]
then
- echo "selected config doesn't exist"
+ echo "config doesn't exist"
exit 1
fi
-echo ".config -> ${configs[choice - 1]}"
+echo ".config -> ${configs[${1}]}"
rm -f .config
-ln -s ${configs[choice - 1]} .config
+ln -s ${configs[${1}]} .config