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
# Check architecture for each channel
- if [[ ! "$(bash "${tools_dir}/channel.sh" --version "${alteriso_version}" -a ${arch} -n -b check "${channel_name}")" = "correct" ]]; then
+ local _exit=0
+ bash "${tools_dir}/channel.sh" --version "${alteriso_version}" -a ${arch} -n -b check "${channel_name}" || _exit="${?}"
+ if (( "${_exit}" != 0 )) && (( "${_exit}" != 1 )); then
msg_error "${channel_name} channel does not support current architecture (${arch})." "1"
fi
# Check for a valid channel name
if [[ -n "${1+SET}" ]]; then
- case "$(bash "${tools_dir}/channel.sh" --version "${alteriso_version}" -n check "${1}")" in
- "incorrect")
+ case "$(bash "${tools_dir}/channel.sh" --version "${alteriso_version}" -n check "${1}"; printf "${?}")" in
+ "2")
msg_error "Invalid channel ${1}" "1"
;;
- "directory")
+ "1")
channel_dir="${1}"
channel_name="$(basename "${1%/}")"
;;
- "correct")
+ "0")
channel_dir="${script_path}/channels/${1}"
channel_name="${1}"
;;
echo " -h | --help This help message"
echo
echo " --nocheck Do not check the channel with desc command.This option helps speed up."
+ echo
+ echo " check command exit code"
+ echo " 0 (correct) Normal available channel"
+ echo " 1 (directory) Channel outside the channel directory"
+ echo " 2 (incorrect) Unavailable channel"
+ echo " 3 Other error"
}
gen_channel_list() {
gen_channel_list
if [[ ! "${#}" = "1" ]]; then
_help
- exit 1
+ exit 3
fi
if [[ $(printf '%s\n' "${channellist[@]}" | grep -qx "${1}"; echo -n ${?} ) -eq 0 ]]; then
- echo "correct"
+ #echo "correct"
+ exit 0
elif [[ -d "${1}" ]] && [[ -n $(ls "${1}") ]]; then
local _channel_name="$(basename "${1%/}")"
if ! check_alteriso_version "${_channel}" || [[ "${opt_nochkver}" = true ]]; then
- echo "directory"
+ #echo "directory"
+ exit 1
else
- echo "incorrect"
+ #echo "incorrect"
+ exit 2
fi
else
- echo "incorrect"
+ #echo "incorrect"
+ exit 2
fi
}
_help
exit 1
fi
- if [[ "${opt_nocheck}" = false ]] && [[ ! "$(bash "${script_path}/tools/channel.sh" -a ${arch} -n -b check "${1}")" = "correct" ]]; then
+ if [[ "${opt_nocheck}" = false ]] && ! bash "${script_path}/tools/channel.sh" -a ${arch} -n -b check "${1}"; then
exit 1
fi
local _channel