#!/bin/sh # # Copyright (C) 2012,2014,2016 Etersoft # Copyright (C) 2012,2014,2016 Vitaly Lipatov <lav@etersoft.ru> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # __remove_alt_apt_cache_file() { sudocmd rm -vf /var/cache/apt/*.bin sudocmd rm -vf /var/cache/apt/partial/* sudocmd rm -vf /var/lib/apt/lists/*pkglist* sudocmd rm -vf /var/lib/apt/lists/*release* } __remove_deb_apt_cache_file() { sudocmd rm -vf /var/cache/apt/*.bin sudocmd rm -vf /var/cache/apt/archives/partial/* sudocmd rm -vf /var/lib/apt/lists/*Packages* sudocmd rm -vf /var/lib/apt/lists/*Release* sudocmd rm -vf /var/lib/apt/lists/*Translation* } epm_clean() { [ -z "$*" ] || fatal "No arguments are allowed here" case $PMTYPE in apt-rpm) sudocmd apt-get clean [ -n "$force" ] && __remove_alt_apt_cache_file ;; apt-dpkg) sudocmd apt-get clean [ -n "$force" ] && __remove_deb_apt_cache_file ;; aptitude-dpkg) sudocmd aptitude clean [ -n "$force" ] && __remove_deb_apt_cache_file ;; yum-rpm) sudocmd yum clean all #sudocmd yum makecache ;; dnf-rpm) sudocmd dnf clean all ;; urpm-rpm) sudocmd urpmi --clean ;; homebrew) sudocmd brew cleanup -s ;; pacman) sudocmd pacman -Sc --noconfirm ;; zypper-rpm) sudocmd zypper clean ;; nix) sudocmd nix-collect-garbage ;; slackpkg) ;; pkgng) sudocmd pkg clean -a ;; appget|winget) sudocmd $PMTYPE clean ;; xbps) sudocmd xbps-remove -O ;; *) fatal "Have no suitable command for $PMTYPE" ;; esac info "It is recommend to run 'epm autoremove' also" }