@@ -353,31 +353,32 @@ check_bool() {
353353prepare_env () {
354354 # Check packages
355355 if [[ " ${nodepend} " = false ]]; then
356- local _check_failed=false _pkg _result
356+ local _check_failed=false _pkg _result=0 _version
357357 msg_info " Checking dependencies ..."
358358 for _pkg in ${dependence[@]} ; do
359359 msg_debug -n " Checking ${_pkg} ..."
360- _result=( $( " ${tools_dir} /package.py" -s " ${_pkg} " ) )
361- case " ${_result[0] } " in
362- " latest " )
363- [[ " ${debug} " = true ]] && echo -ne " ${_result[1] } \n"
360+ _version= " $( " ${tools_dir} /package.py" -s " ${_pkg} " ) " || _result= " ${?} "
361+ case " ${_result} " in
362+ " 0 " )
363+ [[ " ${debug} " = true ]] && echo -ne " ${_version } \n"
364364 ;;
365- " noversion " )
365+ " 1 " )
366366 echo ; msg_warn " Failed to get the latest version of ${_pkg} ."
367367 ;;
368- " nomatch " )
368+ " 2 " )
369369 [[ " ${debug} " = true ]] && echo -ne " ${_result[1]} \n"
370370 msg_warn " The version of ${_pkg} installed in local does not match one of the latest.\nLocal: ${_result[1]} Latest: ${_result[2]} "
371371 ;;
372- " failed " )
372+ " 3 " )
373373 [[ " ${debug} " = true ]] && echo
374374 msg_error " ${_pkg} is not installed." ; _check_failed=true
375375 ;;
376- " error " )
376+ " 4 " )
377377 [[ " ${debug} " = true ]] && echo
378378 msg_error " pyalpm is not installed." ; exit 1
379379 ;;
380380 esac
381+ _result=0
381382 done
382383 if [[ " ${_check_failed} " = true ]]; then exit 1; fi
383384 fi
@@ -487,7 +488,8 @@ prepare_build() {
487488
488489 local module_check
489490 module_check (){
490- if [[ ! " $( bash " ${tools_dir} /module.sh" check " ${1} " ) " = " correct" ]]; then
491+ msg_debug " Checking ${1} module ..."
492+ if ! bash " ${tools_dir} /module.sh" check " ${1} " ; then
491493 msg_error " Module ${1} is not available." " 1" ;
492494 fi
493495 }
@@ -538,15 +540,12 @@ prepare_build() {
538540 check_bool boot_splash cleaning noconfirm nodepend customized_username customized_password noloopmod nochname tarball noiso noaur customized_syslinux norescue_entry debug bash_debug nocolor msgdebug noefi nosigcheck
539541
540542 # Check architecture for each channel
541- if [[ ! " $( bash " ${tools_dir} /channel.sh" --version " ${alteriso_version} " -a ${arch} -n -b check " ${channel_name} " ) " = " correct" ]]; then
543+ local _exit=0
544+ bash " ${tools_dir} /channel.sh" --version " ${alteriso_version} " -a ${arch} -n -b check " ${channel_name} " || _exit=" ${?} "
545+ if (( "${_exit} " != 0 )) && (( "${_exit} " != 1 )) ; then
542546 msg_error " ${channel_name} channel does not support current architecture (${arch} )." " 1"
543547 fi
544548
545- # Check kernel for each channel
546- if [[ ! " $( bash " ${tools_dir} /kernel.sh" -c " ${channel_name} " -a " ${arch} " -s check " ${kernel} " ) " = " correct" ]]; then
547- msg_error " This kernel is currently not supported on this channel or architecture" " 1"
548- fi
549-
550549 # Unmount
551550 umount_chroot
552551}
@@ -1304,15 +1303,15 @@ if [[ "${bash_debug}" = true ]]; then set -x -v; fi
13041303
13051304# Check for a valid channel name
13061305if [[ -n " ${1+SET} " ]]; then
1307- case " $( bash " ${tools_dir} /channel.sh" --version " ${alteriso_version} " -n check " ${1} " ) " in
1308- " incorrect " )
1306+ case " $( bash " ${tools_dir} /channel.sh" --version " ${alteriso_version} " -n check " ${1} " ; printf " ${?} " ) " in
1307+ " 2 " )
13091308 msg_error " Invalid channel ${1} " " 1"
13101309 ;;
1311- " directory " )
1310+ " 1 " )
13121311 channel_dir=" ${1} "
13131312 channel_name=" $( basename " ${1%/ } " ) "
13141313 ;;
1315- " correct " )
1314+ " 0 " )
13161315 channel_dir=" ${script_path} /channels/${1} "
13171316 channel_name=" ${1} "
13181317 ;;
0 commit comments