s243a

CleanMounts

Jun 21st, 2018
86
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. ROOT=/mnt/sdc6/TazPup
  3. declare -a  dirs_to_clean=\
  4. ( "/etc" "/DEBIAN" "/bin" "/etc" "/lib" "/lib64" \
  5.    "/opt" "/root" "/sbin" "/var" "/usr" "/var" \
  6. )
  7. while read line; do
  8.   umount -l "$line"
  9.   rmdir $line
  10. done < <(  mount  | grep "$ROOT" | grep -v '/TazPup/Full' | sed -n -E 's/^.*[ ]([^ ]*\/TazPup[^ ]*)[ ].*$/\1/p'  )
  11. if [ ${#ROOT} -lt 2 ]; then
  12.   exit
  13. fi
  14. for DIR in ${dirs_to_clean[@]}; do
  15.   rm -rf $ROOT$DIR
  16. done
RAW Paste Data