From f7df7b1dd871e744fef343d6e9c4083f8cd26738 Mon Sep 17 00:00:00 2001 From: Shengqi Chen Date: Sat, 2 Dec 2023 17:09:47 +0800 Subject: [PATCH] Add scripts for debian-elts Signed-off-by: Shengqi Chen --- debian-elts.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 debian-elts.sh diff --git a/debian-elts.sh b/debian-elts.sh new file mode 100755 index 0000000..cfb3256 --- /dev/null +++ b/debian-elts.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# requires: debmirror +set -e +set -o pipefail + +_here=$(dirname $(realpath $0)) +function join { local IFS=","; echo "$*"; } + +# standard tunasync env +BASE_PATH="${TUNASYNC_WORKING_DIR}" +APT_URL=${TUNASYNC_UPSTREAM_URL:-"https://deb.freexian.com/extended-lts"} + +# parse APT_URL to different parts +proto="$(printf "$APT_URL" | grep :// | sed -e's,^\(.*://\).*,\1,g')" +url="$(printf ${APT_URL/$proto/})" +host="$(printf $url | cut -d/ -f1)" +path="/$(printf $url | grep / | cut -d/ -f2-)" + +# override by env if needed +APT_HOST=${DEBMIRROR_HOST:-$host} +APT_PROTO=${DEBMIRROR_PROTO:-$proto} +APT_PATH=${DEBMIRROR_PATH:-$path} +APT_KEYRING_FILE=${DEBMIRROR_APT_KEYRING:-"https://deb.freexian.com/extended-lts/archive-key.gpg"} + +# leave all possible values here +# debmirror will only download the intersection of provided options and the repo provides +ARCHES=(amd64 i386 armhf armel arm64) +DIST=(jessie stretch) + +# download keyring +keyring_file="/tmp/freexian.$RANDOM.kbx" +wget "$APT_KEYRING_FILE" -O "$keyring_file" + +debmirror -a $(join "${ARCHES[@]}") -d $(join "${DIST[@]}") -h "$APT_HOST" -r "$APT_PATH" --method ${APT_PROTO} -v --keyring "$keyring_file" --diff mirror --rsync-extra none --i18n --getcontents "${BASE_PATH}"