From 87f6542aed5d76c5e781cddb03a9dab284f9f454 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 27 Feb 2013 17:38:18 +0100 Subject: Only one target can be chosen when invoking mltk to make command line format more compatible to previous versions --- mltk | 52 ++++++++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/mltk b/mltk index 207a635c..6b18e187 100755 --- a/mltk +++ b/mltk @@ -45,11 +45,11 @@ banner () { print_usage() { echo "Toolkit for creating preboot mini-linux for OpenSLX NG (mltk)" - echo "Usage: $(basename ${SELF}) --[target] [-b] [-c] [-d] [module]*" + echo "Usage: $(basename ${SELF}) [target] [-b] [-c] [-d] [module]*" echo -e "" echo -e " Target:" - echo -e " --core \t minimal initramfs (stage 3.1) to mount the system-container (stage 3.2)." - echo -e " --tools \t minimal systemd-based rootfs including basic tools (required for --core)." + echo -e " core \t minimal initramfs (stage 3.1) to mount the system-container (stage 3.2)." + echo -e " tools \t minimal systemd-based rootfs including basic tools (required for core)." echo -e "" echo -e " Target options:" echo -e " -b \t build current target" @@ -60,11 +60,12 @@ print_usage() { echo -e " Otherwise, all modules will be built/cleaned." echo -e "" echo -e " Examples:" - echo -e " --tools -c -b base policykit sshd (clean all tools, build base, policykit and sshd)" - echo -e " --core -c -b --tools -c -b (clean all tools, build all tools, clean core, build core)" - echo -e " --tools -c base sshd -b sshd, ldm (clean base and sshd, build sshd and ldm, be verbose)" + echo -e " tools -c -b base policykit sshd (clean all tools, build base, policykit and sshd)" + echo -e " tools -c -b (clean all tools, build all tools)" + echo -e " tools -c base sshd -b sshd ldm -d (clean base and sshd, build sshd and ldm, be verbose)" + echo -e " core -c -b (clean and build core)" echo -e "" - echo -e " Existing modules for --tools are:" + echo -e " Existing modules for tools are:" echo -e " $(echo $(ls ${ROOT_DIR}/remote/tools))" } @@ -87,31 +88,26 @@ initial_checks() { read_params() { local MODE="" local SUBMODE="" + # select target: core or tools + case "$1" in + core) + MODE="CORE" + ;; + tools) + MODE="TOOLS" + ;; + *) + pwarning "Unknown target: $1" + print_usage + exit 1 + ;; + esac + shift + # handle rest of arguments while [ "$#" -gt "0" ]; do local PARAM="$1" shift - # select target: core or tools - if [[ "$PARAM" == "--"* ]]; then - case "$PARAM" in - --core) - MODE="CORE" - ;; - --tools) - MODE="TOOLS" - ;; - *) - pwarning "Unknown target: $PARAM" - print_usage - exit 1 - ;; - esac - SUBMODE="" - continue - fi - - [ "x$MODE" = "x" ] && pwarning "Cannot handle param $PARAM - no target selected yet" && print_usage && exit 1 - # options to current target if [[ "$PARAM" == "-"* ]]; then case "$PARAM" in -- cgit v1.2.3-55-g7522