From 1872df0021ea5a8c14bdbb981a4eba46e6ecfbd7 Mon Sep 17 00:00:00 2001 From: David Faulkner Date: Thu, 6 Aug 2026 03:56:08 -0500 Subject: perf(apt): pass parallel download flags to apt update and full-upgrade - Define APT_OPT macro with Acquire::Queue-Mode="access" and Acquire::http::Pipeline-Depth="10" - Update apt update and apt full-upgrade commands to utilize parallel fetching - Accelerate package download phases without modifying global system configuration --- main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 8377585..c23ff04 100644 --- a/main.c +++ b/main.c @@ -20,6 +20,9 @@ #define MAX_MSG_LEN 128 #define MAX_LINE_LEN 1024 +/* Optimization flags for parallel package downloads */ +#define APT_OPT "-o Acquire::Queue-Mode=\"access\" -o Acquire::http::Pipeline-Depth=\"10\"" + /** * @brief Prints an underlined section header. * @@ -114,8 +117,9 @@ static int count_upgradable_packages(void) { } int main(void) { - /* Step 1: Update local package index */ - run_task("UPDATING LOCAL CACHE `apt update`", "sudo apt update"); + /* Step 1: Update local package index with parallel fetch queue */ + run_task("UPDATING LOCAL CACHE `apt update`", + "sudo apt " APT_OPT " update"); /* Step 2: Query for upgrades */ int upgrade_count = count_upgradable_packages(); @@ -131,7 +135,9 @@ int main(void) { upgrade_count, (upgrade_count > 1) ? "S" : ""); if (bytes > 0 && (size_t)bytes < sizeof(msg)) { - run_task(msg, "sudo apt full-upgrade -y"); + char cmd[MAX_CMD_LEN]; + snprintf(cmd, sizeof(cmd), "sudo apt " APT_OPT " full-upgrade -y"); + run_task(msg, cmd); } } -- cgit v1.2.3