3 script_path="$(readlink -f ${0%/*})"
21 # usage: echo_color -b <backcolor> -t <textcolor> -d <decoration> [Text]
44 # You can specify multiple decorations with ;.
45 # 0 => All attributs off (ノーマル)
47 # 4 => Underscore (下線)
49 # 7 => Reverse video on (色反転)
63 while getopts 'b:t:d:n' arg; do
65 b) backcolor="${OPTARG}" ;;
66 t) textcolor="${OPTARG}" ;;
67 d) decotypes="${OPTARG}" ;;
68 n) echo_opts="-n -e" ;;
74 echo ${echo_opts} "\e[$([[ -v backcolor ]] && echo -n "${backcolor}"; [[ -v textcolor ]] && echo -n ";${textcolor}"; [[ -v decotypes ]] && echo -n ";${decotypes}")m${@}\e[m"
78 # Show an INFO message
85 while getopts 'n' arg; do
87 n) echo_opts="${echo_opts} -n" ;;
91 echo ${echo_opts} "$( echo_color -t '36' '[fullbuild.sh]') $( echo_color -t '32' 'Info') ${@}"
95 # Show an Warning message
102 while getopts 'n' arg; do
104 n) echo_opts="${echo_opts} -n" ;;
107 shift $((OPTIND - 1))
108 echo ${echo_opts} "$( echo_color -t '36' '[fullbuild.sh]') $( echo_color -t '33' 'Warning') ${@}" >&2
112 # Show an debug message
119 while getopts 'n' arg; do
121 n) echo_opts="${echo_opts} -n" ;;
124 shift $((OPTIND - 1))
125 if [[ ${debug} = true ]]; then
126 echo ${echo_opts} "$( echo_color -t '36' '[fullbuild.sh]') $( echo_color -t '35' 'Debug') ${@}"
131 # Show an ERROR message then exit with status
133 # $2: exit code number (with 0 does not exit)
140 while getopts 'n' arg; do
142 n) echo_opts="${echo_opts} -n" ;;
145 shift $((OPTIND - 1))
146 echo ${echo_opts} "$( echo_color -t '36' '[fullbuild.sh]') $( echo_color -t '31' 'Error') ${1}" >&2
147 if [[ -n "${2:-}" ]]; then
157 _msg_error "fullbuild.sh has been killed by the user."
163 options="${share_options} -a ${arch} ${cha}"
165 if [[ ! -e "${work_dir}/fullbuild.${cha}_${arch}" ]]; then
166 _msg_info "Build ${cha} with ${arch} architecture."
167 sudo bash ${script_path}/build.sh ${options}
168 touch "${work_dir}/fullbuild.${cha}_${arch}"
170 sudo pacman -Sccc --noconfirm > /dev/null 2>&1
172 if [[ ! -e "${work_dir}/fullbuild.${cha}_${arch}_jp" ]]; then
173 _msg_info "Build the Japanese version of ${cha} on the ${arch} architecture."
174 sudo bash ${script_path}/build.sh -j ${options}
175 touch "${work_dir}/fullbuild.${cha}_${arch}_jp"
177 sudo pacman -Sccc --noconfirm > /dev/null 2>&1
181 echo "usage ${0} [options]"
183 echo " General options:"
184 echo " -a <options> Set other options in build.sh"
185 echo " -d Use the default build.sh arguments. (${default_options})"
186 echo " -g Use gitversion."
187 echo " -h This help message."
188 echo " -r Set the number of retries."
189 echo " Defalut: ${retry}"
190 echo " -s Enable simulation mode."
193 echo "Do not set channel or architecture with -a."
194 echo "Be sure to enclose the build.sh argument with '' to avoid mixing it with the fullbuild.sh argument."
195 echo "Example: ${0} -a '-b -k zen'"
200 default_options="-b --noconfirm -l"
202 while getopts 'a:dghrs' arg; do
204 a) share_options="${share_options} ${OPTARG}" ;;
205 d) share_options="${share_options} ${default_options}" ;;
207 if [[ ! -d "${script_path}/.git" ]]; then
208 _msg_error "There is no git directory. You need to use git clone to use this feature."
211 share_options="${share_options} --gitversion"
215 r) retry="${OPTARG}" ;;
220 shift $((OPTIND - 1))
222 trap 'trap_exit' 1 2 3 15
224 if [[ ! -d "${work_dir}" ]]; then
225 mkdir -p "${work_dir}"
228 for cha in ${channnels[@]}; do
229 for arch in ${architectures[@]}; do
230 for i in $(seq 1 ${retry}); do
231 if [[ "${simulation}" = true ]]; then
232 echo "build.sh ${share_options} -a ${arch} ${cha}"
241 _msg_info "All editions have been built"