Skip to content

Commit f7df7b1

Browse files
committed
Add scripts for debian-elts
Signed-off-by: Shengqi Chen <[email protected]>
1 parent 818c033 commit f7df7b1

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

debian-elts.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
# requires: debmirror
3+
set -e
4+
set -o pipefail
5+
6+
_here=$(dirname $(realpath $0))
7+
function join { local IFS=","; echo "$*"; }
8+
9+
# standard tunasync env
10+
BASE_PATH="${TUNASYNC_WORKING_DIR}"
11+
APT_URL=${TUNASYNC_UPSTREAM_URL:-"https://deb.freexian.com/extended-lts"}
12+
13+
# parse APT_URL to different parts
14+
proto="$(printf "$APT_URL" | grep :// | sed -e's,^\(.*://\).*,\1,g')"
15+
url="$(printf ${APT_URL/$proto/})"
16+
host="$(printf $url | cut -d/ -f1)"
17+
path="/$(printf $url | grep / | cut -d/ -f2-)"
18+
19+
# override by env if needed
20+
APT_HOST=${DEBMIRROR_HOST:-$host}
21+
APT_PROTO=${DEBMIRROR_PROTO:-$proto}
22+
APT_PATH=${DEBMIRROR_PATH:-$path}
23+
APT_KEYRING_FILE=${DEBMIRROR_APT_KEYRING:-"https://deb.freexian.com/extended-lts/archive-key.gpg"}
24+
25+
# leave all possible values here
26+
# debmirror will only download the intersection of provided options and the repo provides
27+
ARCHES=(amd64 i386 armhf armel arm64)
28+
DIST=(jessie stretch)
29+
30+
# download keyring
31+
keyring_file="/tmp/freexian.$RANDOM.kbx"
32+
wget "$APT_KEYRING_FILE" -O "$keyring_file"
33+
34+
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}"

0 commit comments

Comments
 (0)