diff --git a/src/freedombone-app-htmly b/src/freedombone-app-htmly index e95a341a..c546b99d 100755 --- a/src/freedombone-app-htmly +++ b/src/freedombone-app-htmly @@ -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