3 script_path="$(readlink -f ${0%/*})"
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 " -d Use the default build.sh arguments. (${default_options})"
188 echo " -g Use gitversion."
189 echo " -h This help message."
190 echo " -m <architecture> Set the architecture to build."
191 echo " -r <interer> Set the number of retries."
192 echo " Defalut: ${retry}"
193 echo " -s Enable simulation mode."
195 echo " !! WARNING !!"
196 echo " Do not set channel or architecture with -a."
197 echo " Be sure to enclose the build.sh argument with '' to avoid mixing it with the fullbuild.sh argument."
198 echo " Example: ${0} -a '-b -k zen'"
200 echo "Run \"build.sh -h\" for channel details."
202 "${script_path}/build.sh" --channellist
206 share_options="--noconfirm"
207 default_options="-b -l"
209 while getopts 'a:dghr:s' arg; do
211 a) share_options="${share_options} ${OPTARG}" ;;
212 d) share_options="${share_options} ${default_options}" ;;
213 m) architectures=(${OPTARG}) ;;
215 if [[ ! -d "${script_path}/.git" ]]; then
216 _msg_error "There is no git directory. You need to use git clone to use this feature."
219 share_options="${share_options} --gitversion"
223 r) retry="${OPTARG}" ;;
228 shift $((OPTIND - 1))
230 if [[ -n "${*}" ]]; then
234 _msg_info "Options: ${share_options}"
235 _msg_info "Press Enter to continue or Ctrl + C to cancel."
239 trap 'trap_exit' 1 2 3 15
241 if [[ ! -d "${work_dir}" ]]; then
242 mkdir -p "${work_dir}"
245 for cha in ${channnels[@]}; do
246 for arch in ${architectures[@]}; do
247 for i in $(seq 1 ${retry}); do
248 if [[ "${simulation}" = true ]]; then
249 echo "build.sh ${share_options} -a ${arch} ${cha}"
258 _msg_info "All editions have been built"