@@ -42,28 +42,40 @@ umask 0022
4242# $1: message string
4343msg_info () {
4444 local _msg_opts=" -a build.sh"
45+ if [[ " ${1} " = " -n" ]]; then
46+ _msg_opts=" ${_msg_opts} -o -n"
47+ shift 1
48+ fi
4549 [[ " ${msgdebug} " = true ]] && _msg_opts=" ${_msg_opts} -x"
4650 [[ " ${nocolor} " = true ]] && _msg_opts=" ${_msg_opts} -n"
47- " ${script_path} /tools/msg.sh" ${_msg_opts} info " ${@ } "
51+ " ${script_path} /tools/msg.sh" ${_msg_opts} info " ${1 } "
4852}
4953
5054# Show an Warning message
5155# $1: message string
5256msg_warn () {
5357 local _msg_opts=" -a build.sh"
58+ if [[ " ${1} " = " -n" ]]; then
59+ _msg_opts=" ${_msg_opts} -o -n"
60+ shift 1
61+ fi
5462 [[ " ${msgdebug} " = true ]] && _msg_opts=" ${_msg_opts} -x"
5563 [[ " ${nocolor} " = true ]] && _msg_opts=" ${_msg_opts} -n"
56- " ${script_path} /tools/msg.sh" ${_msg_opts} warn " ${@ } "
64+ " ${script_path} /tools/msg.sh" ${_msg_opts} warn " ${1 } "
5765}
5866
5967# Show an debug message
6068# $1: message string
6169msg_debug () {
6270 if [[ " ${debug} " = true ]]; then
6371 local _msg_opts=" -a build.sh"
72+ if [[ " ${1} " = " -n" ]]; then
73+ _msg_opts=" ${_msg_opts} -o -n"
74+ shift 1
75+ fi
6476 [[ " ${msgdebug} " = true ]] && _msg_opts=" ${_msg_opts} -x"
6577 [[ " ${nocolor} " = true ]] && _msg_opts=" ${_msg_opts} -n"
66- " ${script_path} /tools/msg.sh" ${_msg_opts} info " ${@ } "
78+ " ${script_path} /tools/msg.sh" ${_msg_opts} debug " ${1 } "
6779 fi
6880}
6981
@@ -72,6 +84,10 @@ msg_debug() {
7284# $2: exit code number (with 0 does not exit)
7385msg_error () {
7486 local _msg_opts=" -a build.sh"
87+ if [[ " ${1} " = " -n" ]]; then
88+ _msg_opts=" ${_msg_opts} -o -n"
89+ shift 1
90+ fi
7591 [[ " ${msgdebug} " = true ]] && _msg_opts=" ${_msg_opts} -x"
7692 [[ " ${nocolor} " = true ]] && _msg_opts=" ${_msg_opts} -n"
7793 " ${script_path} /tools/msg.sh" ${_msg_opts} error " ${1} "
@@ -158,11 +174,11 @@ _usage () {
158174 echo -ne " ${_channel} "
159175 for _b in $( seq 1 $(( ${blank} - 4 - ${# _channel} )) ) ; do echo -ne " " ; done
160176 if [[ ! " $( cat " ${script_path} /channels/${_dirname} /alteriso" 2> /dev/null) " = " alteriso=${alteriso_version} " ]] && [[ " ${nochkver} " = false ]]; then
161- echo -ne " $( echo_color -t ' 31 ' ' ERROR:' ) Not compatible with AlterISO3\n "
177+ " ${script_path} /tools/msg.sh " --noadjust -l ' ERROR:' --noappname error " Not compatible with AlterISO3"
162178 elif [[ -f " ${script_path} /channels/${_dirname} /description.txt" ]]; then
163179 echo -ne " $( cat " ${script_path} /channels/${_dirname} /description.txt" ) \n"
164180 else
165- echo -ne " $( echo_color -t ' 33 ' ' WARN :' ) This channel does not have a description.txt.\n "
181+ " ${script_path} /tools/msg.sh " --noadjust -l ' WARN :' --noappname warn " This channel does not have a description.txt"
166182 fi
167183 done
168184 echo -ne " rebuild"
@@ -248,11 +264,6 @@ load_config() {
248264 done
249265}
250266
251- # 作業ディレクトリを削除
252- remove_work () {
253- remove " ${work_dir} "
254- }
255-
256267# Display channel list
257268show_channel_list () {
258269 if [[ " ${nochkver} " = true ]]; then
@@ -363,7 +374,7 @@ prepare_env() {
363374 _trap_remove_work () {
364375 local status=${?}
365376 echo
366- remove " ${work_dir} "
377+ " ${script_path} /tools/clean.sh " -o -w $( realpath " ${work_dir} " ) $( [[ " ${debug} " = true ]] && echo -n " -d " )
367378 exit ${status}
368379 }
369380 trap ' _trap_remove_work' 1 2 3 15
@@ -592,12 +603,7 @@ prepare_build() {
592603 fi
593604
594605 # Unmount
595- local _mount
596- for _mount in $( mount | getclm 3 | grep $( realpath ${work_dir} ) ) ; do
597- msg_info " Unmounting ${_mount} "
598- umount " ${_mount} "
599- done
600- unset _mount
606+ umount_chroot
601607}
602608
603609
@@ -1443,19 +1449,21 @@ rebuildfile="${work_dir}/alteriso_config"
14431449set +eu
14441450
14451451# Check for a valid channel name
1446- case " $( bash " ${script_path} /tools/channel.sh" check " ${1} " ) " in
1447- " incorrect" )
1448- msg_error " Invalid channel ${1} " " 1"
1449- ;;
1450- " directory" )
1451- channel_dir=" ${1} "
1452- channel_name=" $( basename " ${1%/ } " ) "
1453- ;;
1454- " correct" )
1455- channel_dir=" ${script_path} /channels/${1} "
1456- channel_name=" ${1} "
1457- ;;
1458- esac
1452+ if [[ -n " ${1} " ]]; then
1453+ case " $( bash " ${script_path} /tools/channel.sh" -n -m check " ${1} " ) " in
1454+ " incorrect" )
1455+ msg_error " Invalid channel ${1} " " 1"
1456+ ;;
1457+ " directory" )
1458+ channel_dir=" ${1} "
1459+ channel_name=" $( basename " ${1%/ } " ) "
1460+ ;;
1461+ " correct" )
1462+ channel_dir=" ${script_path} /channels/${1} "
1463+ channel_name=" ${1} "
1464+ ;;
1465+ esac
1466+ fi
14591467
14601468# Set for special channels
14611469if [[ -d " ${channel_dir} .add" ]]; then
@@ -1468,14 +1476,10 @@ elif [[ "${channel_name}" = "rebuild" ]]; then
14681476 msg_error " The previous build information is not in the working directory." " 1"
14691477 fi
14701478elif [[ " ${channel_name} " = " clean" ]]; then
1471- umount_chroot
1472- remove " ${script_path} /menuconfig/build"
1473- remove " ${script_path} /system/cpp-src/mkalteriso/build"
1474- remove " ${script_path} /menuconfig-script/kernel_choice"
1475- remove " ${work_dir%/ } " /*
1476- remove " ${work_dir} "
1477- remove " ${rebuildfile} "
1479+ " ${script_path} /tools/clean.sh" -w $( realpath " ${work_dir} " ) $( [[ " ${debug} " = true ]] && echo -n " -d" )
14781480 exit 0
1481+ else
1482+ channel_dir=" ${script_path} /channels/${channel_name} "
14791483fi
14801484
14811485# Check channel version
@@ -1517,6 +1521,6 @@ run_once make_efiboot
15171521[[ " ${tarball} " = true ]] && run_once make_tarball
15181522
15191523[[ " ${noiso} " = false ]] && run_once make_iso
1520- [[ " ${cleaning} " = true ]] && remove_work
1524+ [[ " ${cleaning} " = true ]] && " ${script_path} /tools/clean.sh " -o -w $( realpath " ${work_dir} " ) $( [[ " ${debug} " = true ]] && echo -n " -d " )
15211525
15221526exit 0
0 commit comments