You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
livecd-rootfs/debian/tests/default-bootstraps

91 lines
2.2 KiB

#!/bin/sh
# autopkgtest check: Build default rootfs for all supported project:subproject pairs
# (C) 2017 Canonical Ltd.
# Author: Balint Reczey <balint.reczey@canonical.com>
set -e
if [ -z "$SUITE" ]; then
SUITE=$(lsb_release -c -s)
fi
# Known project:subproject:template combinations.
# Listed subprojects can be combined with other projects as well,
# but this list gives reasonable coverage.
ALL_TRIPLETS="
edubuntu::
kubuntu::
lubuntu::
ubuntu-unity::
ubuntu::
ubuntu-base::
ubuntu-base:buildd:
ubuntu-budgie::
ubuntu-budgie-desktop::
ubuntu-budgie-live::
ubuntucinnamon::
ubuntu-core:system-image:ubuntu-core
ubuntu-cpc::ubuntu-cpc
ubuntu-cpc:minimized:ubuntu-cpc
ubuntu-dvd::
ubuntu-gnome::
ubuntukylin::
ubuntu-mate::
ubuntu-mate-core::
ubuntu-mate-desktop::
ubuntu-mate-live::
ubuntu-server:live:ubuntu-server
xubuntu::
xubuntu:minimal:"
ARCH=$(dpkg --print-architecture)
if [ -z "$SELECTED_TRIPLETS" ]; then
SELECTED_TRIPLETS="
ubuntu-base::
ubuntu-cpc::ubuntu-cpc
"
if [ "$ARCH" = amd64 ]; then
SELECTED_TRIPLETS="$SELECTED_TRIPLETS
ubuntu::"
fi
fi
live_build_rootfs() {
PROJECT=${1%%:*}
local SUBPROJECT_TMP=${1%:*}
SUBPROJECT=${SUBPROJECT_TMP#*:}
TEMPLATE=${1##*:}
echo "Building rootfs for project: '$PROJECT' subproject: '$SUBPROJECT' template: '$TEMPLATE' in $PWD"
cp -a /usr/share/livecd-rootfs/live-build/auto .
if [ -n "$TEMPLATE" ]; then
cp -a /usr/share/livecd-rootfs/live-build/$TEMPLATE .
fi
env PROJECT=$PROJECT \
SUBPROJECT=$SUBPROJECT \
SUITE=$SUITE \
ARCH=$ARCH \
lb config
mkdir chroot
# this part needs root rights, but right now the whole script ran as root by autopkgtest
env PROJECT=$PROJECT \
SUBPROJECT=$SUBPROJECT \
ARCH=$ARCH \
lb build
echo "Build results for project: '$PROJECT' subproject: '$SUBPROJECT' template: '$TEMPLATE' in $PWD"
du -sh *
echo ""
}
WORKDIR=$(mktemp -d)
trap "RET=\$?; rm -rf $WORKDIR; exit \$RET" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
for i in $SELECTED_TRIPLETS; do
mkdir $i
(cd $i && live_build_rootfs $i)
# clean up after build to avoid filling the disk, needs root rights
rm -rf $i
done