Skip to content

Commit 0c3fa52

Browse files
committed
[update] : Get the channel description using channel.sh
1 parent 57b4efa commit 0c3fa52

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

build.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,7 @@ _usage () {
173173
fi
174174
echo -ne " ${_channel}"
175175
echo_blank "$(( ${blank} - 4 - ${#_channel} ))"
176-
if [[ ! "$(cat "${script_path}/channels/${_dirname}/alteriso" 2> /dev/null)" = "alteriso=${alteriso_version}" ]] && [[ "${nochkver}" = false ]]; then
177-
"${script_path}/tools/msg.sh" --noadjust -l 'ERROR:' --noappname error "Not compatible with AlterISO3"
178-
elif [[ -f "${script_path}/channels/${_dirname}/description.txt" ]]; then
179-
echo -ne "$(cat "${script_path}/channels/${_dirname}/description.txt")\n"
180-
else
181-
"${script_path}/tools/msg.sh" --noadjust -l 'WARN :' --noappname warn "This channel does not have a description.txt"
182-
fi
176+
"${script_path}/tools/channel.sh" desc "${_channel}"
183177
done
184178
echo -ne " rebuild"
185179
echo_blank "$(( ${blank} - 11 ))"
@@ -582,7 +576,7 @@ prepare_build() {
582576
check_bool noefi
583577

584578
# Check architecture for each channel
585-
if [[ ! "$(bash "${script_path}/tools/channel.sh" -a ${arch} -n -b -m check "${channel_name}")" = "correct" ]]; then
579+
if [[ ! "$(bash "${script_path}/tools/channel.sh" -a ${arch} -n -b check "${channel_name}")" = "correct" ]]; then
586580
msg_error "${channel_name} channel does not support current architecture (${arch})." "1"
587581
fi
588582

tools/channel.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ _help() {
2121
echo
2222
echo " General command:"
2323
echo " check [name] Returns whether the specified channel name is valid."
24+
echo " desc [name] Display a description of the specified channel"
2425
echo " show Display a list of channels"
2526
echo " help This help message"
2627
echo
@@ -94,6 +95,24 @@ check() {
9495
fi
9596
}
9697

98+
desc() {
99+
gen_channel_list
100+
if [[ ! "${#}" = "1" ]]; then
101+
_help
102+
exit 1
103+
fi
104+
if [[ ! "$(bash "${script_path}/tools/channel.sh" -a ${arch} -n -b check "${1}")" = "correct" ]]; then
105+
exit 1
106+
fi
107+
if [[ ! "$(cat "${script_path}/channels/${1}/alteriso" 2> /dev/null)" = "alteriso=${alteriso_version}" ]] && [[ "${opt_nochkver}" = false ]]; then
108+
"${script_path}/tools/msg.sh" --noadjust -l 'ERROR:' --noappname error "Not compatible with AlterISO3"
109+
elif [[ -f "${script_path}/channels/${1}/description.txt" ]]; then
110+
echo -ne "$(cat "${script_path}/channels/${1}/description.txt")\n"
111+
else
112+
"${script_path}/tools/msg.sh" --noadjust -l 'WARN :' --noappname warn "This channel does not have a description.txt"
113+
fi
114+
}
115+
97116
show() {
98117
gen_channel_list
99118
if (( "${#channellist[*]}" > 0)); then
@@ -173,6 +192,7 @@ fi
173192
case "${mode}" in
174193
"check" ) check ${@} ;;
175194
"show" ) show ;;
195+
"desc" ) desc ${@} ;;
176196
"help" ) _help; exit 0 ;;
177197
* ) _help; exit 1 ;;
178198
esac

0 commit comments

Comments
 (0)