diff options
| -rwxr-xr-x | mltk | 52 |
1 files changed, 24 insertions, 28 deletions
@@ -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 |
