Skip to content

Commit

Permalink
Optimisation of apt update: update only added repo during install act…
Browse files Browse the repository at this point in the history
…ion (#657)
  • Loading branch information
Flashwalker authored Nov 11, 2022
1 parent 84f8727 commit a8d3a03
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion deb-get
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,17 @@ 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() {
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_apt; then
if ! update_only_repo; then
remove_repo
return
fi
Expand Down

0 comments on commit a8d3a03

Please # to comment.