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.

42 lines
624 B

  1. #!/bin/sh
  2. set -e
  3. cd "files"
  4. find ! -type d -exec ../sync2.sh '{}' \;
  5. keys=
  6. for x in $HOME/.ssh/*.pub; do
  7. if [ -s "$x" ]; then
  8. keys="$keys $x"
  9. else
  10. rm "$x"
  11. fi
  12. done
  13. ak="$HOME/.ssh/authorized_keys"
  14. if [ -s "$ak" ]; then
  15. while read l; do
  16. found=
  17. for k in $keys; do
  18. read l2 < $k || true
  19. if [ "$l" = "$l2" ]; then
  20. found=yes
  21. echo "$l"
  22. break
  23. fi
  24. done
  25. if [ -z "$found" ]; then
  26. name="$(echo "$l" | cut -d' ' -f3)"
  27. if [ -n "$name" ]; then
  28. echo "$l" > .ssh/$name.pub
  29. fi
  30. fi
  31. done < $ak > $ak~
  32. fi
  33. if ! cmp $ak $ak~; then
  34. diff -u $ak $ak~
  35. mv $ak~ $ak
  36. fi
  37. cd ..
  38. git status --porcelain