From cb237cf5b0910c77917a8cad3c45b15a6c05a454 Mon Sep 17 00:00:00 2001 From: Alvin Date: Thu, 29 Oct 2026 05:42:40 +0100 Subject: [PATCH] broaden scope --- apt-http-lxcs.sh | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/apt-http-lxcs.sh b/apt-http-lxcs.sh index 465751a..655ffbf 100644 --- a/apt-http-lxcs.sh +++ b/apt-http-lxcs.sh @@ -4,7 +4,7 @@ set -u echo echo "==============================================" -echo " Docker APT Repo HTTPS -> HTTP LXC Converter" +echo " APT Repo HTTPS -> HTTP LXC Converter" echo "==============================================" echo @@ -32,19 +32,16 @@ for CTID in $(pct list | awk 'NR>1 {print $1}'); do fi MATCHES=$(pct exec "$CTID" -- sh -c ' - grep -RIl \ - "https://download\.docker\.com" \ - /etc/apt/sources.list \ - /etc/apt/sources.list.d \ - 2>/dev/null || true + find /etc/apt -type f \( -name "sources.list" -o -name "*.list" -o -name "*.sources" \) \ + -exec grep -Il "https://" {} + 2>/dev/null || true ') if [[ -z "$MATCHES" ]]; then - echo "OK: No HTTPS Docker APT repo found." + echo "OK: No HTTPS APT sources found." continue fi - echo "Found Docker repo in:" + echo "Found HTTPS APT sources in:" while IFS= read -r FILE; do [[ -z "$FILE" ]] && continue @@ -53,15 +50,13 @@ for CTID in $(pct list | awk 'NR>1 {print $1}'); do TIMESTAMP=$(date +%Y%m%d-%H%M%S) BASENAME=$(basename "$FILE") - BACKUP_DIR="/root/apt-backups/docker" + BACKUP_DIR="/root/apt-backups/https" BACKUP="${BACKUP_DIR}/${BASENAME}.${TIMESTAMP}.bak" pct exec "$CTID" -- sh -c " mkdir -p '$BACKUP_DIR' && cp '$FILE' '$BACKUP' && - sed -i \ - 's|https://download\.docker\.com|http://download.docker.com|g' \ - '$FILE' + sed -i 's|https://|http://|g' '$FILE' " if [[ $? -eq 0 ]]; then @@ -74,11 +69,10 @@ for CTID in $(pct list | awk 'NR>1 {print $1}'); do done <<< "$MATCHES" echo - echo "Current Docker repo entries:" + echo "Current APT source entries:" pct exec "$CTID" -- sh -c ' - grep -RHn \ - "download\.docker\.com" \ + grep -RHn "http://" \ /etc/apt/sources.list \ /etc/apt/sources.list.d \ 2>/dev/null || true