More directory creations on restore

This commit is contained in:
Bob Mottram 2018-01-19 17:31:16 +00:00
parent 23e52b615d
commit 940101b74c
2 changed files with 44 additions and 2 deletions

View File

@ -13,7 +13,7 @@
# License
# =======
#
# Copyright (C) 2015-2017 Bob Mottram <bob@freedombone.net>
# Copyright (C) 2015-2018 Bob Mottram <bob@freedombone.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@ -464,6 +464,9 @@ function restore_gpg {
if [ -d $temp_restore_dir/home/$USERNAME/.gnupg ]; then
cp -r $temp_restore_dir/home/$USERNAME/.gnupg /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/.gnupg ]; then
mkdir /home/$USERNAME/.gnupg
fi
cp -r $temp_restore_dir/* /home/$USERNAME/.gnupg/
fi
if [ ! "$?" = "0" ]; then
@ -543,6 +546,9 @@ function restore_spamassassin {
if [ -d $temp_restore_dir/home/$USERNAME ]; then
cp -rf $temp_restore_dir/home/$USERNAME/.spamassassin /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/.spamassassin ]; then
mkdir /home/$USERNAME/.spamassassin
fi
cp -rf $temp_restore_dir/* /home/$USERNAME/.spamassassin/
fi
if [ ! "$?" = "0" ]; then
@ -611,6 +617,9 @@ function restore_user_ssh_keys {
if [ -d $temp_restore_dir/home/$USERNAME/.ssh ]; then
cp -r $temp_restore_dir/home/$USERNAME/.ssh /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/.ssh ]; then
mkdir /home/$USERNAME/.ssh
fi
cp -r $temp_restore_dir/* /home/$USERNAME/.ssh/
fi
if [ ! "$?" = "0" ]; then
@ -680,6 +689,9 @@ function restore_user_monkeysphere {
if [ -d $temp_restore_dir/home/$USERNAME/.monkeysphere ]; then
cp -r $temp_restore_dir/home/$USERNAME/.monkeysphere /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/.monkeysphere ]; then
mkdir /home/$USERNAME/.monkeysphere
fi
cp -r $temp_restore_dir/* /home/$USERNAME/.monkeysphere
fi
if [ ! "$?" = "0" ]; then
@ -721,6 +733,9 @@ function restore_user_fin {
if [ -d $temp_restore_dir/home/$USERNAME/.fin ]; then
cp -r $temp_restore_dir/home/$USERNAME/.fin /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/.fin ]; then
mkdir /home/$USERNAME/.fin
fi
cp -r $temp_restore_dir/* /home/$USERNAME/.fin/
fi
if [ ! "$?" = "0" ]; then
@ -754,6 +769,9 @@ function restore_user_local {
if [ -d $temp_restore_dir/home/$USERNAME/.local ]; then
cp -r $temp_restore_dir/home/$USERNAME/.local /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/.local ]; then
mkdir /home/$USERNAME/.local
fi
cp -r $temp_restore_dir/* /home/$USERNAME/.local/
fi
if [ ! "$?" = "0" ]; then
@ -840,6 +858,9 @@ function restore_personal_settings {
if [ -d $temp_restore_dir/home/$USERNAME/personal ]; then
mv $temp_restore_dir/home/$USERNAME/personal /home/$USERNAME
else
if [ ! -d /home/$USERNAME/personal ]; then
mkdir /home/$USERNAME/personal
fi
cp -r $temp_restore_dir/* /home/$USERNAME/personal/
fi
if [ ! "$?" = "0" ]; then

View File

@ -13,7 +13,7 @@
# License
# =======
#
# Copyright (C) 2015-2017 Bob Mottram <bob@freedombone.net>
# Copyright (C) 2015-2018 Bob Mottram <bob@freedombone.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@ -419,6 +419,9 @@ function restore_gpg {
if [ -d ${temp_restore_dir}/home/$USERNAME/.gnupg ]; then
cp -r ${temp_restore_dir}/home/$USERNAME/.gnupg /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/.gnupg ]; then
mkdir /home/$USERNAME/.gnupg
fi
cp -r ${temp_restore_dir}/* /home/$USERNAME/.gnupg/
fi
if [ ! "$?" = "0" ]; then
@ -488,6 +491,9 @@ function restore_spamassassin {
if [ -d $temp_restore_dir/home/$USERNAME ]; then
cp -rf $temp_restore_dir/home/$USERNAME/.spamassassin /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/.spamassassin ]; then
mkdir /home/$USERNAME/.spamassassin
fi
cp -rf $temp_restore_dir/* /home/$USERNAME/.spamassassin/
fi
if [ ! "$?" = "0" ]; then
@ -542,6 +548,9 @@ function restore_ssh_keys {
if [ -d $temp_restore_dir/home/$USERNAME/.ssh ]; then
cp -r $temp_restore_dir/home/$USERNAME/.ssh /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/.ssh ]; then
mkdir /home/$USERNAME/.ssh
fi
cp -r $temp_restore_dir/* /home/$USERNAME/.ssh/
fi
if [ ! "$?" = "0" ]; then
@ -607,6 +616,9 @@ function restore_user_monkeysphere {
if [ -d $temp_restore_dir/home/$USERNAME/.monkeysphere ]; then
cp -r $temp_restore_dir/home/$USERNAME/.monkeysphere /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/.monkeysphere ]; then
mkdir /home/$USERNAME/.monkeysphere
fi
cp -r $temp_restore_dir/* /home/$USERNAME/.monkeysphere/
fi
if [ ! "$?" = "0" ]; then
@ -646,6 +658,9 @@ function restore_user_fin {
if [ -d $temp_restore_dir/home/$USERNAME/.fin ]; then
cp -r $temp_restore_dir/home/$USERNAME/.fin /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/.fin ]; then
mkdir /home/$USERNAME/.fin
fi
cp -r $temp_restore_dir/* /home/$USERNAME/.fin/
fi
if [ ! "$?" = "0" ]; then
@ -677,6 +692,9 @@ function restore_user_local {
if [ -d $temp_restore_dir/home/$USERNAME/.local ]; then
cp -r $temp_restore_dir/home/$USERNAME/.local /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/.local ]; then
mkdir /home/$USERNAME/.local
fi
cp -r $temp_restore_dir/* /home/$USERNAME/.local/
fi
if [ ! "$?" = "0" ]; then
@ -757,6 +775,9 @@ function restore_personal_settings {
fi
mv $temp_restore_dir/home/$USERNAME/personal /home/$USERNAME
else
if [ ! -d /home/$USERNAME/personal ]; then
mkdir /home/$USERNAME/personal
fi
cp -r $temp_restore_dir/* /home/$USERNAME/personal/
fi
if [ ! "$?" = "0" ]; then