installer_debian-installer: don't mess with /var/lib/dpkg/status

Use a similar trick as for chroot_live-packages.

Relates to #944983.
This commit is contained in:
Raphaël Hertzog 2019-12-19 16:53:30 +01:00
parent 15c46fa152
commit bca7af4ecb
2 changed files with 8 additions and 8 deletions

View File

@ -47,3 +47,9 @@ Chroot_has_package() {
fi fi
return 1 return 1
} }
Chroot_package_list() {
CHROOT="${1:-chroot}"; shift
dpkg-query --admindir=${CHROOT}/var/lib/dpkg -W -f'${Package}\n'
}

View File

@ -311,9 +311,6 @@ then
# Downloading additional packages # Downloading additional packages
mkdir -p chroot/binary.deb/archives/partial mkdir -p chroot/binary.deb/archives/partial
mv chroot/var/lib/dpkg/status chroot/var/lib/dpkg/status.tmp
touch chroot/var/lib/dpkg/status
case "${LB_ARCHITECTURES}" in case "${LB_ARCHITECTURES}" in
amd64) amd64)
DI_REQ_PACKAGES="lilo grub-pc" DI_REQ_PACKAGES="lilo grub-pc"
@ -401,7 +398,7 @@ then
fi fi
# Set apt command prefix # Set apt command prefix
_LB_APT_COMMAND="apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb -o APT::Install-Recommends=false --download-only" _LB_APT_COMMAND="apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb -o Dir::State::status=/dev/null -o APT::Install-Recommends=false --download-only"
if [ "${LB_DEBIAN_INSTALLER}" = "live" ] if [ "${LB_DEBIAN_INSTALLER}" = "live" ]
then then
@ -417,7 +414,7 @@ then
# Drop the packages already installed that d-i doesn't explicitely need # Drop the packages already installed that d-i doesn't explicitely need
_REMAINING_PACKAGES="$(echo ${DI_FIRMWARE_PACKAGES} ${DI_REQ_PACKAGES} | sed -e 's# #|#g')" _REMAINING_PACKAGES="$(echo ${DI_FIRMWARE_PACKAGES} ${DI_REQ_PACKAGES} | sed -e 's# #|#g')"
_REMAINING_PACKAGES="$(sed -n -e 's|Package: ||p' chroot/var/lib/dpkg/status.tmp | grep -E -v "^(${_REMAINING_PACKAGES})\$")" _REMAINING_PACKAGES="$(Chroot_package_list chroot | grep -E -v "^(${_REMAINING_PACKAGES})\$")"
for _PACKAGE in ${_REMAINING_PACKAGES} for _PACKAGE in ${_REMAINING_PACKAGES}
do do
@ -428,9 +425,6 @@ then
Chroot chroot ${_LB_APT_COMMAND} install ${DI_PACKAGES} ${DI_FIRMWARE_PACKAGES} Chroot chroot ${_LB_APT_COMMAND} install ${DI_PACKAGES} ${DI_FIRMWARE_PACKAGES}
fi fi
# Revert dpkg status file
mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
mv chroot/binary.deb ./ mv chroot/binary.deb ./
for _ARCHIVE_AREA in $(echo ${LB_PARENT_ARCHIVE_AREAS} ${LB_ARCHIVE_AREAS}) for _ARCHIVE_AREA in $(echo ${LB_PARENT_ARCHIVE_AREAS} ${LB_ARCHIVE_AREAS})