From b03dd41137ac37110fa23a7b485a521458ce49c6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 26 Aug 2024 11:23:50 +0200 Subject: [PATCH] pm/clean --- spcd/bootstrap.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index 2ff6903..9e09d47 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -715,8 +715,7 @@ Acquire::https::Verify-Peer False; *) ;; esac spcd_split - spcd_os_printenv "SPCD_PM_CLEAN" \ - "SPCD_PM_INSTALL" "SPCD_PM_QUERY" + spcd_os_printenv "SPCD_PM_INSTALL" "SPCD_PM_QUERY" spcd_split spcd_os_printenv "SPCD_PKG_PKG" "SPCD_PM_CONF_PATH" "SPCD_PM_HTTPS_PATH" # specific @@ -875,11 +874,22 @@ spcd_environment_list_workspace() { # │ steps │ functions │ # ╰───────┴───────────╯ +spcd_clean_cache() { + case "${SPCD_PM}" in + "${SPCD_PM_APK}") apk cache purge ;; + "${SPCD_PM_APT}") apt-get clean ;; + "${SPCD_PM_DNF}") dnf clean all ;; + "${SPCD_PM_PACMAN}") pacman --sync --clean --noconfirm ;; + "${SPCD_PM_ZYPPER}") zypper clean ;; + *) ;; + esac +} + spcd_install_package() { spcd_install_package__name="${1}" if [ -n "${spcd_install_package__name}" ]; then ${SPCD_PM_INSTALL} "${spcd_install_package__name}" - ${SPCD_PM_CLEAN} + spcd_clean_cache fi }