Skip to content

Commit

Permalink
Merge remote-tracking branches 'debuerreotype-vicamo/for-upstream/ski…
Browse files Browse the repository at this point in the history
…p-iputils-ping-if-unavailable' and 'debuerreotype-vicamo/for-upstream/build-eoled-ubuntu-suites'
  • Loading branch information
vicamo committed May 6, 2024
3 parents c60d419 + 1d38e31 + 535c94f commit 50c950b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ jobs:

- { DISTRO: ubuntu, SUITE: bionic }
- { DISTRO: ubuntu, SUITE: focal }
- { DISTRO: ubuntu, SUITE: focal, ARCH: i386 }
- { DISTRO: ubuntu, SUITE: eol, CODENAME: cosmic, ARCH: armhf }
fail-fast: false
name: Test ${{ matrix.DISTRO && format('{0} ', matrix.DISTRO) }}${{ matrix.SUITE }}${{ matrix.CODENAME && format(' ({0})', matrix.CODENAME) }}${{ matrix.ARCH && format(' [{0}]', matrix.ARCH) }}${{ matrix.TIMESTAMP && format(' at {0}', matrix.TIMESTAMP) }}
runs-on: ubuntu-20.04
Expand Down
12 changes: 11 additions & 1 deletion .validate-ubuntu.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/usr/bin/env bash
set -Eeuo pipefail

buildArgs=()
if [ "$SUITE" = 'eol' ]; then
buildArgs+=( '--eol' )
SUITE="$CODENAME"
fi
if [ -n "${ARCH:-}" ]; then
buildArgs+=( "--arch=${ARCH}" )
fi
buildArgs+=( validate "$SUITE" )

dockerImage="$(./.docker-image.sh)"
dockerImage+='-ubuntu'
{
Expand All @@ -21,4 +31,4 @@ mkdir -p validate
set -x

./scripts/debuerreotype-version
./docker-run.sh --image="$dockerImage" --no-build ./examples/ubuntu.sh validate "$SUITE"
./docker-run.sh --image="$dockerImage" --no-build ./examples/ubuntu.sh "${buildArgs[@]}"
53 changes: 39 additions & 14 deletions examples/ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ debuerreotypeScriptsDir="$(readlink -vf "$debuerreotypeScriptsDir")"
debuerreotypeScriptsDir="$(dirname "$debuerreotypeScriptsDir")"

source "$debuerreotypeScriptsDir/.constants.sh" \
--flags 'eol' \
--flags 'arch:' \
-- \
'[--arch=<arch>] <output-dir> <suite>' \
'[--eol] [--arch=<arch>] <output-dir> <suite>' \
'output xenial
--eol --arch armhf output cosmic
--arch arm64 output bionic'

eval "$dgetopt"
eol=
arch=
while true; do
flag="$1"; shift
dgetopt-case "$flag"
case "$flag" in
--eol) eol=1 ;; # for using "old-releases.ubuntu.com"
--arch) arch="$1"; shift ;; # for adding "--arch" to debuerreotype-init
--) break ;;
*) eusage "unknown flag '$flag'" ;;
Expand All @@ -46,24 +50,35 @@ exportDir="$tmpDir/output"
archDir="$exportDir/ubuntu/$dpkgArch"
tmpOutputDir="$archDir/$suite"

case "$dpkgArch" in
amd64 | i386)
mirror='http://archive.ubuntu.com/ubuntu'
secmirror='http://security.ubuntu.com/ubuntu'
;;

*)
mirror='http://ports.ubuntu.com/ubuntu-ports'
secmirror="$mirror" # no separate security mirror for ports
;;
esac
if [ -z "$eol" ]; then
case "$dpkgArch" in
amd64 | i386)
mirror='http://archive.ubuntu.com/ubuntu'
secmirror='http://security.ubuntu.com/ubuntu'
;;

*)
mirror='http://ports.ubuntu.com/ubuntu-ports'
secmirror="$mirror" # no separate security mirror for ports
;;
esac
else
mirror='http://old-releases.ubuntu.com/ubuntu'
secmirror="$mirror" # no separate security mirror for old releases
fi

initArgs=(
--arch "$dpkgArch"
--non-debian
)

keyring='/usr/share/keyrings/ubuntu-archive-keyring.gpg'
export GNUPGHOME="$tmpDir/gnupg"
mkdir -p "$GNUPGHOME"
keyring="$tmpDir/ubuntu-archive-$suite-keyring.gpg"
# check against all releases (ie, combine both "ubuntu-archive-keyring.gpg" and "ubuntu-archive-removed-keys.gpg"), since we cannot really know whether the target release became EOL later than the snapshot date we are targeting
gpg --batch --no-default-keyring --keyring "$keyring" --import \
/usr/share/keyrings/ubuntu-archive-keyring.gpg \
/usr/share/keyrings/ubuntu-archive-removed-keys.gpg
initArgs+=( --keyring "$keyring" )

mkdir -p "$tmpOutputDir"
Expand Down Expand Up @@ -95,6 +110,11 @@ initArgs+=(
--no-merged-usr
)

script="${DEBOOTSTRAP_DIR:-/usr/share/debootstrap}/scripts/$suite"
if [ ! -e "$script" ]; then
initArgs+=(--debootstrap-script "${script%/*}/gutsy")
fi

rootfsDir="$tmpDir/rootfs"
debuerreotype-init "${initArgs[@]}" "$rootfsDir" "$suite" "$mirror"

Expand Down Expand Up @@ -137,7 +157,12 @@ if ! debuerreotype-apt-get "$rootfsDir" install -qq -s iproute2 &> /dev/null; th
# poor wheezy
iproute=iproute
fi
debuerreotype-apt-get "$rootfsDir" install -y --no-install-recommends iputils-ping $iproute
ping=iputils-ping
if [ -z "$(apt-cache policy iputils-ping 2>/dev/null)" ]; then
# iputils-ping:i386 became unavailable since Focal.
ping=
fi
debuerreotype-apt-get "$rootfsDir" install -y --no-install-recommends $ping $iproute

debuerreotype-slimify "$rootfsDir"-slim

Expand Down

0 comments on commit 50c950b

Please sign in to comment.