Update linkwarden.sh

Tweak `function update_script()`
This commit is contained in:
tteckster 2024-04-09 17:56:35 -04:00 committed by GitHub
parent 112353334d
commit a6add9a727
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 23 additions and 14 deletions

View File

@ -55,22 +55,31 @@ function default_settings() {
function update_script() { function update_script() {
header_info header_info
if [[ ! -d /opt/linkwarden ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /opt/linkwarden ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_info "Updating $APP"
RELEASE=$(curl -s https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_info "Stopping ${APP}"
systemctl stop linkwarden systemctl stop linkwarden
msg_ok "Stopped ${APP}"
msg_info "Updating ${APP} to ${RELEASE}"
cd /opt/linkwarden cd /opt/linkwarden
if git pull | grep -q 'Already up to date'; then
msg_ok "Already up to date"
systemctl start linkwarden
exit
fi
git pull git pull
yarn yarn
npx playwright install-deps npx playwright install-deps
yarn prisma generate yarn prisma generate
yarn build yarn build
yarn prisma migrate deploy yarn prisma migrate deploy
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}"
msg_info "Starting ${APP}"
systemctl start linkwarden systemctl start linkwarden
msg_ok "Updated $APP" msg_ok "Started ${APP}"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}."
fi
exit exit
} }