# Parse channels
set +eu
-[[ -n "${1}" ]] && channel_name="${1}"
# Check for a valid channel name
-[[ "$(bash "${script_path}/tools/channel.sh" check "${channel_name}")" = false ]] && msg_error "Invalid channel ${channel_name}" "1"
+case "$(bash "${script_path}/tools/channel.sh" check "${1}")" in
+ "incorrect")
+ msg_error "Invalid channel ${1}" "1"
+ ;;
+ "directory")
+ channel_dir="${1}"
+ channel_name="$(basename "${1%/}")"
+ ;;
+ "correct")
+ channel_dir="${script_path}/channels/${1}"
+ channel_name="${1}"
+ ;;
+esac
# Set for special channels
if [[ -d "${channel_dir}.add" ]]; then
- channel_name="${channel_name}.add"
+ channel_name="${1}"
+ channel_dir="${channel_dir}.add"
elif [[ "${channel_name}" = "rebuild" ]]; then
if [[ -f "${rebuildfile}" ]]; then
rebuild=true
exit 0
fi
-channel_dir="${script_path}/channels/${channel_name}"
-
# Check channel version
if [[ ! "${channel_name}" = "rebuild" ]]; then
msg_debug "channel path is ${channel_dir}"
exit 1
fi
if [[ $(printf '%s\n' "${channellist[@]}" | grep -qx "${1}"; echo -n ${?} ) -eq 0 ]]; then
- echo "true"
+ echo "correct"
elif [[ -d "${1}" ]] && [[ -n $(ls "${1}") ]] && [[ "$(cat "${1}/alteriso" 2> /dev/null)" = "alteriso=${alteriso_version}" ]] || [[ "${opt_nochkver}" = true ]]; then
local _channel_name="$(basename "${1%/}")"
if [[ ! "${_channel_name}" = "share" ]] && [[ $(echo "${_channel_name}" | sed 's/^.*\.\([^\.]*\)$/\1/') = "add" ]] || [[ ! -d "${script_path}/channels/${_dirname}.add" ]] && [[ "${opt_only_add}" = false ]]; then
- echo "true"
+ echo "directory"
fi
else
- echo "false"
+ echo "incorrect"
fi
}