From 9d4b842ebfc7fe20b86789cf521474b27b1c278d Mon Sep 17 00:00:00 2001 From: Flashwalker Date: Fri, 11 Nov 2022 15:22:11 +0700 Subject: [PATCH 1/2] Optimisation of apt update: update only added repo during install action --- deb-get | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/deb-get b/deb-get index 1bcd5fb9..8c5ec5d5 100755 --- a/deb-get +++ b/deb-get @@ -222,10 +222,19 @@ function upgrade_apt() { ${ELEVATE} apt-get -q -o Dpkg::Progress-Fancy="1" -y upgrade } +# Update only the added repo (during install action) +function update_only_repo() { + for source in "${@}"; do + echo -e Upating: "\e[0;34m/etc/apt/sources.list.d/${source}.list\e[0m" + ${ELEVATE} apt-get update -o Dir::Etc::sourcelist="sources.list.d/${source}.list" \ + -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" + done +} + function install_apt() { ((PACKAGE_INSTALLATION_TRIES++)) add_apt_repo - if ! update_apt; then + if ! update_only_repo "${APT_LIST_NAME}"; then remove_repo return fi From 023eabb18a2bf66025be67bcdbd85bd9f42acb46 Mon Sep 17 00:00:00 2001 From: Flashwalker Date: Sat, 12 Nov 2022 04:57:01 +0700 Subject: [PATCH 2/2] Optimisation of apt update: fix update_only_repo function --- deb-get | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/deb-get b/deb-get index 8c5ec5d5..08d689db 100755 --- a/deb-get +++ b/deb-get @@ -224,17 +224,15 @@ function upgrade_apt() { # Update only the added repo (during install action) function update_only_repo() { - for source in "${@}"; do - echo -e Upating: "\e[0;34m/etc/apt/sources.list.d/${source}.list\e[0m" - ${ELEVATE} apt-get update -o Dir::Etc::sourcelist="sources.list.d/${source}.list" \ - -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" - done + fancy_message info "Upating: /etc/apt/sources.list.d/${APT_LIST_NAME}.list" + ${ELEVATE} apt-get update -o Dir::Etc::sourcelist="sources.list.d/${APT_LIST_NAME}.list" \ + -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" } function install_apt() { ((PACKAGE_INSTALLATION_TRIES++)) add_apt_repo - if ! update_only_repo "${APT_LIST_NAME}"; then + if ! update_only_repo; then remove_repo return fi