summaryrefslogtreecommitdiff
path: root/system/ncurses/maintain
blob: 3112cf87a3c58dde6d4c597aa83900698565fbb1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh -e

##
# This script downloads the "base" ncurses tarball and all patches (if any)
# up to and including the version specified in '_ver', to a temporary dir.
#
# It prints a first pass at 'sources=' and the corresponding checksums. You
# need to copy/paste these into the APKBUILD yourself. Ensure tabs!!!
#

##
# Only run from this directory.
#
test -f APKBUILD || exit 1;
. ./APKBUILD

##
# Mirror (note: not invisible-island, related).
#
m=https://invisible-mirror.net/archives/ncurses

##
# Parse the HTML from directory index to determine available patches.
#
p=$(curl -s ${m}/${pkgver}/ \
    | grep -oE '[0-9]{8}\.patch' `# 8-digit date` \
    | sort \
    | uniq \
    | awk "\$1 <= ${_ver} + 1" `# exclude newly-available patches` \
    | awk "{print \"${m}/${pkgver}/${pkgname}-${pkgver}-\"\$1\".gz\"}"
);

d=$(mktemp -d);
cd ${d};

##
# Download "base" tarball.
#
s=${m}/${pkgname}-${pkgver}.tar.gz;
curl -sq -O ${s};

##
# Generate 'source=', extracting patches along the way.
#
printf "source=\"%s\n" "${s}";
for k in ${p}; do
    curl -sq -O ${k};
    gzip -d ${k##*/};
    _k=${k##*/};
    printf "\t%s\n" "${_k%.*}";
done
printf "\t\"\n";

##
# Checksums.
#
sha512sum $(find . -type f -print | cut -d/ -f2- | sort);
rm "${s##*/}";

##
# Cleanup.
#
printf "\n";
printf "YOU MUST COPY THE PATCHES FROM '%s' (and delete that dir after)!\n" "${d}";