repo-gen-key 894 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. root="$(readlink -f $(dirname $BASH_SOURCE)/..)";
  3. . $root/etc/repo.conf
  4. echo "Initializing...";
  5. expect -c "
  6. set timeout 1
  7. log_user 0
  8. spawn gpg --gen-key
  9. expect \"Your selection?\" {
  10. send \"4\r\";
  11. exp_continue;
  12. }
  13. expect \"What keysize do you want? (2048)\" {
  14. send \"\r\";
  15. exp_continue;
  16. }
  17. expect \"Key is valid for? (0)\" {
  18. send \"\r\";
  19. exp_continue;
  20. }
  21. expect \"Is this correct? (y/N)\" {
  22. send \"y\r\";
  23. exp_continue;
  24. }
  25. expect \"Real name:\" {
  26. send \"$reponame Key\r\";
  27. exp_continue;
  28. }
  29. expect \"Email address:\" {
  30. send \"$repokey\r\";
  31. exp_continue;
  32. }
  33. expect \"Comment:\" {
  34. send \"Repository Signing Key\r\";
  35. exp_continue;
  36. }
  37. expect \"Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?\" {
  38. send \"o\r\";
  39. set timeout -1;
  40. log_user 1;
  41. exp_continue;
  42. }
  43. expect eof {
  44. exit
  45. }";
  46. gpg --export-secret-key -a $repokey > $root/etc/repo.key;