homeclean 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/sh
  2. set -- "$HOME/.bash_history" \
  3. "$HOME/.cache/chromium" \
  4. "$HOME/.cache/emacs" \
  5. "$HOME/.cache/locatedb" \
  6. "$HOME/.cache/qutebrowser" \
  7. "$HOME/.cache/thumbnails" \
  8. "$HOME/.config/gtk-2.0" \
  9. "$HOME/.config/gtk-3.0" \
  10. "$HOME/.config/qutebrowser/bookmarks" \
  11. "$HOME/.config/qutebrowser/quickmarks" \
  12. "$HOME/.esd_auth" \
  13. "$HOME/.fehbg" \
  14. "$HOME/.geiser_history.*" \
  15. "$HOME/.gtk-bookmarks" \
  16. "$HOME/.guile_history" \
  17. "$HOME/.lesshst" \
  18. "$HOME/.local/share/fish" \
  19. "$HOME/.local/share/qutebrowser" \
  20. "$HOME/.local/share/webkit" \
  21. "$HOME/.mpv/watch_later" \
  22. "$HOME/.mtap.fuseiso" \
  23. "$HOME/.mu" \
  24. "$HOME/.pulse-cookie" \
  25. "$HOME/.python_history" \
  26. "$HOME/.thumbnails" \
  27. "$HOME/.tramp_history" \
  28. "$HOME/.units_history" \
  29. "$HOME/.wget-hsts" \
  30. "$HOME/.w3m"
  31. echo "==> Files to be removed (beside trash):"
  32. echo "$@" | sed 's/ /\n/g'
  33. echo
  34. echo "==> Critical data:"
  35. for i in ~/.cache/mail ~/.password-store "$PERSONAL" ~/.ssh/*.pub; do
  36. [ -e "$i" ] && echo ":: WARNING: Found '$i'."
  37. done
  38. if [ -n "$(gpg --list-secret-keys)" ]; then
  39. echo ":: WARNING: Found PGP secret keys."
  40. fi
  41. CHOICE="N"
  42. echo
  43. echo ":: WARNING: Please close all applications before proceeding."
  44. echo -n "==> Clean home? (y/N) "
  45. read -r CHOICE
  46. case "$CHOICE" in
  47. Y|y) ;;
  48. *)
  49. echo "Nothing done."
  50. exit ;;
  51. esac
  52. echo
  53. echo "==> Empty trash:"
  54. if ! command -v trash-empty >/dev/null 2>&1; then
  55. echo ":: 'trash-empty' not installed, you must clean other drives manually."
  56. rm -rvf "$HOME/.local/share/Trash"
  57. else
  58. trash-empty
  59. fi
  60. echo
  61. echo "==> Delete garbage in $HOME:"
  62. rm -rvf "$@"