You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.3 KiB

4 years ago
4 years ago
4 years ago
  1. #!/bin/bash
  2. info(){
  3. printf "[\e[32mINFO\e[0m]:%s\n" "$1"
  4. }
  5. prompt(){
  6. printf "[\e[35mPROMPT\e[0m]: %s" "$1"
  7. read -r ans
  8. printf "%s" "$ans"
  9. }
  10. error(){
  11. printf "[\e[31mERROR\e[0m]:%s\n" "$1"
  12. }
  13. while 1; do
  14. info "Please select the image file: "
  15. loc=$(find "$HOME" -name "*.jpg" | fzf --height=15)
  16. if [ -z "$loc" ]; then
  17. info "Continuing with the installation..."
  18. exit
  19. fi
  20. jsteg reveal "$loc" 2> /dev/null > /tmp/out.zip.gpg
  21. if [ ! -f "/tmp/out.zip.gpg" ]; then
  22. retry=$(prompt "No file found in $loc, would you like to try again(Y/n)?")
  23. if [ "$retry" = "n" ]; then
  24. exit
  25. else
  26. continue
  27. fi
  28. fi
  29. break
  30. done
  31. while 1; do
  32. info "Please enter your passphrase: "
  33. gpg -d /tmp/out.zip.gpg > /tmp/out.zip
  34. if [ ! $? = 0 ]; then
  35. retry=$(prompt "You might have entered the wrong password, would you like to try again(Y/n)?")
  36. if [ "$retry" = "n" ]; then
  37. exit
  38. else
  39. continue
  40. fi
  41. fi
  42. break
  43. done
  44. unzip /tmp/out.zip -d /tmp/keys
  45. gpg --import /tmp/keys/gpg.key
  46. mkdir -p ~/.ssh
  47. chmod 700 ~/.ssh
  48. cp /tmp/keys/id_* ~/.ssh
  49. mkdir -p ~/.config/weechat/certs/
  50. cp /tmp/keys/*.pem ~/.config/weechat/certs