3 script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && pwd )"
23 # usage: echo_color -b <backcolor> -t <textcolor> -d <decoration> [Text]
46 # You can specify multiple decorations with ;.
47 # 0 => All attributs off (ノーマル)
49 # 4 => Underscore (下線)
51 # 7 => Reverse video on (色反転)
65 while getopts 'b:t:d:n' arg; do
67 b) backcolor="${OPTARG}" ;;
68 t) textcolor="${OPTARG}" ;;
69 d) decotypes="${OPTARG}" ;;
70 n) echo_opts="-n -e" ;;
76 echo ${echo_opts} "\e[$([[ -v backcolor ]] && echo -n "${backcolor}"; [[ -v textcolor ]] && echo -n ";${textcolor}"; [[ -v decotypes ]] && echo -n ";${decotypes}")m${*}\e[m"
80 # Show an INFO message
87 while getopts 'n' arg; do
89 n) echo_opts="${echo_opts} -n" ;;
93 echo ${echo_opts} "$( echo_color -t '36' '[fullbuild.sh]') $( echo_color -t '32' 'Info') ${*}"
97 # Show an Warning message
104 while getopts 'n' arg; do
106 n) echo_opts="${echo_opts} -n" ;;
109 shift $((OPTIND - 1))
110 echo ${echo_opts} "$( echo_color -t '36' '[fullbuild.sh]') $( echo_color -t '33' 'Warning') ${*}" >&2
114 # Show an debug message
121 while getopts 'n' arg; do
123 n) echo_opts="${echo_opts} -n" ;;
126 shift $((OPTIND - 1))
127 if [[ ${debug} = true ]]; then
128 echo ${echo_opts} "$( echo_color -t '36' '[fullbuild.sh]') $( echo_color -t '35' 'Debug') ${*}"
133 # Show an ERROR message then exit with status
135 # $2: exit code number (with 0 does not exit)
142 while getopts 'n' arg; do
144 n) echo_opts="${echo_opts} -n" ;;
147 shift $((OPTIND - 1))
148 echo ${echo_opts} "$( echo_color -t '36' '[fullbuild.sh]') $( echo_color -t '31' 'Error') ${1}" >&2
149 if [[ -n "${2:-}" ]]; then
159 _msg_error "fullbuild.sh has been killed by the user."
165 options="${share_options} -a ${arch} ${cha}"
167 if [[ ! -e "${work_dir}/fullbuild.${cha}_${arch}" ]]; then
168 _msg_info "Build ${cha} with ${arch} architecture."
169 sudo bash ${script_path}/build.sh ${options}
170 touch "${work_dir}/fullbuild.${cha}_${arch}"
172 sudo pacman -Sccc --noconfirm > /dev/null 2>&1
174 if [[ ! -e "${work_dir}/fullbuild.${cha}_${arch}_jp" ]]; then
175 _msg_info "Build the Japanese version of ${cha} on the ${arch} architecture."
176 sudo bash ${script_path}/build.sh -j ${options}
177 touch "${work_dir}/fullbuild.${cha}_${arch}_jp"
179 sudo pacman -Sccc --noconfirm > /dev/null 2>&1
183 echo "usage ${0} [options] [channel]"
185 echo " General options:"
186 echo " -a <options> Set other options in build.sh"
187 echo " -c Build all channel (DO NOT specify the channel !!)"
188 echo " -d Use the default build.sh arguments. (${default_options})"
189 echo " -g Use gitversion."
190 echo " -h This help message."
191 echo " -m <architecture> Set the architecture to build."
192 echo " -r <interer> Set the number of retries."
193 echo " Defalut: ${retry}"
194 echo " -s Enable simulation mode."
196 echo " !! WARNING !!"
197 echo " Do not set channel or architecture with -a."
198 echo " Be sure to enclose the build.sh argument with '' to avoid mixing it with the fullbuild.sh argument."
199 echo " Example: ${0} -a '-b -k zen'"
201 echo "Run \"build.sh -h\" for channel details."
203 "${script_path}/build.sh" --channellist
207 share_options="--noconfirm"
208 default_options="-b -l -u alter -p alter"
210 while getopts 'a:dghr:sc' arg; do
212 a) share_options="${share_options} ${OPTARG}" ;;
213 c) all_channel=true ;;
214 d) share_options="${share_options} ${default_options}" ;;
215 m) architectures=(${OPTARG}) ;;
217 if [[ ! -d "${script_path}/.git" ]]; then
218 _msg_error "There is no git directory. You need to use git clone to use this feature."
221 share_options="${share_options} --gitversion"
225 r) retry="${OPTARG}" ;;
230 shift $((OPTIND - 1))
233 if [[ "${all_channel}" = true ]]; then
234 if [[ -n "${*}" ]]; then
235 _msg_error "Do not specify the channel." "1"
237 channnels=($("${script_path}/build.sh" --channellist))
239 elif [[ -n "${*}" ]]; then
243 _msg_info "Options: ${share_options}"
244 _msg_info "Press Enter to continue or Ctrl + C to cancel."
248 trap 'trap_exit' 1 2 3 15
250 if [[ ! -d "${work_dir}" ]]; then
251 mkdir -p "${work_dir}"
254 for cha in ${channnels[@]}; do
255 for arch in ${architectures[@]}; do
256 if [[ "${simulation}" = true ]]; then
257 echo "build.sh ${share_options} -a ${arch} ${cha}"
258 echo "build.sh ${share_options} -j -a ${arch} ${cha}"
260 for i in $(seq 1 ${retry}); do
261 if [[ -n $(cat "${script_path}/channels/${cha}/architecture" | grep -h -v ^'#' | grep -x "${arch}") ]]; then
270 if [[ "${simulation}" = false ]]; then
271 _msg_info "All editions have been built"