Homework 13: Backup

Due Monday, May 7, at 10:30 (start of the final exam)

For this homework, create a backup program and a restore program. The program will archive all the files in your home directory, or a different directory if the user specifies it. Use tar to archive files. The program should support these options: Change the file extension depending on what options have been selected. For a standard tar archive, the extension is .tar. Additional options may add more extensions. Possibilities for extension are:
backup.tar
backup.tar.gz
backup.tar.bz2
backup.tar.aes
backup.tar.gz.aes
backup.tar.bz2.aes
-z and -j cannot both be specified. Your program can either refuse to create a backup, or compress with -j if both are specified, but should NOT compress with both methods (do not create backup.tar.gz.bz2.aes). The program operates like this:
  1. Make a tar archive of the files in your home directory (recursive if specified).
  2. Use gzip or bzip2 if requested by command line options (this can be combined with step 1 using tar options if you like.
  3. Encrypt the file, if specified by the command line option

The restore program

The unpack program should not take any parameters except for the name of the backup to unpack. It should use the file extensions to determine what needs to be done (decompress or decrypt). If you need to decrypt the file, do that first, then decompress and unarchive.
The user should not be prompted for any input except by aespipe (which asks for a password). Do not use the input statement in your program.

Turning in the assignment

Breaking tradition with past assignments, name your backup program "backup", and your restore program "restore". Grading will be as follows (50 points total this assignment)