1
0
Fork 0

add color

This commit is contained in:
VirtuBox 2018-09-13 17:26:38 +02:00
parent 1b06a3f963
commit 3ae489cc79
1 changed files with 16 additions and 14 deletions

View File

@ -61,37 +61,39 @@ alias nginxconf=mynginxconf
MAINTENANCE_APT() {
# Colors
# Colors
CSI='\033['
CEND="${CSI}0m"
CRED="${CSI}1;31m"
CGREEN="${CSI}1;32m"
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
echo -e ' APT UPDATE '
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
## Updates package lists
sudo apt update
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
echo -e ' APT FULL-UPGRADE '
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
## Updates packages and libraries
sudo apt full-upgrade -y
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
echo -e ' APT-GET AUTOREMOVE '
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
## Removes unneeded packages
sudo apt-get -y --purge autoremove
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
echo -e ' DEBORPHAN '
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
## Removes unused config files
if [ ! -x /usr/bin/deborphan ]; then
apt install deborphan -y
fi
sudo deborphan -n --find-config | xargs sudo apt-get -y --purge autoremove
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
echo -e ' APT AUTOCLEAN '
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
## Removes package files that can no longer be downloaded and everything except
# the lock file in /var/cache/apt/archives, including directories.
sudo apt-get -y autoclean
@ -99,15 +101,15 @@ MAINTENANCE_APT() {
## clean packages in deinstall state
DEINSTALLED=$(sudo dpkg --get-selections | grep deinstall | cut -f1)
if [ ! -z "$DEINSTALLED" ]; then
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
echo -e ' CLEAN DEINSTALL PACKAGES '
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
sudo dpkg --get-selections | grep deinstall | cut -f1 | xargs dpkg --purge
fi
if [ -x /usr/bin/docker ]; then
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
echo -e ' DOCKER CLEANUP '
echo "#############################################"
echo "[${CGREEN}#############################################${CEND}]"
list_images=$(docker images --filter "dangling=true" -q --no-trunc)
list_volumes=$(docker volume ls -qf dangling=true)
if [ ! -z "$list_images" ]; then