Restoring blog directory

This commit is contained in:
Bob Mottram 2016-10-29 13:41:49 +01:00
parent a3ebf299cd
commit 58d1b6e16f
1 changed files with 20 additions and 14 deletions

View File

@ -42,14 +42,14 @@ HTMLY_TITLE="My Htmly"
HTMLY_SUBTITLE="Another ${PROJECT_NAME} Htmly"
htmly_variables=(HTMLY_REPO
HTMLY_COMMIT
HTMLY_DOMAIN_NAME
HTMLY_CODE
HTMLY_TITLE
HTMLY_SUBTITLE
ONION_ONLY
DDNS_PROVIDER
MY_USERNAME)
HTMLY_COMMIT
HTMLY_DOMAIN_NAME
HTMLY_CODE
HTMLY_TITLE
HTMLY_SUBTITLE
ONION_ONLY
DDNS_PROVIDER
MY_USERNAME)
function set_avatar_from_url {
AVATAR="$1"
@ -228,14 +228,17 @@ function restore_local_htmly {
temp_restore_dir=/root/temphtmly
restore_directory_from_usb $temp_restore_dir blog
restore_directory_from_usb $temp_restore_dir htmly
rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
cp -r $temp_restore_dir/var/www/${HTMLY_DOMAIN_NAME}/htdocs /var/www/${HTMLY_DOMAIN_NAME}/
if [ -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs ]; then
rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
fi
temp_source_dir=$(find ${temp_restore_dir} -name htdocs | sed 's/\.//g')
cp -r ${temp_restore_dir}${temp_source_dir} /var/www/${HTMLY_DOMAIN_NAME}/
if [ ! "$?" = "0" ]; then
set_user_permissions
backup_unmount_drive
exit 593
fi
rm -rf $temp_restore_dir
rm -rf ${temp_restore_dir}
if [ ! -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content ]; then
echo $"No content directory found after restoring htmly"
set_user_permissions
@ -285,12 +288,15 @@ function restore_remote_htmly {
mkdir $temp_restore_dir
function_check restore_directory_from_friend
restore_directory_from_friend $temp_restore_dir htmly
rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
cp -r $temp_restore_dir/var/www/${HTMLY_DOMAIN_NAME}/htdocs /var/www/${HTMLY_DOMAIN_NAME}/
if [ -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs ]; then
rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
fi
temp_source_dir=$(find ${temp_restore_dir} -name htdocs | sed 's/\.//g')
cp -r ${temp_restore_dir}${temp_source_dir} /var/www/${HTMLY_DOMAIN_NAME}/
if [ ! "$?" = "0" ]; then
exit 593
fi
rm -rf $temp_restore_dir
rm -rf ${temp_restore_dir}
if [ ! -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content ]; then
echo $"No content directory found after restoring htmly"
exit 287