diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbcaa0045..9a5cb81f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.validate-ubuntu.sh b/.validate-ubuntu.sh index 5c4302cf0..646448715 100755 --- a/.validate-ubuntu.sh +++ b/.validate-ubuntu.sh @@ -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' { @@ -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[@]}" diff --git a/examples/ubuntu.sh b/examples/ubuntu.sh index 0ac69e6fb..5ea8920d5 100755 --- a/examples/ubuntu.sh +++ b/examples/ubuntu.sh @@ -10,18 +10,22 @@ debuerreotypeScriptsDir="$(readlink -vf "$debuerreotypeScriptsDir")" debuerreotypeScriptsDir="$(dirname "$debuerreotypeScriptsDir")" source "$debuerreotypeScriptsDir/.constants.sh" \ + --flags 'eol' \ --flags 'arch:' \ -- \ - '[--arch=] ' \ + '[--eol] [--arch=] ' \ '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'" ;; @@ -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" @@ -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" @@ -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