Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- GPG_BIN="/usr/bin/gpg"
- GPG_CMD="--gen-key --no-use-agent"
- EXPECT_CMD="/usr/bin/expect"
- #### GPG Paam ###
- GPG_NAME="Demo Name"
- GPG_EMAIL="demo@mail.com"
- GPG_PASSPHASE="aaa"
- EXPECT_STR=$($EXPECT_CMD -c "
- spawn $GPG_BIN $GPG_CMD
- expect \"Your selection?\"
- send \"1\r\"
- expect \"What keysize do you want?\"
- send \"2048\r\"
- expect \"Key is valid for?\"
- send \"365\r\"
- expect \"Is this correct?\"
- send \"y\r\"
- expect \"Real name:\"
- send \"$GPG_NAME\r\"
- expect \"Email address:\"
- send \"$GPG_EMAIL\r\"
- expect \"Comment:\"
- send \"$GPG_COMMENT\r\"
- expect \"Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?\"
- send \"O\r\"
- expect \"Enter passphrase:\"
- send \"$GPG_PASSPHASE\r\"
- expect \"Repeat passphrase:\"
- send \"$GPG_PASSPHASE\r\"
- expect eof
- ")
- echo "$EXPECT_STR"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement