repo-update 746 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. root="$(dirname $BASH_SOURCE)/..";
  3. . $root/etc/sites.conf
  4. for val in "${sites[@]}"; do
  5. unset site;
  6. declare -A site;
  7. eval "site=($val)";
  8. host=${site[host]};
  9. user=${site[username]};
  10. echo "Updating $user@$host";
  11. case ${site[type]} in
  12. ssh)
  13. echo -e "\tUploading files";
  14. expect -c "
  15. set timeout 1
  16. log_user 0
  17. spawn scp -r $root/skel $user@$host:${site[root]}
  18. expect yes/no { send yes\r ; exp_continue }
  19. expect password: {
  20. send $(echo ${site[password]} | base64 --decode | gpg -d -q --no-mdc-warning)\r
  21. log_user 1
  22. set timeout -1
  23. }
  24. expect eof {
  25. exit
  26. }
  27. }";
  28. echo -e "\tDone uploading"
  29. ;;
  30. *)
  31. echo -e "\tType '${site[type]}' not implemented.";
  32. esac;
  33. done;