← Back to davo.co
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Faulkner <[email protected]>2026-08-06 03:56:08 -0500
committerDavid Faulkner <[email protected]>2026-08-06 03:56:08 -0500
commit1872df0021ea5a8c14bdbb981a4eba46e6ecfbd7 (patch)
treecb73f28ea11f96b0ac2985be02b9058a86efba1c
parent37c538d2e17899f7c02cba4347151c83921244a5 (diff)
perf(apt): pass parallel download flags to apt update and full-upgradeHEADv1.0.2main
- 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
-rw-r--r--main.c12
1 files 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);
}
}