Compare commits
3 commits
9682e74385
...
7123808b6c
Author | SHA1 | Date | |
---|---|---|---|
7123808b6c | |||
6416ce96c9 | |||
410c5fcb24 |
6 changed files with 68 additions and 6 deletions
|
@ -330,3 +330,5 @@ Needs-QEMU: true
|
|||
Test: error-if-stdout-is-tty
|
||||
|
||||
Test: variant-custom-timeout
|
||||
|
||||
Test: include-deb-file
|
||||
|
|
|
@ -8,6 +8,7 @@ fi
|
|||
|
||||
rootdir="$1"
|
||||
|
||||
# process all configured apt repositories
|
||||
env APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get indextargets --no-release-info --format '$(REPO_URI)' \
|
||||
| sed -ne 's/^file:\/\+//p' \
|
||||
| sort -u \
|
||||
|
@ -27,3 +28,38 @@ env APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get indextargets --no-release-info --f
|
|||
esac
|
||||
printf '/%s\0' "$path" >> "$rootdir/run/mmdebstrap/file-mirror-automount"
|
||||
done
|
||||
|
||||
# process all files given via --include
|
||||
set -f # turn off pathname expansion
|
||||
IFS=',' # split by comma
|
||||
for pkg in $MMDEBSTRAP_INCLUDE; do
|
||||
set +f; unset IFS
|
||||
case $pkg in
|
||||
./*|../*|/*) : ;; # we are interested in this case
|
||||
*) continue ;; # not a file
|
||||
esac
|
||||
# undo escaping
|
||||
pkg="$(printf '%s' "$pkg" | sed 's/%2C/,/g; s/%25/%/g')"
|
||||
# check for existance
|
||||
if [ ! -f "$pkg" ]; then
|
||||
echo "$pkg does not exist" >&2
|
||||
continue
|
||||
fi
|
||||
# make path absolute
|
||||
pkg="$(realpath "$pkg")"
|
||||
mkdir -p "$rootdir/run/mmdebstrap"
|
||||
mkdir -p "$rootdir/$(dirname "$pkg")"
|
||||
case $MMDEBSTRAP_MODE in
|
||||
root|unshare)
|
||||
echo "bind-mounting $pkg into the chroot" >&2
|
||||
touch "$rootdir/$pkg"
|
||||
mount -o bind "$pkg" "$rootdir/$pkg"
|
||||
;;
|
||||
*)
|
||||
echo "copying $pkg into the chroot" >&2
|
||||
cp -av "$pkg" "$rootdir/$pkg"
|
||||
;;
|
||||
esac
|
||||
printf '/%s\0' "$pkg" >> "$rootdir/run/mmdebstrap/file-mirror-automount"
|
||||
done
|
||||
set +f; unset IFS
|
||||
|
|
|
@ -3022,6 +3022,9 @@ sub run_cleanup() {
|
|||
# skip the "." and ".." entries
|
||||
next if $entry eq ".";
|
||||
next if $entry eq "..";
|
||||
# skip deleting /run/lock as /var/lock is a symlink to it
|
||||
# according to Debian policy §9.1.4
|
||||
next if $entry eq "lock";
|
||||
debug "deleting files in /run: $entry";
|
||||
0 == system(
|
||||
'rm', '--interactive=never',
|
||||
|
@ -4282,7 +4285,7 @@ sub main() {
|
|||
} elsif ($opt_value =~ /^\.?\.?\//) {
|
||||
# Treat option as a single path name and don't split by comma
|
||||
# or whitespace -- append the normalized path.
|
||||
push @{ $options->{include} }, sanitize_path($opt_value);
|
||||
push @{ $options->{include} }, &{$sanitize_path}($opt_value);
|
||||
} else {
|
||||
for my $pkg (split /[,\s]+/, $opt_value) {
|
||||
# strip leading and trailing whitespace
|
||||
|
@ -4294,7 +4297,7 @@ sub main() {
|
|||
# Make paths canonical absolute paths, resolve symlinks
|
||||
# and check if it's an existing file.
|
||||
if ($pkg =~ /^\.?\.?\//) {
|
||||
$pkg = sanitize_path($pkg);
|
||||
$pkg = &{$sanitize_path}($pkg);
|
||||
}
|
||||
push @{ $options->{include} }, $pkg;
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@ rm /tmp/debian-debootstrap/var/log/dpkg.log \
|
|||
/tmp/debian-debootstrap/var/log/alternatives.log \
|
||||
/tmp/debian-mm/var/log/bootstrap.log
|
||||
|
||||
# clear out /run
|
||||
rm -r /tmp/debian-debootstrap/run/*
|
||||
# clear out /run except for /run/lock
|
||||
find /tmp/debian-debootstrap/run/ -mindepth 1 -maxdepth 1 ! -name lock -print0 | xargs --no-run-if-empty -0 rm -r
|
||||
|
||||
# debootstrap doesn't clean apt
|
||||
rm /tmp/debian-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_unstable_main_binary-{{ HOSTARCH }}_Packages \
|
||||
|
|
|
@ -95,8 +95,8 @@ fi
|
|||
if [ -e /tmp/debian-{{ DIST }}-mm/etc/apt/apt.conf.d/01autoremove-kernels ]; then
|
||||
rm /tmp/debian-{{ DIST }}-mm/etc/apt/apt.conf.d/01autoremove-kernels
|
||||
fi
|
||||
# clear out /run
|
||||
rm -r /tmp/debian-{{ DIST }}-debootstrap/run/*
|
||||
# clear out /run except for /run/lock
|
||||
find /tmp/debian-{{ DIST }}-debootstrap/run/ -mindepth 1 -maxdepth 1 ! -name lock -print0 | xargs --no-run-if-empty -0 rm -r
|
||||
# debootstrap doesn't clean apt
|
||||
rm /tmp/debian-{{ DIST }}-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_{{ DIST }}_main_binary-{{ HOSTARCH }}_Packages \
|
||||
/tmp/debian-{{ DIST }}-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_{{ DIST }}_Release \
|
||||
|
|
21
tests/include-deb-file
Normal file
21
tests/include-deb-file
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
export LC_ALL=C.UTF-8
|
||||
|
||||
{{ CMD }} --variant=apt \
|
||||
--customize-hook='mkdir "$1"/tmp/apt' \
|
||||
--customize-hook='chroot "$1" env --chdir=/tmp/apt apt-get download busybox' \
|
||||
--customize-hook='copy-out /tmp/apt /tmp' \
|
||||
{{ DIST }} /dev/null {{ MIRROR }}
|
||||
pkg="$(find /tmp/apt -type f)"
|
||||
# some sanity checks
|
||||
[ -f "$pkg" ]
|
||||
case $pkg in
|
||||
/tmp/apt/busybox*_{{ HOSTARCH }}.deb) : ;;
|
||||
*) exit 1;;
|
||||
esac
|
||||
# now try to install that package
|
||||
{{ CMD }} --variant=apt --include="$pkg" \
|
||||
--customize-hook='chroot "$1" dpkg-query -W -f="\${Status}\n" busybox | grep "^install ok installed$"' \
|
||||
{{ DIST }} /dev/null {{ MIRROR }}
|
Loading…
Reference in a new issue