2013-05-15 11:08:39 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-12-29 10:37:22 +01:00
|
|
|
set -- "$HOME/.cache/dwb" \
|
2015-04-04 14:44:19 +02:00
|
|
|
"$HOME/.cache/emacs/backups" \
|
|
|
|
"$HOME/.cache/emacs/elpa/archives" \
|
|
|
|
"$HOME/.cache/emacs/elpa/gnupg" \
|
|
|
|
"$HOME/.cache/emacs/ido.last" \
|
|
|
|
"$HOME/.cache/emacs/saveplace" \
|
2014-11-12 16:15:39 +01:00
|
|
|
"$HOME/.cache/mutt" \
|
|
|
|
"$HOME/.cache/rtorrent" \
|
|
|
|
"$HOME/.cache/zsh" \
|
|
|
|
"$HOME/.cmus/autosave" \
|
|
|
|
"$HOME/.cmus/cache" \
|
|
|
|
"$HOME/.cmus/lib.pl" \
|
|
|
|
"$HOME/.cmus/playlist.pl" \
|
|
|
|
"$HOME/.cmus/queue.pl" \
|
|
|
|
"$HOME/.cmus/resume" \
|
|
|
|
"$HOME/.cmus/search-history" \
|
|
|
|
"$HOME/.config/dwb/default/commands.history" \
|
|
|
|
"$HOME/.config/dwb/default/cookies" \
|
|
|
|
"$HOME/.config/dwb/default/cookies_session.allow" \
|
|
|
|
"$HOME/.config/dwb/default/dwb-uni.fifo" \
|
|
|
|
"$HOME/.config/dwb/default/history" \
|
|
|
|
"$HOME/.config/dwb/default/hsts" \
|
|
|
|
"$HOME/.config/dwb/default/navigate.history" \
|
|
|
|
"$HOME/.config/dwb/default/plugindb" \
|
|
|
|
"$HOME/.config/dwb/default/plugins.allow" \
|
|
|
|
"$HOME/.config/dwb/default/scripts.allow" \
|
|
|
|
"$HOME/.config/dwb/default/search.history" \
|
|
|
|
"$HOME/.config/dwb/default/session" \
|
|
|
|
"$HOME/.config/gtk-2.0" \
|
|
|
|
"$HOME/.config/gtk-3.0" \
|
|
|
|
"$HOME/.config/ranger/bookmarks" \
|
|
|
|
"$HOME/.config/ranger/history" \
|
|
|
|
"$HOME/.config/ranger/tagged" \
|
|
|
|
"$HOME/.fehbg" \
|
|
|
|
"$HOME/.gtk-bookmarks" \
|
|
|
|
"$HOME/.lesshst" \
|
|
|
|
"$HOME/.local/share/newsbeuter" \
|
|
|
|
"$HOME/.local/share/webkit" \
|
|
|
|
"$HOME/.mpv/watch_later" \
|
|
|
|
"$HOME/.mtap.fuseiso" \
|
|
|
|
"$HOME/.pulse-cookie" \
|
|
|
|
"$HOME/.viminfo" \
|
|
|
|
"$HOME/.w3m" \
|
|
|
|
"$HOME/.zcompdump"
|
2013-05-15 11:08:39 +02:00
|
|
|
|
2013-12-29 10:37:22 +01:00
|
|
|
## POSIX can store only one list at a time. Here we rely on the fact there is no
|
|
|
|
## space in the file names.
|
2015-09-12 16:09:01 +02:00
|
|
|
RMLIST_CRITICAL="$HOME/.mutt.pwds.cpt $HOME/.ssh/"
|
2013-08-14 02:33:34 +02:00
|
|
|
|
|
|
|
echo "==> List of files to be removed."
|
2013-12-29 10:37:22 +01:00
|
|
|
echo "$@" | sed 's/ /\n/g'
|
2013-08-14 02:33:34 +02:00
|
|
|
echo
|
|
|
|
echo "==> List of files to be wiped."
|
2013-12-29 10:37:22 +01:00
|
|
|
echo "$RMLIST_CRITICAL" | sed 's/ /\n/g'
|
2013-05-15 11:08:39 +02:00
|
|
|
|
|
|
|
CHOICE="N"
|
2013-05-15 14:22:08 +02:00
|
|
|
echo
|
2014-09-23 09:34:47 +02:00
|
|
|
echo ":: Remember to close all applications for cleaning."
|
2013-05-15 11:08:39 +02:00
|
|
|
echo "==> Clean home? [y/N]"
|
|
|
|
read CHOICE
|
|
|
|
CHOICE="$(echo $CHOICE | tr [:lower:] [:upper:])"
|
|
|
|
if [ "$CHOICE" != "Y" ]; then
|
2014-11-12 16:15:39 +01:00
|
|
|
echo "Nothing done."
|
|
|
|
exit
|
2013-05-15 11:08:39 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
## Clean trash if possible.
|
2013-08-14 02:33:34 +02:00
|
|
|
echo
|
|
|
|
echo "==> Emptying trash."
|
2014-01-03 19:13:07 +01:00
|
|
|
if ! command -v trash-empty >/dev/null 2>&1; then
|
2014-11-12 16:15:39 +01:00
|
|
|
echo ":: 'trash-empty' not installed, you have to clean other drives manually."
|
|
|
|
rm -rvf "$HOME/.local/share/Trash"
|
2013-05-15 11:08:39 +02:00
|
|
|
else
|
2014-11-12 16:15:39 +01:00
|
|
|
trash-empty
|
2013-05-15 11:08:39 +02:00
|
|
|
fi
|
|
|
|
|
2013-08-14 02:33:34 +02:00
|
|
|
## Remove data.
|
2013-05-15 14:46:08 +02:00
|
|
|
echo
|
2013-12-29 10:37:22 +01:00
|
|
|
echo "==> Remove dotfiles."
|
|
|
|
rm -rvf "$@"
|
2013-05-15 11:08:39 +02:00
|
|
|
|
2013-08-14 02:33:34 +02:00
|
|
|
## Wipe data
|
|
|
|
echo
|
2013-12-29 10:37:22 +01:00
|
|
|
echo "==> Remove critical data."
|
2014-04-24 10:01:58 +02:00
|
|
|
if [ "$(echo "$HOME" | grep -c ' ')" -ne 0 ]; then
|
2014-11-12 16:15:39 +01:00
|
|
|
echo 'WARNING: $HOME contains spaces, skipping.'
|
2013-12-30 02:20:45 +01:00
|
|
|
else
|
2014-11-12 16:15:39 +01:00
|
|
|
shred -zuv $RMLIST_CRITICAL
|
|
|
|
# wipe -rdzp2 $RMLIST_CRITICAL
|
2013-12-29 10:37:22 +01:00
|
|
|
fi
|
2013-08-14 02:33:34 +02:00
|
|
|
|
2013-05-15 11:08:39 +02:00
|
|
|
echo
|
|
|
|
echo "==> Cleaning done."
|