Update guardian.sh
This commit is contained in:
parent
18c3b2979d
commit
660d8a21cb
@ -25,48 +25,46 @@ check_container_storage
|
|||||||
check_container_resources
|
check_container_resources
|
||||||
|
|
||||||
if [[ ! -d "/opt/guardian" ]] ; then
|
if [[ ! -d "/opt/guardian" ]] ; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if check_for_gh_release "guardian" "HydroshieldMKII/Guardian" ; then
|
if check_for_gh_release "guardian" "HydroshieldMKII/Guardian" ; then
|
||||||
msg_info "Stopping Services"
|
msg_info "Stopping Services"
|
||||||
systemctl stop guardian-backend guardian-frontend
|
systemctl stop guardian-backend guardian-frontend
|
||||||
msg_ok "Stopped Services"
|
msg_ok "Stopped Services"
|
||||||
|
|
||||||
|
if [[ -f "/opt/guardian/backend/plex-guard.db" ]] ; then
|
||||||
|
msg_info "Saving Database"
|
||||||
|
cp "/opt/guardian/backend/plex-guard.db" "/tmp/plex-guard.db.backup"
|
||||||
|
msg_ok "Database backed up"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -f "/opt/guardian/backend/plex-guard.db" ]] ; then
|
cp /opt/guardian/.env /opt
|
||||||
msg_info "Saving Database"
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "guardian" "HydroshieldMKII/Guardian" "tarball" "latest" "/opt/guardian"
|
||||||
cp "/opt/guardian/backend/plex-guard.db" "/tmp/plex-guard.db.backup"
|
mv /opt/.env /opt/guardian
|
||||||
msg_ok "Database backed up"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp /opt/guardian/.env /opt
|
if [[ -f "/tmp/plex-guard.db.backup" ]] ; then
|
||||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "guardian" "HydroshieldMKII/Guardian" "tarball" "latest" "/opt/guardian"
|
msg_info "Restoring Database"
|
||||||
mv /opt/.env /opt/guardian
|
cp "/tmp/plex-guard.db.backup" "/opt/guardian/backend/plex-guard.db"
|
||||||
|
rm "/tmp/plex-guard.db.backup"
|
||||||
|
msg_ok "Database restored"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -f "/tmp/plex-guard.db.backup" ]] ; then
|
msg_info "Updating Guardian"
|
||||||
msg_info "Restoring Database"
|
cd /opt/guardian/backend
|
||||||
cp "/tmp/plex-guard.db.backup" "/opt/guardian/backend/plex-guard.db"
|
$STD npm ci
|
||||||
rm "/tmp/plex-guard.db.backup"
|
$STD npm run build
|
||||||
msg_ok "Database restored"
|
|
||||||
fi
|
|
||||||
|
|
||||||
msg_info "Updating Guardian"
|
cd /opt/guardian/frontend
|
||||||
cd /opt/guardian/backend
|
$STD npm ci
|
||||||
$STD npm ci
|
$STD DEPLOYMENT_MODE=standalone npm run build
|
||||||
$STD npm run build
|
msg_ok "Updated Guardian"
|
||||||
|
|
||||||
cd /opt/guardian/frontend
|
msg_info "Starting Services"
|
||||||
$STD npm ci
|
systemctl start guardian-backend guardian-frontend
|
||||||
$STD DEPLOYMENT_MODE=standalone npm run build
|
msg_ok "Started Services"
|
||||||
|
msg_ok "Updated Successfully"
|
||||||
msg_ok "Updated Guardian"
|
|
||||||
|
|
||||||
msg_info "Starting Services"
|
|
||||||
systemctl start guardian-backend guardian-frontend
|
|
||||||
msg_ok "Started Services"
|
|
||||||
msg_ok "Updated Successfully"
|
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user