changed path of backup directory inside the package directory to avoid cluttering up package directory.

This commit is contained in:
2026-02-12 20:38:40 -05:00
parent 0547e97479
commit 07a6d352b0

View File

@@ -12,7 +12,6 @@ APP_VERSION="5.3.0"
DOC_ROOT="/var/www"
INSTALL_LOC="openlog"
APACHE_CONF_DIR="/etc/apache2/conf-available"
BACKUP_DIR="openlog-previous-installation"
LANDING_PAGE="lognotes.php"
CONFIG_TABLE="configs"
CONFIG_NAME_COLUMN="confname"
@@ -202,7 +201,9 @@ then
abort_exit
else
# proceed with upgrade
mkdir -p backups
datestamp=$(date +%Y-%m-%d_%H:%M:%S)
backupdir=backups/$datestamp
mkdir -p $backupdir
operation="upgraded"
curr_dbname=$(grep dbname $install_path/db.php | head -1 | cut -d\" -f2)
@@ -216,14 +217,14 @@ then
echo "database = $curr_dbname" >> $mysql_opt_file
echo "batch" >> $mysql_opt_file
echo "disable-column-names" >> $mysql_opt_file
# back up existing database
echo "Backing up the current database to the package directory."
mysqldump --defaults-extra-file=$mysql_opt_file --no-tablespaces $curr_dbname > backups/$curr_dbname-$(date +%Y-%m-%d_%H:%M:%S)-backup.sql
mysqldump --defaults-extra-file=$mysql_opt_file --no-tablespaces $curr_dbname > $backupdir/$curr_dbname-$datestamp-backup.sql
# back up existing installation
echo "Backing up current installation to the package directory."
cp -R $install_path backups/$install_loc_in-`date +%Y-%m-%d_%H:%M:%S`-backup
cp -R $install_path $backupdir/$install_loc_in-$datestamp-backup
# delete all existing installation files except db.php
find $install_path/ -mindepth 1 -not -name 'db.php' -delete
@@ -267,6 +268,8 @@ then
echo ""
echo "Setting file ownership . . ."
chown -R $httpd_user_group $install_path
echo "Backups of the previous openlog files and the previous database were made"
echo "and are located in the $backupdir directory."
fi
else
# This was a mistake. Exit now to avoid clobbering another app.