File: mmdebstrap

package info (click to toggle)
dash 0.5.12-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,936 kB
  • sloc: ansic: 13,402; sh: 1,409; makefile: 76; perl: 38
file content (45 lines) | stat: -rwxr-xr-x 1,996 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
#
# Copyright 2022 Johannes Schauer Marin Rodrigues <josch@debian.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

set -eux

# This test is to prevent bugs like https://bugs.debian.org/1006771

VERSION="$(dpkg-parsechangelog -SVersion)"
apt-cache show "dash=$VERSION" >/dev/null || exit 1

DIST="$(dpkg-parsechangelog -SDistribution)"
if [ "$DIST" = "UNRELEASED" ]; then
    # take Distribution from the previous entry instead
    DIST="$(dpkg-parsechangelog -o1 -c1 -SDistribution)" || DIST="unstable"
    echo "WARN: Using Distribution: $DIST instead of UNRELEASED" >&2
fi

# we need to install the chroot using the same apt sources as used by
# the autopkgtest chroot so that the packages to be tested are
# available
aptsources=
[ -e /etc/apt/sources.list ] && aptsources="/etc/apt/sources.list"
for f in /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources; do
	[ -e "$f" ] || continue
	aptsources="$aptsources $f"
done

# We cannot use debootstrap because debootstrap cannot install from multiple
# mirrors. Since dash is Essential:yes it does not test the right thing if we
# first install with dash from unstable and then upgrade to dash from salsaci.
mmdebstrap --verbose --variant=essential \
	--hook-dir=/usr/share/mmdebstrap/hooks/file-mirror-automount \
	--customize-hook='chroot "$1" dpkg-query --showformat "\${Status} \${Version}\n" --show dash | grep "^install ok installed '"$VERSION"'"' \
	$DIST /dev/null $aptsources