Last active
August 29, 2015 14:14
-
-
Save tianon/a43f2e6f3cc309f2d23f to your computer and use it in GitHub Desktop.
heinous "cb" Dockerfile spitballing for paultag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM tianon/frankendebian | |
#FROM debian:experimental | |
# https://wiki.debian.org/BuilddSetup | |
# "Configure apt (don't install recommends, no pdiffs)." | |
RUN { \ | |
echo 'APT::Install-Recommends 0;'; \ | |
echo 'Acquire::PDiffs "false";'; \ | |
} > /etc/apt/apt.conf.d/buildd | |
RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/* | |
# for loltesting | |
RUN echo 'APT::Default-Release "testing";' > /etc/apt/apt.conf.d/default | |
# golang (>= 2:1.2-3~), | |
# golang (>= 2:1.2.1-2~) | golang (<< 2:1.2.1~), | |
# golang (>= 2:1.3-4~) | golang (= 2:1.3-1) | golang (<< 2:1.3~), | |
RUN set -ex; \ | |
package='golang'; \ | |
apt-get update; \ | |
versions="$(apt-cache policy "$package" | awk ' \ | |
$1 == "Version" && $2 == "table:" { a = 1; next } \ | |
!/^ ( |\*\*\*) / { a = 0; next } \ | |
a { \ | |
b = substr($0, 6); \ | |
if (b !~ /^ /) { \ | |
version = substr(b, 0, index(b, " ")); \ | |
next \ | |
} \ | |
if (version) { \ | |
sub(/^ +/, "", b); \ | |
sep = index(b, " "); \ | |
priority = substr(b, 0, sep); \ | |
b = substr(b, sep+1); \ | |
sub(/^[^ ]+ /, "", b); \ | |
sub(/\/.*$/, "", b); \ | |
if (b) { \ | |
print priority " " version "/" b \ | |
} \ | |
} \ | |
} \ | |
' | sort --numeric-sort --stable --reverse | cut -d' ' -f2)"; \ | |
for version in $versions; do \ | |
target="${version#*/}"; \ | |
version="${version%/$target}"; \ | |
if { dpkg --compare-versions "$version" '>=' '2:1.2-3~'; } \ | |
&& { dpkg --compare-versions "$version" '>=' '2:1.2.1-2~' \ | |
|| dpkg --compare-versions "$version" '<<' '2:1.2.1~'; } \ | |
&& { dpkg --compare-versions "$version" '>=' '2:1.3-4~' \ | |
|| dpkg --compare-versions "$version" '=' '2:1.3-1' \ | |
|| dpkg --compare-versions "$version" '<<' '2:1.3~'; } \ | |
; then \ | |
apt-get install -t "$target" -y "$package"="$version"; \ | |
rm -rf /var/lib/apt/lists/*; \ | |
exit 0; \ | |
fi; \ | |
done; \ | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment