Update build.func

This commit is contained in:
CanbiZ 2025-05-22 14:55:49 +02:00
parent 74931496f6
commit 36ae2dab59

View File

@ -1166,30 +1166,30 @@ EOF
# fi # fi
# } # }
api_exit_script() { # api_exit_script() {
exit_code=$? # exit_code=$?
if [ $exit_code -ne 0 ]; then # if [ $exit_code -ne 0 ]; then
case $exit_code in # case $exit_code in
100) post_update_to_api "failed" "100: Unexpected error in create_lxc.sh" ;; # 100) post_update_to_api "failed" "100: Unexpected error in create_lxc.sh" ;;
101) post_update_to_api "failed" "101: No network connection detected in create_lxc.sh" ;; # 101) post_update_to_api "failed" "101: No network connection detected in create_lxc.sh" ;;
200) post_update_to_api "failed" "200: LXC creation failed in create_lxc.sh" ;; # 200) post_update_to_api "failed" "200: LXC creation failed in create_lxc.sh" ;;
201) post_update_to_api "failed" "201: Invalid Storage class in create_lxc.sh" ;; # 201) post_update_to_api "failed" "201: Invalid Storage class in create_lxc.sh" ;;
202) post_update_to_api "failed" "202: User aborted menu in create_lxc.sh" ;; # 202) post_update_to_api "failed" "202: User aborted menu in create_lxc.sh" ;;
203) post_update_to_api "failed" "203: CTID not set in create_lxc.sh" ;; # 203) post_update_to_api "failed" "203: CTID not set in create_lxc.sh" ;;
204) post_update_to_api "failed" "204: PCT_OSTYPE not set in create_lxc.sh" ;; # 204) post_update_to_api "failed" "204: PCT_OSTYPE not set in create_lxc.sh" ;;
205) post_update_to_api "failed" "205: CTID cannot be less than 100 in create_lxc.sh" ;; # 205) post_update_to_api "failed" "205: CTID cannot be less than 100 in create_lxc.sh" ;;
206) post_update_to_api "failed" "206: CTID already in use in create_lxc.sh" ;; # 206) post_update_to_api "failed" "206: CTID already in use in create_lxc.sh" ;;
207) post_update_to_api "failed" "207: Template not found in create_lxc.sh" ;; # 207) post_update_to_api "failed" "207: Template not found in create_lxc.sh" ;;
208) post_update_to_api "failed" "208: Error downloading template in create_lxc.sh" ;; # 208) post_update_to_api "failed" "208: Error downloading template in create_lxc.sh" ;;
209) post_update_to_api "failed" "209: Container creation failed, but template is intact in create_lxc.sh" ;; # 209) post_update_to_api "failed" "209: Container creation failed, but template is intact in create_lxc.sh" ;;
*) post_update_to_api "failed" "Unknown error, exit code: $exit_code in create_lxc.sh" ;; # *) post_update_to_api "failed" "Unknown error, exit code: $exit_code in create_lxc.sh" ;;
esac # esac
fi # fi
} # }
if command -v pveversion >/dev/null 2>&1; then # if command -v pveversion >/dev/null 2>&1; then
trap 'api_exit_script' EXIT # trap 'api_exit_script' EXIT
fi # fi
trap 'post_update_to_api "failed" "$BASH_COMMAND"' ERR # trap 'post_update_to_api "failed" "$BASH_COMMAND"' ERR
trap 'post_update_to_api "failed" "INTERRUPTED"' SIGINT # trap 'post_update_to_api "failed" "INTERRUPTED"' SIGINT
trap 'post_update_to_api "failed" "TERMINATED"' SIGTERM # trap 'post_update_to_api "failed" "TERMINATED"' SIGTERM