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] [channel]"
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."
192 echo " !! WARNING !!"
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'"
197 echo "Run \"build.sh -h\" for channel details."
199 "${script_path}/build.sh" --channellist
203 share_options="--noconfirm"
204 default_options="-b -l"
206 while getopts 'a:dghrs' arg; do
208 a) share_options="${share_options} ${OPTARG}" ;;
209 d) share_options="${share_options} ${default_options}" ;;
211 if [[ ! -d "${script_path}/.git" ]]; then
212 _msg_error "There is no git directory. You need to use git clone to use this feature."
215 share_options="${share_options} --gitversion"
219 r) retry="${OPTARG}" ;;
224 shift $((OPTIND - 1))
226 if [[ -n "${*}" ]]; then
230 _msg_info "Options: ${share_options}"
231 _msg_info "Press Enter to continue or Ctrl + C to cancel."
235 trap 'trap_exit' 1 2 3 15
237 if [[ ! -d "${work_dir}" ]]; then
238 mkdir -p "${work_dir}"
241 for cha in ${channnels[@]}; do
242 for arch in ${architectures[@]}; do
243 for i in $(seq 1 ${retry}); do
244 if [[ "${simulation}" = true ]]; then
245 echo "build.sh ${share_options} -a ${arch} ${cha}"
254 _msg_info "All editions have been built"