summaryrefslogtreecommitdiffstats
path: root/bin/list-versions_engywuck.sh
blob: 1dafb41a635f018233b80980ef82df94f2a487af (plain)
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
#!/bin/sh

DATE="20210206T105319Z" # 10.8 release

set -e

if [ ! -e /tmp/list-versions_sources.buster-freeze ]
then
	for ARCHIVE_AREA in main contrib non-free
	do
		wget "http://snapshot.debian.org/archive/debian/${DATE}/dists/buster/${ARCHIVE_AREA}/source/Sources.xz" -O - | xz -c -d >> /tmp/list-versions_sources.buster-freeze
	done
fi

if [ ! -e /tmp/list-versions_sources.buster-release ]
then
	for ARCHIVE_AREA in main contrib non-free
	do
		wget "http://debian.ethz.ch/debian/dists/sid/${ARCHIVE_AREA}/source/Sources.xz" -O - | xz -c -d >> /tmp/list-versions_sources.buster-release
	done
fi

List ()
{
	PACKAGE="${@}"

	FREEZE="$(sed -n "/^Package: ${PACKAGE}$/,/^Version:/p" /tmp/list-versions_sources.buster-freeze | awk '/^Version: / { print $2 }' | tail -n1)"
	RELEASE="$(sed -n "/^Package: ${PACKAGE}$/,/^Version:/p" /tmp/list-versions_sources.buster-release | awk '/^Version: / { print $2 }' | tail -n1)"

	VERSIONS="$(wget -q http://snapshot.debian.org/package/${PACKAGE}/ -O - | grep '<li><a href=' | awk -F\> '{ print $3 }' | sed -e 's|<.*$||' | grep -v 'bpo' | grep -v 'deb[0-9]u')"
	VERSIONS="$(echo ${VERSIONS} | sed -e "s|.*\(${RELEASE}\)|\1|" -e "s|\(${FREEZE}\).*|\1|")"

	clear
	echo "Package: ${PACKAGE}"
	echo
	echo ${VERSIONS} | sed -e 's| |\n|g' | sort -V
	echo
	echo "# releases: $(echo ${VERSIONS} | sed -e 's| |\n|g' | wc -l)"
	echo
	echo "freeze:  ${FREEZE}"
	echo "release: ${RELEASE}"
	echo
	echo
}

if [ -n "${1}" ]
then
	for DEB in ${@}
	do
		List ${DEB}
	done
else
	while true
	do
		echo -n "Package: "
		read DEB
		echo

		List ${DEB}

		read input
	done
fi