Compare commits

..

4 commits

2 changed files with 29 additions and 18 deletions

View file

@ -8,8 +8,20 @@ fi
TARGET="$1"
if [ "${MMDEBSTRAP_MODE:-}" = "chrootless" ]; then
APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get --yes install \
-oDPkg::Options::=--force-not-root \
-oDPkg::Options::=--force-script-chrootless \
-oDPkg::Options::=--root="$TARGET" \
-oDPkg::Options::=--log="$TARGET/var/log/dpkg.log" \
usr-is-merged
export DPKG_ROOT="$TARGET"
dpkg-query --showformat '${db:Status-Status}\n' --show usr-is-merged | grep -q '^installed$'
dpkg-query --showformat '${Source}\n' --show usr-is-merged | grep -q '^usrmerge$'
dpkg --compare-versions "1" "lt" "$(dpkg-query --showformat '${Version}\n' --show usr-is-merged)"
else
APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get --yes install -oDPkg::Chroot-Directory="$TARGET" usr-is-merged
chroot "$TARGET" dpkg-query --showformat '${db:Status-Status}\n' --show usr-is-merged | grep -q '^installed$'
chroot "$TARGET" dpkg-query --showformat '${Source}\n' --show usr-is-merged | grep -q '^usrmerge$'
dpkg --compare-versions "1" "lt" "$(chroot "$TARGET" dpkg-query --showformat '${Version}\n' --show usr-is-merged)"
fi

View file

@ -1858,18 +1858,14 @@ sub run_setup() {
close $fh;
}
# we create /var/lib/dpkg/arch inside the chroot either if there is more
# than the native architecture in the chroot or if chrootless mode is
# used to create a chroot of a different architecture than the native
# architecture outside the chroot.
# In theory, /var/lib/dpkg/arch is only useful if there are foreign
# architectures configured or if the architecture of a chrootless chroot
# is different from the native architecture outside the chroot.
# We nevertheless always add /var/lib/dpkg/arch to make a chroot built the
# normal way bit-by-bit identical to a foreign arch chroot built in
# chrootless mode.
chomp(my $hostarch = `dpkg --print-architecture`);
if (
(!-e "$options->{root}/var/lib/dpkg/arch")
and (
scalar @{ $options->{foreignarchs} } > 0
or ( $options->{mode} eq 'chrootless'
and $hostarch ne $options->{nativearch}))
) {
if ((!-e "$options->{root}/var/lib/dpkg/arch")) {
open my $fh, '>', "$options->{root}/var/lib/dpkg/arch"
or error "cannot open /var/lib/dpkg/arch: $!";
print $fh "$options->{nativearch}\n";
@ -4001,6 +3997,7 @@ sub get_sourceslist_by_suite {
variants() { :; };
keyring() { :; };
doing_variant() { false; };
info() { fmt="$2"; shift; shift; printf "I: $fmt\n" "$@" >&2; };
. /usr/share/debootstrap/scripts/gutsy;';
open my $fh, '-|', 'env', "ARCH=$arch", "SUITE=$suite",
'sh', '-c', $script // last;
@ -6949,8 +6946,9 @@ Create a bootable USB Stick that boots into a full Debian desktop:
$ guestfish -N debian-unstable.img=disk:8G -- \
part-disk /dev/sda mbr : \
part-set-bootable /dev/sda 1 true : \
mkfs ext4 /dev/sda1 : \
set-label /dev/sda1 rootfs : \
mkfs ext4 /dev/sda1 : mount /dev/sda1 / : \
mount /dev/sda1 / : \
tar-in debian-unstable.tar / xattrs:true : \
upload /usr/lib/EXTLINUX/mbr.bin /boot/mbr.bin : \
copy-file-to-device /boot/mbr.bin /dev/sda size:440 : \
@ -6964,8 +6962,9 @@ On architectures without extlinux you can also boot using grub2:
$ guestfish -N debian-unstable.img=disk:2G -- \
part-disk /dev/sda mbr : \
part-set-bootable /dev/sda 1 true : \
mkfs ext4 /dev/sda1 : \
set-label /dev/sda1 rootfs : \
mkfs ext4 /dev/sda1 : mount /dev/sda1 / : \
mount /dev/sda1 / : \
tar-in fs.tar / xattrs:true : \
command "grub-install /dev/sda" : \
command update-grub : \