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

Commit 26b6ae7

Browse files
committed
1 parent 2d64acb commit 26b6ae7

File tree

2 files changed

+53
-24
lines changed

2 files changed

+53
-24
lines changed

update.sh

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,22 @@ for v in "${versions[@]}"; do
1717
continue
1818
fi
1919

20-
thisTarBase="ubuntu-$v-core-cloudimg-$arch"
21-
thisTar="$thisTarBase-root.tar.gz"
22-
baseUrl="https://partner-images.canonical.com/core/$v/current"
23-
24-
(
25-
cd "$v"
26-
wget -qN "$baseUrl/"{{MD5,SHA{1,256}}SUMS{,.gpg},"$thisTarBase.manifest",'unpacked/build-info.txt'}
27-
wget -N --progress=dot:giga "$baseUrl/$thisTar"
28-
)
29-
30-
cat > "$v/Dockerfile" <<EOF
20+
case "$v" in
21+
bionic | focal | groovy | hirsute | trusty | xenial)
22+
thisTarBase="ubuntu-$v-core-cloudimg-$arch"
23+
thisTar="$thisTarBase-root.tar.gz"
24+
baseUrl="https://partner-images.canonical.com/core/$v/current"
25+
(
26+
cd "$v"
27+
wget -qN "$baseUrl/"{{MD5,SHA{1,256}}SUMS{,.gpg},"$thisTarBase.manifest",'unpacked/build-info.txt'}
28+
wget -N --progress=dot:giga "$baseUrl/$thisTar"
29+
)
30+
31+
cat > "$v/Dockerfile" <<EOF
3132
FROM scratch
3233
ADD $thisTar /
3334
EOF
34-
cat >> "$v/Dockerfile" <<'EOF'
35+
cat >> "$v/Dockerfile" <<'EOF'
3536
3637
# a few minor docker-specific tweaks
3738
# see https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap
@@ -65,31 +66,49 @@ RUN set -xe \
6566
&& echo 'Apt::AutoRemove::SuggestsImportant "false";' > /etc/apt/apt.conf.d/docker-autoremove-suggests
6667
EOF
6768

68-
if [ "$v" = 'xenial' ]; then
69-
cat >> "$v/Dockerfile" <<'EOF'
69+
if [ "$v" = 'xenial' ]; then
70+
cat >> "$v/Dockerfile" <<'EOF'
7071
7172
# delete all the apt list files since they're big and get stale quickly
7273
RUN rm -rf /var/lib/apt/lists/*
7374
# this forces "apt-get update" in dependent images, which is also good
7475
# (see also https://bugs.launchpad.net/cloud-images/+bug/1699913)
7576
EOF
76-
else
77-
cat >> "$v/Dockerfile" <<'EOF'
77+
else
78+
cat >> "$v/Dockerfile" <<'EOF'
7879
7980
# verify that the APT lists files do not exist
8081
RUN [ -z "$(apt-get indextargets)" ]
8182
# (see https://bugs.launchpad.net/cloud-images/+bug/1699913)
8283
EOF
83-
fi
84+
fi
8485

85-
cat >> "$v/Dockerfile" <<'EOF'
86+
cat >> "$v/Dockerfile" <<'EOF'
8687
8788
# make systemd-detect-virt return "docker"
8889
# See: https://github.com/systemd/systemd/blob/aa0c34279ee40bce2f9681b496922dedbadfca19/src/basic/virt.c#L434
8990
RUN mkdir -p /run/systemd && echo 'docker' > /run/systemd/container
9091
9192
CMD ["/bin/bash"]
9293
EOF
94+
;;
95+
96+
*)
97+
thisTarBase="ubuntu-$v-oci-$arch"
98+
thisTar="$thisTarBase-root.tar.gz"
99+
baseUrl="https://partner-images.canonical.com/oci/$v/current"
100+
(
101+
cd "$v"
102+
wget -qN "$baseUrl/"{SHA256SUMS{,.gpg},"$thisTarBase.manifest",'unpacked/build-info.txt'}
103+
wget -N --progress=dot:giga "$baseUrl/$thisTar"
104+
)
105+
cat > "$v/Dockerfile" <<-EOF
106+
FROM scratch
107+
ADD $thisTar /
108+
CMD ["bash"]
109+
EOF
110+
;;
111+
esac
93112

94113
toVerify+=( "$v" )
95114
done

verify.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,31 @@ arch="$(cat arch 2>/dev/null || true)"
2626
: ${arch:=$hostArch}
2727

2828
for v in "${versions[@]}"; do
29-
thisTarBase="ubuntu-$v-core-cloudimg-$arch"
30-
thisTar="$thisTarBase-root.tar.gz"
31-
baseUrl="https://partner-images.canonical.com/core/$v"
32-
for sums in sha256 sha1 md5; do
29+
case "$v" in
30+
bionic | focal | groovy | hirsute | trusty | xenial)
31+
thisTarBase="ubuntu-$v-core-cloudimg-$arch"
32+
thisTar="$thisTarBase-root.tar.gz"
33+
sumTypes=( sha256 sha1 md5 )
34+
;;
35+
36+
*)
37+
thisTarBase="ubuntu-$v-oci-$arch"
38+
thisTar="$thisTarBase-root.tar.gz"
39+
sumTypes=( sha256 )
40+
;;
41+
esac
42+
for sums in "${sumTypes[@]}"; do
3343
sumsFile="$v/${sums^^}SUMS" # "SHA256SUMS"
3444
sumCmd="${sums}sum" # "sha256sum"
35-
if [ "$gpgFingerprint" ]; then
45+
if [ -n "$gpgFingerprint" ]; then
3646
if [ ! -f "$sumsFile.gpg" ]; then
3747
echo >&2 "warning: '$sumsFile.gpg' appears to be missing!"
3848
badness=1
3949
else
4050
( set -x; gpg --batch --verify "$sumsFile.gpg" "$sumsFile" )
4151
fi
4252
fi
43-
if [ -f "$sumsFile" ]; then
53+
if [ -s "$sumsFile" ]; then
4454
grep " *$thisTar\$" "$sumsFile" | ( set -x; cd "$v" && "$sumCmd" -c - )
4555
else
4656
echo >&2 "warning: missing '$sumsFile'!"

0 commit comments

Comments
 (0)