From a1832a9004a7c65baa6c889e41e63961189abb97 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Fri, 28 Feb 2014 08:23:39 +0100 Subject: [PATCH] more friendly --parameters to configure the execution of the script --- TODO.org | 2 +- build.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/TODO.org b/TODO.org index 7040b4d..22439cb 100644 --- a/TODO.org +++ b/TODO.org @@ -1,7 +1,7 @@ # --- TODO * TODO [#A] offer pre-built binaries -* TODO [#A] configure by passing --parameters +* DONE [#A] configure by passing --parameters * TODO [#A] reinstall mpfr and/or aaa_elflids to fix missing libmpfr...so * DONE [#B] UNTESTED allow for running on ARM host * TODO [#B] build rootfs from slackwarearm-current diff --git a/build.sh b/build.sh index 50dfa12..429d5ff 100755 --- a/build.sh +++ b/build.sh @@ -19,6 +19,72 @@ ROOTFS_VERSION=${ROOTFS_VERSION:-04Nov13} TOOLCHAIN_VERSION=${TOOLCHAIN_VERSION:-4.8-2013.10} TOOLCHAIN_URL_RANDOM_NUMBER=${TOOLCHAIN_URL_RANDOM_NUMBER:-155358238} +# commandline arguments processing +while [ "x$1" != "x" ] +do + case "$1" in + -c | --compile ) + shift + COMPILE="true" + ;; + -dc | --dont-compile ) + shift + COMPILE="false" + ;; + -d | --display ) + shift + CUBIETRUCK_DISPLAY=$1 + shift + ;; + -n | --image-name ) + shift + IMG_NAME=$1 + shift + ;; + -r | --rootfs-version ) + shift + ROOTFS_VERSION=$1 + shift + ;; + -o | --output ) + shift + DEST=$1 + shift + ;; + -v | --image-version ) + shift + VERSION=$1 + shift + ;; + -xv | --toolchain-version ) + shift + TOOLCHAIN_VERSION=$1 + shift + ;; + -xumn | --toolchain-url-magic-number ) + shift + TOOLCHAIN_URL_RANDOM_NUMBER=$1 + shift + ;; + + -h | --help ) + echo -e "Usage: run as root: $0 " + echo -e "Options:" + echo -e "\t-c | --compile" + echo -e "\t-dc | --dont-compile" + echo -e "\t-d | --display [\"HDMI\"|\"VGA\"] (default: $CUBIETRUCK_DISPLAY)" + echo -e "\t-n | --image-name [\"nom\"] (default: $IMG_NAME)" + echo -e "\t-r | --rootfs-version [\"version number\"] (default: $ROOTFS_VERSION)" + echo -e "\t-o | --output [/directory/] (default: $DEST)" + echo -e "\t-v | --image-version [\"version number\"] (default: $VERSION)" + echo -e "\t-xv | --toolchain-version [\"version number\"] (default: $TOOLCHAIN_VERSION)" + echo -e "\t-xumn | --toolchain-url-magic-number [\"magic number\"] (default: $TOOLCHAIN_URL_RANDOM_NUMBER)" + + exit 0 + ;; + esac +done + # --- Script -------------------------------------------------------------------- CWD=$(pwd)