apt
This commit is contained in:
parent
103d0b68df
commit
65aed2c1aa
@ -37,7 +37,9 @@ should_apt_last_update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_pkg_mgr() {
|
get_pkg_mgr() {
|
||||||
if is_command apt-get ; then
|
if is_command apt ; then
|
||||||
|
echo "apt"
|
||||||
|
elif is_command apt-get ; then
|
||||||
echo "apt-get"
|
echo "apt-get"
|
||||||
elif is_command rpm ; then
|
elif is_command rpm ; then
|
||||||
# Then check if dnf or yum is the package manager
|
# Then check if dnf or yum is the package manager
|
||||||
@ -54,14 +56,14 @@ pkgmgr_update(){
|
|||||||
# Get Command language
|
# Get Command language
|
||||||
PKG_MANAGER=$( get_pkg_mgr )
|
PKG_MANAGER=$( get_pkg_mgr )
|
||||||
|
|
||||||
# Run apt-get update for distros that use apt-get
|
# Run apt update for distros that use apt
|
||||||
if [ "$PKG_MANAGER" == "apt-get" ] ; then
|
if [ "$PKG_MANAGER" =~ "apt" ] ; then
|
||||||
if should_apt_last_update ; then
|
if should_apt_last_update ; then
|
||||||
"${PKG_MANAGER} update"
|
"${PKG_MANAGER} update"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PKG_MANAGER" == "apt-get" ] ; then
|
if [ "$PKG_MANAGER" =~ "apt" ] ; then
|
||||||
"$PKG_MANAGER" full-upgrade -y
|
"$PKG_MANAGER" full-upgrade -y
|
||||||
elif [ "$PKG_MANAGER" == "dnf" ] ; then
|
elif [ "$PKG_MANAGER" == "dnf" ] ; then
|
||||||
"$PKG_MANAGER" update
|
"$PKG_MANAGER" update
|
||||||
@ -107,7 +109,7 @@ pkgmgr_clean(){
|
|||||||
|
|
||||||
printf "$COL_YELLOW" "Cleaning cache for $PKG_MANAGER"
|
printf "$COL_YELLOW" "Cleaning cache for $PKG_MANAGER"
|
||||||
|
|
||||||
if [ "$PKG_MANAGER" == "apt-get" ] ; then
|
if [ "$PKG_MANAGER" =~ "apt" ] ; then
|
||||||
"$PKG_MANAGER" clean
|
"$PKG_MANAGER" clean
|
||||||
"$PKG_MANAGER" autoclean
|
"$PKG_MANAGER" autoclean
|
||||||
"$PKG_MANAGER" autoremove -y
|
"$PKG_MANAGER" autoremove -y
|
||||||
@ -134,8 +136,8 @@ install_pkg() {
|
|||||||
# Get Command language
|
# Get Command language
|
||||||
PKG_MANAGER=$( get_pkg_mgr )
|
PKG_MANAGER=$( get_pkg_mgr )
|
||||||
|
|
||||||
# Run apt-get update for distros that use apt-get
|
# Run apt update for distros that use apt
|
||||||
if [ "$PKG_MANAGER" == "apt-get" ] ; then
|
if [ "$PKG_MANAGER" =~ "apt" ] ; then
|
||||||
if should_apt_last_update ; then
|
if should_apt_last_update ; then
|
||||||
"${PKG_MANAGER} update"
|
"${PKG_MANAGER} update"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user