forked from tianon/docker-brew-ubuntu-debootstrap
-
Notifications
You must be signed in to change notification settings - Fork 2
/
generate-stackbrew-library.sh
executable file
·56 lines (49 loc) · 1.72 KB
/
generate-stackbrew-library.sh
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
#!/bin/bash
set -e
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
declare -A aliases
aliases=(
[$(cat latest)]='latest'
)
declare -A noVersion
noVersion=(
[devel]=1
)
versions=( */ )
versions=( "${versions[@]%/}" )
url='git://github.com/tianon/docker-brew-ubuntu-debootstrap'
echo '# maintainer: Tianon Gravi <[email protected]> (@tianon)'
commitRange='master..dist'
commitCount="$(git rev-list "$commitRange" --count 2>/dev/null || true)"
if [ "$commitCount" ] && [ "$commitCount" -gt 0 ]; then
echo
echo '# commits:' "($commitRange)"
git log --format=format:'- %h %s%n%w(0,2,2)%b' "$commitRange" | sed 's/^/# /'
fi
for version in "${versions[@]}"; do
commit="$(git log -1 --format='format:%H' "$version")"
versionAliases=()
if [ -z "${noVersion[$version]}" ]; then
fullVersion="$(tar -xvf "$version/rootfs.tar.xz" etc/debian_version --to-stdout 2>/dev/null)"
if [ -z "$fullVersion" ] || [[ "$fullVersion" == */sid ]]; then
fullVersion="$(eval "$(tar -xvf "$version/rootfs.tar.xz" etc/os-release --to-stdout 2>/dev/null)" && echo "$VERSION" | cut -d' ' -f1)"
if [ -z "$fullVersion" ]; then
# lucid...
fullVersion="$(eval "$(tar -xvf "$version/rootfs.tar.xz" etc/lsb-release --to-stdout 2>/dev/null)" && echo "$DISTRIB_DESCRIPTION" | cut -d' ' -f2)" # DISTRIB_DESCRIPTION="Ubuntu 10.04.4 LTS"
fi
else
while [ "${fullVersion%.*}" != "$fullVersion" ]; do
versionAliases+=( $fullVersion )
fullVersion="${fullVersion%.*}"
done
fi
if [ "$fullVersion" != "$version" ]; then
versionAliases+=( $fullVersion )
fi
fi
versionAliases+=( $version $(cat "$version/suite" 2>/dev/null || true) ${aliases[$version]} )
echo
for va in "${versionAliases[@]}"; do
echo "$va: ${url}@${commit} $version"
done
done