fix: ensure update_script exits with error code on failure
This commit is contained in:
@@ -57,7 +57,7 @@ function update_script() {
|
|||||||
# Ensure LocalAGI source install and service exist before update flow.
|
# Ensure LocalAGI source install and service exist before update flow.
|
||||||
if [[ ! -d /opt/localagi || ! -f /etc/systemd/system/localagi.service ]]; then
|
if [[ ! -d /opt/localagi || ! -f /etc/systemd/system/localagi.service ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Pull latest release and refresh source tree if a new version is available.
|
# Pull latest release and refresh source tree if a new version is available.
|
||||||
@@ -90,7 +90,7 @@ function update_script() {
|
|||||||
msg_ok "Configured LocalAGI backend mode: ${BACKEND}"
|
msg_ok "Configured LocalAGI backend mode: ${BACKEND}"
|
||||||
if [[ ! -f /opt/localagi/.env ]]; then
|
if [[ ! -f /opt/localagi/.env ]]; then
|
||||||
msg_warn "Missing /opt/localagi/.env. Recreate by running install script again."
|
msg_warn "Missing /opt/localagi/.env. Recreate by running install script again."
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -q '^LOCALAGI_LLM_API_URL=http://127.0.0.1:8081$' /opt/localagi/.env; then
|
if grep -q '^LOCALAGI_LLM_API_URL=http://127.0.0.1:8081$' /opt/localagi/.env; then
|
||||||
@@ -110,14 +110,14 @@ function update_script() {
|
|||||||
# Rebuild the project from source.
|
# Rebuild the project from source.
|
||||||
if ! build_localagi_source; then
|
if ! build_localagi_source; then
|
||||||
msg_error "Failed to build LocalAGI from source"
|
msg_error "Failed to build LocalAGI from source"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restart service with rebuilt binary and current env settings.
|
# Restart service with rebuilt binary and current env settings.
|
||||||
msg_info "Starting LocalAGI Service"
|
msg_info "Starting LocalAGI Service"
|
||||||
if ! systemctl restart localagi; then
|
if ! systemctl restart localagi; then
|
||||||
msg_error "Failed to start LocalAGI service"
|
msg_error "Failed to start LocalAGI service"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
msg_ok "Started LocalAGI (${BACKEND})"
|
msg_ok "Started LocalAGI (${BACKEND})"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user