Created
June 11, 2014 06:30
-
-
Save ifdattic/4200774f6c6531d7aefb to your computer and use it in GitHub Desktop.
Initial duplicity automation script using expect (not finished)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set GOOGLE_ACCOUNT "foobar" | |
set GOOGLE_PASSWORD "foobar" | |
# # Watch out !!! | |
# # If you have a '$' in your passphrase, make sure you escape it with '\' | |
set GNUPG_PASSPHRASE "foobar" | |
set VERBOSITY_LEVEL 8 | |
set GOOGLE_BACKUP_DIRECTORY "duplicity-backup" | |
set SOURCE "/Users/foobar/some_dir/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect | |
proc srcfile-safe {filename args} { | |
global argv | |
global GOOGLE_ACCOUNT GOOGLE_PASSWORD GNUPG_PASSPHRASE VERBOSITY_LEVEL GOOGLE_BACKUP_DIRECTORY SOURCE | |
set save $argv | |
set argv $args | |
set rc [catch {source $filename} ret] | |
set argv $save | |
return -code $rc $ret | |
} | |
srcfile-safe config | |
spawn duplicity -v$VERBOSITY_LEVEL $SOURCE gdocs://$GOOGLE_ACCOUNT/$GOOGLE_BACKUP_DIRECTORY | |
expect "Password" { send "$GOOGLE_PASSWORD\r" } | |
expect "GnuPG passphrase:" { send "$GNUPG_PASSPHRASE\r" } | |
expect "Retype passphrase" { send "$GNUPG_PASSPHRASE\r" } | |
interact |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment