Safer restore
This commit is contained in:
parent
d6400e0a04
commit
f2d5af32dc
|
@ -220,7 +220,6 @@ function restore_local_htmly {
|
|||
HTMLY_DOMAIN_NAME=$(get_completion_param "htmly domain")
|
||||
fi
|
||||
if [ $HTMLY_DOMAIN_NAME ]; then
|
||||
echo $"Restoring htmly installation"
|
||||
temp_restore_dir=/root/temphtmly
|
||||
if [ -d $USB_MOUNT/backup/htmly ]; then
|
||||
restore_directory_from_usb $temp_restore_dir htmly
|
||||
|
@ -228,11 +227,17 @@ function restore_local_htmly {
|
|||
restore_directory_from_usb $temp_restore_dir blog
|
||||
fi
|
||||
if [ -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs ]; then
|
||||
rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
|
||||
if [ -d /var/www/${HTMLY_DOMAIN_NAME}/previous ]; then
|
||||
rm -rf /var/www/${HTMLY_DOMAIN_NAME}/previous
|
||||
fi
|
||||
mv /var/www/${HTMLY_DOMAIN_NAME}/htdocs /var/www/${HTMLY_DOMAIN_NAME}/previous
|
||||
fi
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name htdocs)
|
||||
cp -r ${temp_source_dir} /var/www/${HTMLY_DOMAIN_NAME}/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
if [ -d /var/www/${HTMLY_DOMAIN_NAME}/previous ]; then
|
||||
mv /var/www/${HTMLY_DOMAIN_NAME}/previous /var/www/${HTMLY_DOMAIN_NAME}/htdocs
|
||||
fi
|
||||
set_user_permissions
|
||||
backup_unmount_drive
|
||||
exit 593
|
||||
|
@ -288,11 +293,17 @@ function restore_remote_htmly {
|
|||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir htmly
|
||||
if [ -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs ]; then
|
||||
rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
|
||||
if [ -d /var/www/${HTMLY_DOMAIN_NAME}/previous ]; then
|
||||
rm -rf /var/www/${HTMLY_DOMAIN_NAME}/previous
|
||||
fi
|
||||
mv /var/www/${HTMLY_DOMAIN_NAME}/htdocs /var/www/${HTMLY_DOMAIN_NAME}/previous
|
||||
fi
|
||||
temp_source_dir=$(find ${temp_restore_dir} -name htdocs)
|
||||
cp -r ${temp_source_dir} /var/www/${HTMLY_DOMAIN_NAME}/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
if [ -d /var/www/${HTMLY_DOMAIN_NAME}/previous ]; then
|
||||
mv /var/www/${HTMLY_DOMAIN_NAME}/previous /var/www/${HTMLY_DOMAIN_NAME}/htdocs
|
||||
fi
|
||||
exit 593
|
||||
fi
|
||||
rm -rf ${temp_restore_dir}
|
||||
|
|
|
@ -125,6 +125,9 @@ function restore_local_mailpile {
|
|||
cp -r ${temp_source_dir} /var/www/${MAILPILE_DOMAIN_NAME}/mail/
|
||||
if [ ! "$?" = "0" ]; then
|
||||
if [ -d mv /var/www/${MAILPILE_DOMAIN_NAME}/mail/.previous ]; then
|
||||
if [ -d /var/www/${MAILPILE_DOMAIN_NAME}/mail/.previous ]; then
|
||||
rm -rf /var/www/${MAILPILE_DOMAIN_NAME}/mail/.previous
|
||||
fi
|
||||
mv /var/www/${MAILPILE_DOMAIN_NAME}/mail/.previous /var/www/${MAILPILE_DOMAIN_NAME}/mail/.local
|
||||
fi
|
||||
backup_unmount_drive
|
||||
|
|
Loading…
Reference in New Issue