77arch=" "
88channel=" "
99kernel=" "
10+ script=false
1011
1112_help () {
1213 echo " usage ${0} [options] [command]"
@@ -22,6 +23,7 @@ _help() {
2223 echo " General options:"
2324 echo " -a | --arch [arch] Specify the architecture"
2425 echo " -c | --channel Specify the channel"
26+ echo " -s | --script Enable script mode"
2527 echo " -h | --help This help message"
2628}
2729
@@ -33,7 +35,7 @@ getclm() {
3335
3436# Message functions
3537msg_error () {
36- " ${script_path} /tools/msg.sh" -a " kernel.sh" error " ${1} "
38+ " ${script_path} /tools/msg.sh" -s 6 - a " kernel.sh" error " ${1} "
3739}
3840
3941gen_kernel_list () {
@@ -60,8 +62,10 @@ check() {
6062 fi
6163 if [[ $( printf ' %s\n' " ${kernellist[@]} " | grep -qx " ${1} " ; echo -n ${?} ) -eq 0 ]]; then
6264 echo " correct"
65+ exit 0
6366 else
6467 echo " incorrect"
68+ exit 1
6569 fi
6670}
6771
@@ -99,6 +103,9 @@ get() {
99103 # 不正なカーネル名なら終了する
100104 if [[ " ${_kernel_line} " = " failed" ]]; then
101105 msg_error " Invalid kernel ${1} "
106+ if [[ " ${script} " = true ]]; then
107+ echo " exit 1"
108+ fi
102109 exit 1
103110 fi
104111
116123
117124# Parse options
118125ARGUMENT=" ${@ } "
119- _opt_short=" a:c:h "
120- _opt_long=" arch:,channel:,help"
126+ _opt_short=" a:c:hs "
127+ _opt_long=" arch:,channel:,help,script "
121128OPT=$( getopt -o ${_opt_short} -l ${_opt_long} -- ${ARGUMENT} )
122129[[ ${?} != 0 ]] && exit 1
123130
@@ -134,6 +141,10 @@ while true; do
134141 channel=" ${2} "
135142 shift 2
136143 ;;
144+ -s | --script)
145+ script=true
146+ shift 1
147+ ;;
137148 -h | --help)
138149 _help
139150 exit 0
0 commit comments