Bash script to update your DbFace installation

Installation issues. DbFace, making Oracle, SQL Server, PostgreSQL, MongoDB work with DbFace.
Site Admin
Posts: 36
Joined: Tue Oct 17, 2017 5:21 am

Bash script to update your DbFace installation

Postby admin » Wed May 23, 2018 11:58 am

Save the bash script ( into config directory, execute

Code: Select all

cd config/
chmod a+x

This script will download the latest DbFace product file and update your current installation.
Please change the BACKUP_DIR and DBFACE_INSTALLATION_DIR, if you are not running this script at other directory(not config/)

Code: Select all

# (version:0.1)
# update & partial dbface backup
# 1. create folder user/backup
# 2. zip application/, plugins/, system/ to user/backup/
# 3. download zip from download link and save file to root folder
# 4. overwrite application, plugins, system folders with the files in the zip

NOW=$(date +"%Y%m%d%H%M%s")

# The directory for saving the download file and backup files
# The dbface installation Directory, use absolute URL

PHPVersion=$(php -v | grep -Eo "PHP [[:digit:]]+.[[:digit:]]+" | tail -c -4);
echo "Check PHP Version: ${PHPVersion}";

echo "Download the latest DbFace product file from ${DOWNLOAD_URL}";

echo "Prepare the backup directory"
if [ ! -d "${BACKUP_DIR}" ]; then
  mkdir ${BACKUP_DIR}

mkdir ${BACKUP_DIR}/${NOW}

# copy current version to local directory
echo "Backup current installation to local directory"
mkdir ${BACKUP_DIR}/${NOW}/local
cp -R ${DBFACE_INSTALLATION_DIR}/application ${BACKUP_DIR}/${NOW}/local/
cp -R ${DBFACE_INSTALLATION_DIR}/plugins ${BACKUP_DIR}/${NOW}/local/
cp ${DBFACE_INSTALLATION_DIR}/index.php ${BACKUP_DIR}/${NOW}/local/

echo "Start download DbFace product file";

echo "Unzip product file into ${BACKUP_DIR}/${NOW}/remote";
unzip ${BACKUP_DIR}/${NOW}/ -x "user*" -q -d ${BACKUP_DIR}/${NOW}/remote

echo "copy back all remote updated files to installation directory"
cp -ar ${BACKUP_DIR}/${NOW}/remote/application/. ${DBFACE_INSTALLATION_DIR}/application
cp -ar ${BACKUP_DIR}/${NOW}/remote/system/. ${DBFACE_INSTALLATION_DIR}/system
cp -ar ${BACKUP_DIR}/${NOW}/remote/config/. ${DBFACE_INSTALLATION_DIR}/config
cp -ar ${BACKUP_DIR}/${NOW}/remote/plugins/. ${DBFACE_INSTALLATION_DIR}/plugins
cp -ar ${BACKUP_DIR}/${NOW}/remote/static/. ${DBFACE_INSTALLATION_DIR}/static
cp ${BACKUP_DIR}/${NOW}/remote/index.php ${DBFACE_INSTALLATION_DIR}/

echo "done"

#== EOF ==