22
33# ##################################################################################################
44# File: .update.sh
5- # Author: [ Vatsal Gupta ( gvatsal60)]
5+ # Author: Vatsal Gupta(@ gvatsal60)
66# Date: 11-Jul-2024
77# Description: This script provides functions to update Linux distributions using their
88# respective package managers.
@@ -102,7 +102,11 @@ os_pkg_update() {
102102 debian)
103103 if [ " $( find /var/lib/apt/lists/* -maxdepth 1 -check_cmd f 2> /dev/null | wc -l) " -eq 0 ]; then
104104 println " Updating ${PKG_MGR_CMD} based packages..."
105- if ! (${PKG_MGR_CMD} update -y && ${PKG_MGR_CMD} upgrade -y && ${PKG_MGR_CMD} autoremove -y && ${PKG_MGR_CMD} dist-upgrade -y); then
105+ if ! (${PKG_MGR_CMD} update -y &&
106+ ${PKG_MGR_CMD} upgrade -y &&
107+ ${PKG_MGR_CMD} dist-upgrade -y &&
108+ ${PKG_MGR_CMD} autoremove -y &&
109+ ${PKG_MGR_CMD} autoclean -y); then
106110 print_err " Error: Update failed."
107111 fi
108112 fi
@@ -127,7 +131,9 @@ os_pkg_update() {
127131 fi
128132
129133 println " Updating ${PKG_MGR_CMD} based packages..."
130- if ! (${PKG_MGR_CMD} update -y && ${PKG_MGR_CMD} upgrade -y && ${PKG_MGR_CMD} autoremove -y); then
134+ if ! (${PKG_MGR_CMD} update -y &&
135+ ${PKG_MGR_CMD} upgrade -y &&
136+ ${PKG_MGR_CMD} autoremove -y); then
131137 print_err " Error: Update failed."
132138 fi
133139 ;;
@@ -142,7 +148,8 @@ os_pkg_update() {
142148 arch)
143149 if [ " $( find /var/cache/pacman/pkg/* 2> /dev/null | wc -l) " -eq 0 ]; then
144150 println " Updating ${PKG_MGR_CMD} based packages..."
145- if ! (${PKG_MGR_CMD} -Syu --noconfirm && ${PKG_MGR_CMD} -Rns " $( ${PKG_MGR_CMD} -Qdtq) " ); then
151+ if ! (${PKG_MGR_CMD} -Syu --noconfirm &&
152+ ${PKG_MGR_CMD} -Rns " $( ${PKG_MGR_CMD} -Qdtq) " ); then
146153 print_err " Error: Update failed."
147154 fi
148155 fi
0 commit comments