This commit is contained in:
2021-10-19 16:36:21 -04:00
parent 8dbb3d0bb3
commit 64f6c11503
8 changed files with 448 additions and 33 deletions

View File

@@ -14,9 +14,7 @@ useradd_cmd=("useradd" "--create-home")
restore="no"
if [[ -d /mnt/array/home-retired/"$user" ]]; then
if ask_ok "Restore user $user's files from backup /mnt/array/home-retired/$user?"; then
restore="yes"
fi
ask_ok "Restore user $user's files from /mnt/array/home-retired/$user?" && restore="yes"
fi
! ask_ok "Create user $username with password $password?" || exit $?
@@ -32,7 +30,8 @@ ask_ok "Enable shared file access for user $username?" && \
if [[ "$restore" == "yes" ]]; then
if rsync -av --progress=info2 /mnt/array/home-retired/"$user" /home/"$user"; then
rm -rf /mnt/array/home-retired/"$user"
ask_ok "User $user's files successfully restored, remove backup at /mnt/array/home-retired/$user?" && \
rm -rf /mnt/array/home-retired/"$user"
fi
fi