Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Commit

Permalink
Update to use the shiny new tarballs at https://partner-images.canoni…
Browse files Browse the repository at this point in the history
  • Loading branch information
tianon committed Dec 4, 2014
1 parent c6fc22b commit 2b01015
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
16 changes: 11 additions & 5 deletions generate-stackbrew-library.sh
Expand Up @@ -18,9 +18,8 @@ url='git://github.com/tianon/docker-brew-ubuntu-core'
cat <<-'EOH'
# maintainer: Tianon Gravi <admwiggin@gmail.com> (@tianon)
# see https://wiki.ubuntu.com/Core#Current_Releases
# see https://partner-images.canonical.com/core/
# see also https://wiki.ubuntu.com/Releases#Current
# see also http://cdimage.ubuntu.com/ubuntu-core/
EOH

commitRange='master..dist'
Expand All @@ -31,20 +30,27 @@ if [ "$commitCount" ] && [ "$commitCount" -gt 0 ]; then
git log --oneline "$commitRange" | sed 's/^/# - /'
fi

arch="$(dpkg --print-architecture)"
for version in "${versions[@]}"; do
commit="$(git log -1 --format='format:%H' "$version")"
commit="$(git log -1 --format='format:%H' -- "$version")"
serial="$(awk -F '=' '$1 == "SERIAL" { print $2 }' "$version/build-info.txt")"

versionAliases=()
if [ -z "${noVersion[$version]}" ]; then
fullVersion="$(tar -xvf "$version/${version}-core-amd64.tar.gz" etc/debian_version --to-stdout 2>/dev/null)"
tarball="$version/ubuntu-$version-core-cloudimg-$arch-root.tar.gz"
fullVersion="$(tar -xvf "$tarball" etc/debian_version --to-stdout 2>/dev/null)"
if [ -z "$fullVersion" ] || [[ "$fullVersion" == */sid ]]; then
fullVersion="$(eval "$(tar -xvf "$version/${version}-core-amd64.tar.gz" etc/os-release --to-stdout 2>/dev/null)" && echo "$VERSION" | cut -d' ' -f1)"
fullVersion="$(eval "$(tar -xvf "$tarball" etc/os-release --to-stdout 2>/dev/null)" && echo "$VERSION" | cut -d' ' -f1)"
fi
if [ "$fullVersion" ]; then
versionAliases+=( $fullVersion )
if [ "${fullVersion%.*.*}" != "$fullVersion" ]; then
# three part version like "12.04.4"
versionAliases+=( ${fullVersion%.*} )
fi
fi
fi
# TODO something cool/useful with $serial
versionAliases+=( $version ${aliases[$version]} )

echo
Expand Down
23 changes: 6 additions & 17 deletions update.sh
@@ -1,8 +1,6 @@
#!/bin/bash
set -e

currentDaily='vivid'

cd "$(dirname "$BASH_SOURCE")"

versions=( "$@" )
Expand All @@ -11,17 +9,15 @@ if [ ${#versions[@]} -eq 0 ]; then
fi
versions=( "${versions[@]%/}" )

arch="$(dpkg --print-architecture)"
for v in "${versions[@]}"; do
(
cd "$v"
thisTarBase="$v-core-amd64"
thisTar="$thisTarBase.tar.gz"
baseUrl="http://cdimage.ubuntu.com/ubuntu-core"
if [ "$currentDaily" != "$v" ]; then
baseUrl="$baseUrl/$v"
fi
wget -qN "$baseUrl/daily/current/"{{MD5,SHA{1,256}}SUMS{,.gpg},"$thisTarBase.manifest"}
wget -N "$baseUrl/daily/current/$thisTar"
thisTarBase="ubuntu-$v-core-cloudimg-$arch"
thisTar="$thisTarBase-root.tar.gz"
baseUrl="https://partner-images.canonical.com/core/$v/current"
wget -qN "$baseUrl/"{{MD5,SHA{1,256}}SUMS{,.gpg},"$thisTarBase.manifest",'unpacked/build-info.txt'}
wget -N "$baseUrl/$thisTar"
sha256sum="$(sha256sum "$thisTar" | cut -d' ' -f1)"
if ! grep -q "$sha256sum" SHA256SUMS; then
echo >&2 "error: '$thisTar' has invalid SHA256"
Expand Down Expand Up @@ -54,16 +50,9 @@ RUN echo '#!/bin/sh' > /usr/sbin/policy-rc.d \
\
&& echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/docker-gzip-indexes
# delete all the apt list files since they're big and get stale quickly
RUN rm -rf /var/lib/apt/lists/*
# this forces "apt-get update" in dependent images, which is also good
# enable the universe
RUN sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
# upgrade packages for now, since the tarballs aren't updated frequently enough
RUN apt-get update && apt-get dist-upgrade -y && rm -rf /var/lib/apt/lists/*
# overwrite this with 'CMD []' in a dependent Dockerfile
CMD ["/bin/bash"]
EOF
Expand Down

0 comments on commit 2b01015

Please sign in to comment.