diff --git a/ct/wikijs.sh b/ct/wikijs.sh index 0db786df3..deaca6f32 100644 --- a/ct/wikijs.sh +++ b/ct/wikijs.sh @@ -33,22 +33,18 @@ function update_script() { NODE_VERSION="26" NODE_MODULE="yarn,node-gyp" setup_nodejs if check_for_gh_release "wikijs" "requarks/wiki-v2"; then - #msg_info "Verifying whether ${APP}' new release is v3.x+ and current install uses SQLite." - #SQLITE_INSTALL=$([ -f /opt/wikijs/db.sqlite ] && echo "true" || echo "false") - #if [[ "${SQLITE_INSTALL}" == "true" && "${CHECK_UPDATE_RELEASE}" =~ ^3.* ]]; then - # echo "SQLite is not supported in v3.x+, currently there is no update path availble." - # exit - #fi - #msg_ok "There is an update path available for ${APP}" + # Installs before February 2025 use SQLite, newer ones PostgreSQL + SQLITE_INSTALL=$([[ -f /opt/wikijs/db.sqlite ]] && echo "true" || echo "false") msg_info "Stopping Service" systemctl stop wikijs msg_ok "Stopped Service" msg_info "Backing up Data" - mkdir /opt/wikijs-backup - #$SQLITE_INSTALL && - cp /opt/wikijs/db.sqlite /opt/wikijs-backup + mkdir -p /opt/wikijs-backup + if [[ "$SQLITE_INSTALL" == "true" ]]; then + cp /opt/wikijs/db.sqlite /opt/wikijs-backup + fi cp -R /opt/wikijs/{config.yml,/data} /opt/wikijs-backup msg_ok "Backed up Data" @@ -56,8 +52,9 @@ function update_script() { msg_info "Restoring Data" cp -R /opt/wikijs-backup/* /opt/wikijs - #$SQLITE_INSTALL && - $STD npm rebuild sqlite3 + if [[ "$SQLITE_INSTALL" == "true" ]]; then + $STD npm rebuild sqlite3 + fi rm -rf /opt/wikijs-backup msg_ok "Restored Data"