Another copy of my dotfiles. Because I don't completely trust GitHub.
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.

35 lines
1.2 KiB

  1. #!/bin/bash
  2. #pidof emacs && emacsclient -e '(org-caldav-sync)' # Sync emacs-caldav as well
  3. eval "$(grep -h -- \
  4. "^\s*\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\|XDG_DATA_HOME\|XDG_CONFIG_HOME\)=" \
  5. "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \
  6. "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" "$HOME/.pam_environment" 2>/dev/null)"
  7. export CALCURSE_CALDAV_PASSWORD=$(pass show Server/drive.yigitcolakoglu.com/yigitcolakoglu)
  8. lock=$(mktemp)
  9. rm -f $lock
  10. calcurse-caldav --lockfile $lock # Prevent lock file conflicts
  11. tmpfile=$(mktemp)
  12. destfile=$(mktemp)
  13. wget -q 'https://drive.yigitcolakoglu.com/remote.php/dav/addressbooks/users/yigitcolakoglu/contacts/?export' \
  14. --user yigitcolakoglu \
  15. --password "$(pass show Server/drive.yigitcolakoglu.com/yigitcolakoglu)" \
  16. -O $tmpfile
  17. abook --convert \
  18. --informat vcard \
  19. --infile $tmpfile \
  20. --outformat abook \
  21. --outfile $destfile
  22. vdirsyncer sync
  23. rm $tmpfile
  24. chmod 600 $destfile
  25. sed -Ei 's/([0-9]) ([0-9])/\1\2/g' $destfile
  26. sed -Ei 's/\+([0-9])/\1/g' $destfile
  27. mv $destfile "$XDG_DATA_HOME"/abook/addressbook