@@ -120,7 +120,7 @@ _help() {
120120 echo " -c Build all channel (DO NOT specify the channel !!)"
121121 echo " -d Use the default build.sh arguments. (${default_options} )"
122122 echo " -g Use gitversion"
123- echo " -h This help message"
123+ echo " -h | --help This help message"
124124 echo " -l <locale> Set the locale to build"
125125 echo " -m <architecture> Set the architecture to build"
126126 echo " -r <interer> Set the number of retries"
@@ -142,29 +142,75 @@ _help() {
142142share_options=" --noconfirm"
143143default_options=" --boot-splash --cleanup --user alter --password alter"
144144
145- while getopts ' a:dghr:sctm:l:' arg; do
146- case " ${arg} " in
147- a) share_options=" ${share_options} ${OPTARG} " ;;
148- c) all_channel=true ;;
149- d) share_options=" ${share_options} ${default_options} " ;;
150- m) architectures=(${OPTARG} ) ;;
151- g)
145+
146+ # Parse options
147+ ARGUMENT=" ${@ } "
148+ _opt_short=" a:dghr:sctm:l:"
149+ _opt_long=" help"
150+ OPT=$( getopt -o ${_opt_short} -l ${_opt_long} -- ${ARGUMENT} )
151+ [[ ${?} != 0 ]] && exit 1
152+
153+ eval set -- " ${OPT} "
154+ unset OPT _opt_short _opt_long
155+
156+ while true ; do
157+ case ${1} in
158+ -a)
159+ share_options=" ${share_options} ${2} "
160+ shift 2
161+ ;;
162+ -c)
163+ all_channel=true
164+ shift 1
165+ ;;
166+ -d)
167+ share_options=" ${share_options} ${default_options} "
168+ shift 1
169+ ;;
170+ -m)
171+ architectures=(${2} )
172+ shift 2
173+ ;;
174+ -g)
152175 if [[ ! -d " ${script_path} /.git" ]]; then
153176 msg_error " There is no git directory. You need to use git clone to use this feature."
154177 exit 1
155178 else
156179 share_options=" ${share_options} --gitversion"
157180 fi
181+ shift 1
182+ ;;
183+ -s)
184+ simulation=true
185+ shift 1
186+ ;;
187+ -r)
188+ retry=" ${2} "
189+ shift 2
190+ ;;
191+ -t)
192+ share_options=" ${share_options} --tarball"
193+ ;;
194+ -l)
195+ locale_list=(${2} )
196+ shift 2
197+ ;;
198+ -h | --help)
199+ shift 1
200+ _help
201+ exit 0
202+ ;;
203+ --)
204+ shift 1
205+ break
206+ ;;
207+ * )
208+ shift 1
209+ _help
210+ exit 1
158211 ;;
159- s) simulation=true;;
160- r) retry=" ${OPTARG} " ;;
161- t) share_options=" ${share_options} --tarball" ;;
162- l) locale_list=(${OPTARG} );;
163- h) _help ; exit 0 ;;
164- * ) _help ; exit 1 ;;
165212 esac
166213done
167- shift $(( OPTIND - 1 ))
168214
169215
170216if [[ " ${all_channel} " = true ]]; then
0 commit comments