![]() |
tell application "Finder" display dialog "Do you want to backup your home folder to the server?" & return & ¬ return & "This will overwrite your current backup." & return & ¬ return buttons {"Cancel", "More Options", "OK"} default button 1 with icon caution if button returned of result is "More Options" then display dialog "Do you want to view your current backup or restore it?" & return ¬ & return buttons {"Cancel", "View Backup", "Restore Backup"} default button 2 if button returned of result is "View Backup" then set usern to do shell script "echo $USER" display dialog "Please enter your password." default answer "" set pass to text returned of the result -- The next line requires customization -- For SMB servers use: -- mount volume "smb://" & usern & ":" & pass & "@youserver.yourdomain.com/Users" mount volume "afp://yourserver.yourdomain.com/Users" as user name usern with password pass set openFolder to "Users:" & usern open folder openFolder else if button returned of result is "Restore Backup" then set usern to do shell script "echo $USER" display dialog "Warning: this will overwrite the contents of your current home folder with the contents of your backup" ¬ & return & return & "To continue, Please enter your password." default answer "" ¬ buttons {"Cancel", "OK"} default button 1 with icon caution set pass to text returned of the result -- The next line requires customization -- For SMB servers use: -- mount volume "smb://" & usern & ":" & pass & "@youserver.yourdomain.com/Users" mount volume "afp://yourserver.yourdamin.com/Users" as user name usern with password pass with timeout of 7200 seconds do shell script "rsync -a --delete --force --exclude=Library/Favorites/Documents /Volumes/Users/" ¬ & usern & " /Users/" end timeout eject disk "Users" display dialog "Backup Successfully Restored" buttons {"OK"} default button 1 end if end if else if button returned of result is "OK" then set usern to do shell script "echo $USER" display dialog "Please enter your password." default answer "" set pass to text returned of the result -- The next line requires customization -- For SMB servers use: -- mount volume "smb://" & usern & ":" & pass & "@youserver.yourdomain.com/Users" mount volume "afp://yourserver.yourdomain.com/Users" as user name usern with password pass with timeout of 7200 seconds do shell script "rsync -a --delete --force /Users/" & usern & " /Volumes/Users/" end timeout eject disk "Users" display dialog "Home Directory Successfully Backed-Up" buttons {"OK"} default button 1 end if end if end tell |
|||