Skip to content

Commit

Permalink
Amend scripts and config
Browse files Browse the repository at this point in the history
  • Loading branch information
mreid-tt committed Sep 17, 2024
1 parent 5ae3728 commit ff3f35d
Show file tree
Hide file tree
Showing 8 changed files with 390 additions and 124 deletions.
1 change: 1 addition & 0 deletions spk/wallabag/src/conf/resource
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"gd",
"gettext",
"iconv",
"imagick",
"intl",
"pdo_mysql"
],
Expand Down
29 changes: 21 additions & 8 deletions spk/wallabag/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,23 @@ service_postinst ()

# Restore configuration and data
echo "Restoring configuration and data to ${WEB_DIR}"
rsync -aX --update -I "${TEMPDIR}/${SYNOPKG_PKGNAME}" "${WEB_DIR}/" 2>&1
rsync -aX -I "${TEMPDIR}/config/parameters.yml" "${CFG_FILE}" 2>&1
if [ -d ${TEMPDIR}/images ]; then
rsync -aX -I "${TEMPDIR}/images" "${WEB_ROOT}/web/assets/" 2>&1
fi

# Update database password
sed -i "s/^\(\s*define('DB_PASS',\s*'\).*\(');\s*\)$/\1${wizard_mysql_password_wallabag}\2/" ${WEB_ROOT}/config/config.php
sed -i "s/^\(\s*database_password:\s*\).*\(\s*\)$/\1${wizard_mysql_database_password}\2/" ${CFG_FILE}

# Restore the Database
echo "Restoring database to ${MYSQL_DATABASE}"
${MYSQL} -u root -p"${wizard_mysql_password_root}" ${MYSQL_DATABASE} < ${TEMPDIR}/database/${MYSQL_DATABASE}-dbbackup.sql 2>&1

# Run update scripts
exec_php "${WEB_ROOT}/public/upgrade/console.php"
exec_php "${WEB_ROOT}/public/install/plugin-console.php" "update_all"
# migrate database
if ! exec_php ${WEB_ROOT}/bin/console doctrine:migrations:migrate --env=prod -n -vvv > ${WEB_ROOT}/migration.log 2>&1; then
echo "Unable to migrate database schema. Please check the log: ${WEB_ROOT}/migration.log"
return
fi

# Clean-up temporary files
${RM} "${TEMPDIR}"
Expand Down Expand Up @@ -246,7 +251,11 @@ service_preuninst ()

# Backup Directories
echo "Copying previous configuration and data from ${WEB_ROOT}"
rsync -aX "${WEB_ROOT}" "${TEMPDIR}/" 2>&1
${MKDIR} "${TEMPDIR}/config"
rsync -aX "${CFG_FILE}" "${TEMPDIR}/config/" 2>&1
if [ -d ${WEB_ROOT}/web/assets/images ]; then
rsync -aX "${WEB_ROOT}/web/assets/images" "${TEMPDIR}/" 2>&1
fi

# Backup the Database
echo "Copying previous database from ${MYSQL_DATABASE}"
Expand Down Expand Up @@ -320,14 +329,18 @@ service_save ()
[ -d ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME} ] && ${RM} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}
mkdir -p ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}
mv ${CFG_FILE} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/
mv ${WEB_ROOT}/data/db ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/
if [ -d ${WEB_ROOT}/web/assets/images ]; then
mv ${WEB_ROOT}/web/assets/images ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/
fi
}

service_restore ()
{
# Restore configuration
mv ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/parameters.yml ${CFG_FILE}
mv ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/db ${WEB_ROOT}/data/db
if [ -d ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/images ]; then
mv ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/images ${WEB_ROOT}/web/assets/
fi
${RM} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}

# Fix permissions
Expand Down
1 change: 1 addition & 0 deletions spk/wallabag/src/web/wallabag.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"gd",
"gettext",
"iconv",
"imagick",
"intl",
"pdo_mysql"
],
Expand Down
79 changes: 0 additions & 79 deletions spk/wallabag/src/wizard/install_uifile

This file was deleted.

Loading

0 comments on commit ff3f35d

Please sign in to comment.