@@ -104,6 +104,12 @@ getclm() {
104104 echo " $( cat -) " | cut -d " " -f " ${1} "
105105}
106106
107+ # Usage: echo_blank <number>
108+ # 指定されたぶんの半角空白文字を出力します
109+ echo_blank (){
110+ local _blank
111+ for _local in $( seq 1 " ${1} " ) ; do echo -ne " " ; done
112+ }
107113
108114_usage () {
109115 echo " usage ${0} [options] [channel]"
@@ -126,7 +132,7 @@ _usage () {
126132 echo " -l | --lang <lang> Specifies the default language for the live environment"
127133 echo " Default: ${locale_name} "
128134 echo " -k | --kernel <kernel> Set special kernel type.See below for available kernels"
129- echo " Default: ${kernel } "
135+ echo " Default: ${defaultkernel } "
130136 echo " -o | --out <out_dir> Set the output directory"
131137 echo " Default: ${out_dir} "
132138 echo " -p | --password <password> Set a live user password"
@@ -139,26 +145,23 @@ _usage () {
139145 echo " Default: ${work_dir} "
140146 echo
141147
142- local blank=" 33" _arch _lang _list _locale_name_list kernel _dirname _channel _b
148+ local blank=" 33" _arch _list _dirname _channel
143149
144150 echo " Language for each architecture:"
145151 for _list in ${script_path} /system/locale-* ; do
146152 _arch=" ${_list# ${script_path} / system/ locale-} "
147153 echo -n " ${_arch} "
148- for i in $( seq 1 $(( ${blank} - 4 - ${# _arch} )) ) ; do echo -ne " " ; done
149- _locale_name_list=$( cat ${_list} | grep -h -v ^' #' | getclm 1)
150- for _lang in ${_locale_name_list[@]} ; do echo -n " ${_lang} " ; done
151- echo
154+ echo_blank " $(( ${blank} - 4 - ${# _arch} )) "
155+ " ${script_path} /tools/locale.sh" -a " ${_arch} " show
152156 done
153157
154158 echo
155159 echo " Kernel for each architecture:"
156160 for _list in ${script_path} /system/kernel-* ; do
157161 _arch=" ${_list# ${script_path} / system/ kernel-} "
158162 echo -n " ${_arch} "
159- for i in $( seq 1 $(( ${blank} - 5 - ${# _arch} )) ) ; do echo -ne " " ; done
160- for kernel in $( grep -h -v ^' #' ${_list} | getclm 1) ; do echo -n " ${kernel} " ; done
161- echo
163+ echo_blank " $(( ${blank} - 5 - ${# _arch} )) "
164+ " ${script_path} /tools/kernel.sh" -a " ${_arch} " show
162165 done
163166
164167 echo
@@ -170,14 +173,8 @@ _usage () {
170173 _channel=" ${_dirname} "
171174 fi
172175 echo -ne " ${_channel} "
173- for _b in $( seq 1 $(( ${blank} - 4 - ${# _channel} )) ) ; do echo -ne " " ; done
174- if [[ ! " $( cat " ${script_path} /channels/${_dirname} /alteriso" 2> /dev/null) " = " alteriso=${alteriso_version} " ]] && [[ " ${nochkver} " = false ]]; then
175- " ${script_path} /tools/msg.sh" --noadjust -l ' ERROR:' --noappname error " Not compatible with AlterISO3"
176- elif [[ -f " ${script_path} /channels/${_dirname} /description.txt" ]]; then
177- echo -ne " $( cat " ${script_path} /channels/${_dirname} /description.txt" ) \n"
178- else
179- " ${script_path} /tools/msg.sh" --noadjust -l ' WARN :' --noappname warn " This channel does not have a description.txt"
180- fi
176+ echo_blank " $(( ${blank} - 4 - ${# _channel} )) "
177+ " ${script_path} /tools/channel.sh" desc " ${_channel} "
181178 done
182179
183180 echo
@@ -313,44 +310,29 @@ prepare_env() {
313310
314311 # Check packages
315312 if [[ " ${nodepend} " = false ]]; then
316- local _installed_pkg=( $( pacman -Q | getclm 1 ) ) _installed_ver=( $( pacman -Q | getclm 2 ) ) _check_pkg _check_failed=false _pkg
313+ local _check_failed=false _pkg _ver
317314 msg_info " Checking dependencies ..."
318-
319- # _checl_pkg [package]
320- _check_pkg () {
321- local __pkg __ver
315+ for _pkg in ${dependence[@]} ; do
322316 msg_debug -n " Checking ${_pkg} ..."
323- for __pkg in $( seq 0 $(( ${# _installed_pkg[@]} - 1 )) ) ; do
324- # パッケージがインストールされているかどうか
325- if [[ " ${_installed_pkg[${__pkg}]} " = ${1} ]]; then
326- __ver=" $( pacman -Sp --print-format ' %v' ${1} 2> /dev/null; :) "
327- if [[ " ${_installed_ver[${__pkg}]} " = " ${__ver} " ]]; then
328- # パッケージが最新の場合
329- [[ ${debug} = true ]] && echo -ne " $( pacman -Q ${1} | getclm 2) \n"
330- return 0
331- elif [[ -z ${__ver} ]]; then
332- # リモートのバージョンの取得に失敗した場合
333- [[ " ${debug} " = true ]] && echo
334- msg_warn " ${1} is not a repository package."
335- return 0
336- else
337- # リモートとローカルのバージョンが一致しない場合
338- [[ " ${debug} " = true ]] && echo -ne " $( pacman -Q ${1} | getclm 2) \n"
339- msg_warn " ${1} is not the latest package.\nLocal: $( pacman -Q ${1} 2> /dev/null | getclm 2) Latest: ${__ver} "
340- return 0
341- fi
342- fi
343- done
344- [[ " ${debug} " = true ]] && echo
345- msg_error " ${_pkg} is not installed." ; _check_failed=true
346- return 0
347- }
348-
349- for _pkg in ${dependence[@]} ; do _check_pkg " ${_pkg} " ; done
350-
351- if [[ " ${_check_failed} " = true ]]; then
352- exit 1
353- fi
317+ _ver=" $( pacman -Sp --print-format ' %v' ${_pkg} 2> /dev/null; :) "
318+ case " $( " ${script_path} /tools/package.sh" -s " ${_pkg} " ) " in
319+ " latest" )
320+ [[ ${debug} = true ]] && echo -ne " $( pacman -Q ${_pkg} | getclm 2) \n"
321+ ;;
322+ " noversion" )
323+ msg_warn " Failed to get the latest version of ${_pkg} ."
324+ ;;
325+ " old" )
326+ [[ " ${debug} " = true ]] && echo -ne " $( pacman -Q ${_pkg} | getclm 2) \n"
327+ msg_warn " ${_pkg} is not the latest package.\nLocal: $( pacman -Q ${_pkg} 2> /dev/null | getclm 2) Latest: ${_ver} "
328+ ;;
329+ " failed" )
330+ [[ " ${debug} " = true ]] && echo
331+ msg_error " ${_pkg} is not installed." ; _check_failed=true
332+ ;;
333+ esac
334+ done
335+ if [[ " ${_check_failed} " = true ]]; then exit 1; fi
354336 fi
355337
356338 # Build mkalteriso
0 commit comments