OSDN Git Service

[update] : Added exit code judgment
authorhayao <shun819.mail@gmail.com>
Thu, 1 Oct 2020 09:36:42 +0000 (18:36 +0900)
committerhayao <shun819.mail@gmail.com>
Thu, 1 Oct 2020 09:36:42 +0000 (18:36 +0900)
fullbuild.sh

index 980d9e2..e88b4db 100755 (executable)
@@ -162,19 +162,31 @@ trap_exit() {
 
 
 build() {
+    local _exit_code=0
+
     options="${share_options} -a ${arch} ${cha}"
 
     if [[ ! -e "${work_dir}/fullbuild.${cha}_${arch}" ]]; then
         _msg_info "Build ${cha} with ${arch} architecture."
         sudo bash ${script_path}/build.sh ${options}
-        touch "${work_dir}/fullbuild.${cha}_${arch}"
+        _exit_code="${?}"
+        if [[ "${_exit_code}" = 0 ]]; then
+            touch "${work_dir}/fullbuild.${cha}_${arch}"
+        else
+            _msg_error "build.sh finished with exit code ${_exit_code}. Will try again."
+        fi
     fi
     sudo pacman -Sccc --noconfirm > /dev/null 2>&1
 
     if [[ ! -e "${work_dir}/fullbuild.${cha}_${arch}_jp" ]]; then
         _msg_info "Build the Japanese version of ${cha} on the ${arch} architecture."
         sudo bash ${script_path}/build.sh -j ${options}
-        touch "${work_dir}/fullbuild.${cha}_${arch}_jp"
+        _exit_code="${?}"
+        if [[ "${_exit_code}" = 0 ]]; then
+            touch "${work_dir}/fullbuild.${cha}_${arch}_jp"
+        else
+            _msg_error "build.sh finished with exit code ${_exit_code}. Will try again."
+        fi
     fi
     sudo pacman -Sccc --noconfirm > /dev/null 2>&1
 }