diff options
| author | David Faulkner <[email protected]> | 2026-08-06 03:56:08 -0500 |
|---|---|---|
| committer | David Faulkner <[email protected]> | 2026-08-06 03:56:08 -0500 |
| commit | 1872df0021ea5a8c14bdbb981a4eba46e6ecfbd7 (patch) | |
| tree | cb73f28ea11f96b0ac2985be02b9058a86efba1c | |
| parent | 37c538d2e17899f7c02cba4347151c83921244a5 (diff) | |
- 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.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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); } } |
