Skip to content

Commit

Permalink
Merge remote-tracking branch 'debuerreotype-vicamo/for-upstream/build…
Browse files Browse the repository at this point in the history
…-eoled-ubuntu-suites'
  • Loading branch information
vicamo committed May 7, 2024
2 parents 41e1f23 + 3f04c63 commit 4b36887
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ jobs:
- { DISTRO: ubuntu, SUITE: bionic }
- { DISTRO: ubuntu, SUITE: focal }
- { DISTRO: ubuntu, SUITE: focal, ARCH: i386 }
- { DISTRO: ubuntu, SUITE: eol, CODENAME: cosmic, ARCH: armhf }
- { DISTRO: ubuntu, SUITE: eol, CODENAME: gutsy }
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[@]}"
58 changes: 45 additions & 13 deletions examples/ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,28 @@ debuerreotypeScriptsDir="$(readlink -vf "$debuerreotypeScriptsDir")"
debuerreotypeScriptsDir="$(dirname "$debuerreotypeScriptsDir")"

source "$debuerreotypeScriptsDir/.constants.sh" \
--flags 'eol' \
--flags 'arch:' \
--flags 'include:,exclude:' \
-- \
'[--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=
include=gpgv
exclude=
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
--include) include="${include:+$include,}$1"; shift ;;
--exclude) exclude="${exclude:+$exclude,}$1"; shift ;;
--) break ;;
*) eusage "unknown flag '$flag'" ;;
esac
Expand All @@ -46,24 +55,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 +115,18 @@ initArgs+=(
--no-merged-usr
)

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

if [ -n "$include" ]; then
initArgs+=( --include="$include" )
fi
if [ -n "$exclude" ]; then
initArgs+=( --exclude="$exclude" )
fi

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

Expand Down

0 comments on commit 4b36887

Please sign in to comment.