diff --git a/README.md b/README.md index 70a8907216660aa6bb8ea48b508c1f604d84b9e5..766e6a3af5dd412c3010e4407b2291eb5262ab6a 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Generally, the disk space is more than 50g. #### Contribution -oemaker _[-t Type] [-p Product] [-v Version] [-r RELEASE] [-s REPOSITORY]_ +oemaker _[-h] [-t Type] [-p Product] [-v Version] [-r RELEASE] [-s REPOSITORY]_ optional arguments: -t Type @@ -38,3 +38,6 @@ oemaker _[-t Type] [-p Product] [-v Version] [-r RELEASE] [ -s REPOSITORY source dnf repository address link(may be listed multiple times) + + -h + show the help message and exit diff --git a/init.sh b/init.sh index e436a052a61d762c9ce68d4a2f292b38fedc0558..bd8d2ac4c87251e6ef2169575624af278019e1bd 100755 --- a/init.sh +++ b/init.sh @@ -16,6 +16,21 @@ #!/bin/bash set -e +function oemaker_usage() +{ + cat << EOF +Usage: oemaker [-h] [-t Type] [-p Product] [-v Version] [-r RELEASE] [-s REPOSITORY] + +optional arguments: + -t Type ISO Type, include standard debug and source + -p Product Product Name, such as: openEuler + -v Version version identifier + -r RELEASE release information + -s REPOSITORY source dnf repository address link(may be listed multiple times) + -h show the help message and exit +EOF +} + function parse_cmd_line() { #param init @@ -34,16 +49,33 @@ function parse_cmd_line() ISOTYPE="standard" # parse input params - while getopts ":p:v:r:s:t:" opt + while getopts ":p:v:r:s:t:h" opt do case "$opt" in - p) PRODUCT="$OPTARG";; - v) VERSION="$OPTARG";; - r) RELEASE="$OPTARG";; - s) REPOS1="$OPTARG";; - t) ISOTYPE="$OPTARG";; - ?) printf "Usage: %s: [-f config_file] args\n" "$0" - return 1;; + p) + PRODUCT="$OPTARG" + ;; + v) + VERSION="$OPTARG" + ;; + r) + RELEASE="$OPTARG" + ;; + s) + REPOS1="$OPTARG" + ;; + t) + ISOTYPE="$OPTARG" + ;; + h) + oemaker_usage + exit 0 + ;; + ?) + echo "error: please check the params." + oemaker_usage + return 1 + ;; esac done @@ -101,14 +133,7 @@ function global_var_init() set -e return 0 } -####################################### -# copy config. -# Arguments: -# None -# Returns: -# Success: 0 -# Failed: 1 -####################################### + function init_config() { [ -f "${BUILD}"/isopackage.sdf ] && cp "${BUILD}"/isopackage.sdf "${BUILD}"/iso/ diff --git a/oemaker.sh b/oemaker.sh index 577588f0302cde838e4af4e6f72660eb1098a9e1..05ac38d960cdf9f76cb6ed98c406fa7b87a557be 100755 --- a/oemaker.sh +++ b/oemaker.sh @@ -37,10 +37,9 @@ function mkclean() function mk_euleros_main() { - echo "Parsing cmd line..." parse_cmd_line "$@" if [ $? -ne 0 ]; then - echo "parse params error" + echo "parse params failed" return 1 fi