Maintenance: I used this code with Ubuntu. Will it work with Deepin?
Tofloor
poster avatar
mykahveli
deepin
2016-09-20 07:34
Author
  1. #!/bin/bash
  2. echo -e
  3. echo -e
  4. YELLOW="\033[1;33m"
  5. RED="\033[0;31m"
  6. ENDCOLOR="\033[0m"
  7. echo -e $RED"================Kali-Cleaner========================================"$ENDCOLOR
  8. echo -e $RED"=      Little cleaner for Kali by MasterButcher [:]                ="$ENDCOLOR
  9. echo -e $RED"===================================================================="$ENDCOLOR
  10. echo -e
  11. echo -e
  12.                                                                                                                                                                                                                                          
  13. OLDCONF=$(dpkg -l|grep "^rc"|awk '{print $2}')
  14. CURKERNEL=$(uname -r|sed 's/-*[a-z]//g'|sed 's/-386//g')
  15. LINUXPKG="linux-(image|headers|debian-modules|restricted-modules)"
    YELLOW="\033[1;33m"
  16. RED="\033[0;31m"
  17. ENDCOLOR="\033[0m"

  18. if [ $USER != root ]; then
  19. echo -e $RED"[Kali-cleaner]:Error: must be root"
  20. echo -e $YELLOW"[Kali-cleaner]:Exiting..."$ENDCOLOR
  21. exit 0
  22. fi

  23. echo -e $YELLOW"[Kali-cleaner]:Cleaning apt cache..."$ENDCOLOR
  24. sudo apt-get clean

  25. echo -e $YELLOW"[Kali-cleaner]:Removing old config files..."$ENDCOLOR
  26. sudo apt-get purge $OLDCONF

  27. echo -e $YELLOW"[Kali-cleaner]:Removing old kernels..."$ENDCOLOR
  28. sudo apt-get purge $OLDKERNELS

  29. echo -e $YELLOW"[Kali-cleaner]:Emptying every trashes..."$ENDCOLOR
  30. rm -rf /home/*/.local/share/Trash/*/** &> /dev/null
  31. rm -rf /root/.local/share/Trash/*/** &> /dev/null

  32. dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

  33. apt-get update
  34. apt-get -y upgrade
  35. apt-get dist-upgrade
  36. apt-get install update-manager-core
  37. do-release-upgrade

  38. apt-get -f install
  39. apt-get -y autoremove
  40. apt-get -y autoclean
  41. apt-get -y clean

  42. echo -e $YELLOW"Script Finished!"$ENDCOLOR

  43. echo -e $YELLOW"[Kali-cleaner]:Script Finished!"$ENDCOLOR
  44. echo -e
  45. echo -e $RED"Goodbye........."$ENDCOLOR

  46. shutdown -P now
Copy the Code

Reply Favorite View the author
All Replies
horvan
deepin
2016-09-20 08:38
#1
Deepin has its own kernel so if you try to remove it, This may broke your system

Line 29 and 32 are missing an -y switch
Reply View the author
mykahveli
deepin
2016-09-21 07:36
#2
https://bbs.deepin.org/post/31532
Deepin has its own kernel so if you try to remove it, This may broke your system

Line 29 and 32 are ...

Thanks! So, which lines do you suggest to remove in order to make the script work without hassle?
Reply View the author
horvan
deepin
2016-09-22 08:07
#3
Edited by horvan at 2016-9-21 17:11

Try to replace line 17

with

# x=$(dpkg --list | grep -i linux-image | grep ^rc| awk '{ print $2}')
# echo "$x"
# apt-get --purge remove $xnix craft will give you the details
and add a # befor 41.

line 41 does something but I don't now what it exactly does

You can try this whitout risk but 41 may be risky!



Reply View the author
New Thread

Popular Ranking

Change

Popular Events

More
国际排名
WHLUG