lh_binary_debian-installer: Only create package pools when necessary

There is no need to create a package pool when creating a netboot Debian
Live image or when the LH_DEBIAN_INSTALLER is set to "businesscard".

Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
This commit is contained in:
Chris Lamb 2008-03-22 01:24:32 +00:00
parent 762613f277
commit cf25064250
1 changed files with 174 additions and 154 deletions

View File

@ -229,7 +229,26 @@ then
wget ${WGET_OPTIONS} --no-clobber -O "${DESTDIR}"/"${INITRD_GI}" ${URL}/${DI_REMOTE_BASE_GTK}/initrd.gz
fi
if [ "${LH_DEBIAN_INSTALLER}" != "netboot" ]; then
# Only download additional packages if appropriate
case "${LH_DEBIAN_INSTALLER}" in
enabled|cdrom|netinst)
case "${LH_BINARY_IMAGES}" in
net)
DI_PACKAGE_POOL="no"
;;
*)
DI_PACKAGE_POOL="yes"
;;
esac
;;
*)
DI_PACKAGE_POOL="no"
;;
esac
if [ "${DI_PACKAGE_POOL}" = "yes" ]
then
# Downloading additional packages
mkdir -p chroot/binary.deb/archives/partial
mv chroot/var/lib/dpkg/status chroot/var/lib/dpkg/status.tmp
@ -262,173 +281,174 @@ if [ "${LH_DEBIAN_INSTALLER}" != "netboot" ]; then
Install_file "${FILE}" "binary/pool/main"
done
fi
fi
# Including base debian packages
if [ -d cache/packages_bootstrap ]
then
for FILE in cache/packages_bootstrap/*.deb
do
Install_file "${FILE}" "binary/pool/main"
done
else
Echo_error "E: Could not find cache/packages_bootstrap"
exit 1
fi
# Including local debs
if ls ../config/binary_local-debs/*_"${LH_ARCHITECTURE}".udeb > /dev/null 2>&1
then
for FILE in ../config/binary_local-debs/*_"${LH_ARCHITECTURE}".deb
do
Install_file "${FILE}" "binary/pool/main"
done
fi
if ls ../config/binary_local-debs/*_all.udeb > /dev/null 2>&1
then
for FILE in ../config/binary_local-debs/*_all.deb
do
Install_file "${FILE}" "binary/pool/main"
done
fi
# Generating deb indices
mkdir -p binary/dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}
cd binary
apt-ftparchive packages pool/main > dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages
gzip -9 -c dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages > dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages.gz
cd "${OLDPWD}"
# Fetching release
wget ${WGET_OPTIONS} "${LH_MIRROR_CHROOT}"/dists/"${LH_DISTRIBUTION}"/main/binary-"${LH_ARCHITECTURE}"/Release -O binary/dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Release
mkdir binary.udeb
cd binary.udeb
# Downloading udeb indices
wget ${WGET_OPTIONS} "${LH_MIRROR_CHROOT}"/dists/"${LH_DISTRIBUTION}"/main/debian-installer/binary-"${LH_ARCHITECTURE}"/Packages.gz
gunzip -c Packages.gz > Packages
# Sorting udebs
UDEBS="$(awk '/Filename: / { print $2 }' Packages)"
# Downloading udebs
for UDEB in ${UDEBS}
do
if [ -f ../cache/packages_debian-installer.udeb/"$(basename ${UDEB})" ]
# Including base debian packages
if [ -d cache/packages_bootstrap ]
then
# Copying cached udebs
cp ../cache/packages_debian-installer.udeb/"$(basename ${UDEB})" ./
for FILE in cache/packages_bootstrap/*.deb
do
Install_file "${FILE}" "binary/pool/main"
done
else
# Downloading udebs
wget ${WGET_OPTIONS} "${LH_MIRROR_CHROOT}"/${UDEB}
Echo_error "E: Could not find cache/packages_bootstrap"
exit 1
fi
done
# Caching udebs
rm -rf ../cache/packages_debian-installer.udeb
mkdir -p ../cache/packages_debian-installer.udeb
cp *.udeb ../cache/packages_debian-installer.udeb
# Including local udebs
if ls ../config/binary_local-udebs/*_"${LH_ARCHITECTURE}".udeb > /dev/null 2>&1
then
for FILE in ../config/binary_local-udebs/*_"${LH_ARCHITECTURE}".udeb
do
Install_file "${FILE}" "pool/main"
# Prefer local udebs over downloaded udebs
rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb
done
fi
if ls ../config/binary_local-udebs/*_all.udeb > /dev/null 2>&1
then
for FILE in ../config/binary_local-udebs/*_all.udeb
do
Install_file "${FILE}" "pool/main"
# Prefer local udebs over downloaded udebs
rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb
done
fi
# Excluding udebs
grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DISTRIBUTION}"/udeb_exclude > exclude
grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DISTRIBUTION}"/exclude-udebs >> exclude
grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DISTRIBUTION}"/exclude-udebs-${LH_ARCHITECTURE} >> exclude
# Local exclude file
if [ -e ../config/binary_debian-installer/udeb_exclude ]
then
cat ../config/binary_debian-installer/udeb_exclude >> exclude
fi
for EXCLUDE in $(cat exclude)
do
rm -f "${EXCLUDE}"_*.udeb
done
# Enable live-installer
if [ "${LH_DEBIAN_INSTALLER}" = "live" ]
then
# Remove local udebs
rm -f pool/main/b/base-installer/bootstrap-base_*.udeb
# Remove d-i udebs
rm -f bootstrap-base_*.udeb
fi
# Moving udebs
for UDEB in ${UDEBS}
do
if [ -f "$(basename ${UDEB})" ]
# Including local debs
if ls ../config/binary_local-debs/*_"${LH_ARCHITECTURE}".udeb > /dev/null 2>&1
then
mkdir -p $(dirname ${UDEB})
mv "$(basename ${UDEB})" "$(dirname ${UDEB})"
for FILE in ../config/binary_local-debs/*_"${LH_ARCHITECTURE}".deb
do
Install_file "${FILE}" "binary/pool/main"
done
fi
done
# Creating udeb indices
mkdir -p dists/"${LH_DISTRIBUTION}"/main/debian-installer/binary-"${LH_ARCHITECTURE}"
apt-ftparchive packages pool/main > dists/"${LH_DISTRIBUTION}"/main/debian-installer/binary-"${LH_ARCHITECTURE}"/Packages
gzip -9 -c dists/${LH_DISTRIBUTION}/main/debian-installer/binary-${LH_ARCHITECTURE}/Packages > dists/${LH_DISTRIBUTION}/main/debian-installer/binary-${LH_ARCHITECTURE}/Packages.gz
if ls ../config/binary_local-debs/*_all.udeb > /dev/null 2>&1
then
for FILE in ../config/binary_local-debs/*_all.deb
do
Install_file "${FILE}" "binary/pool/main"
done
fi
rm -f Packages* exclude
find . | cpio -dmpu "${OLDPWD}"/binary
cd "${OLDPWD}"
# Generating deb indices
mkdir -p binary/dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}
rm -rf binary.udeb
rm -rf binary.deb
cd binary
apt-ftparchive packages pool/main > dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages
gzip -9 -c dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages > dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages.gz
cd "${OLDPWD}"
# Generating release file
apt-ftparchive \
-o APT::FTPArchive::Release::Origin="Debian" \
-o APT::FTPArchive::Release::Label="Debian" \
-o APT::FTPArchive::Release::Suite="${LH_DISTRIBUTION}" \
-o APT::FTPArchive::Release::Version="4.0" \
-o APT::FTPArchive::Release::Codename="${LH_DISTRIBUTION}" \
-o APT::FTPArchive::Release::Date="$(date -R)" \
-o APT::FTPArchive::Release::Architectures="${LH_ARCHITECTURE}" \
-o APT::FTPArchive::Release::Components="main" \
-o APT::FTPArchive::Release::Description="Last updated: $(date -R)" \
release binary/dists/${LH_DISTRIBUTION} > binary/dists/${LH_DISTRIBUTION}/Release
# Fetching release
wget ${WGET_OPTIONS} "${LH_MIRROR_CHROOT}"/dists/"${LH_DISTRIBUTION}"/main/binary-"${LH_ARCHITECTURE}"/Release -O binary/dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Release
# Creating dist symlinks
for DISTRIBUTION in frozen stable testing unstable
do
ln -s ${LH_DISTRIBUTION} binary/dists/${DISTRIBUTION}
done
mkdir binary.udeb
cd binary.udeb
if [ "${LH_BINARY_IMAGES}" != "usb-hdd" ]
then
ln -s . binary/debian
fi
# Downloading udeb indices
wget ${WGET_OPTIONS} "${LH_MIRROR_CHROOT}"/dists/"${LH_DISTRIBUTION}"/main/debian-installer/binary-"${LH_ARCHITECTURE}"/Packages.gz
gunzip -c Packages.gz > Packages
# Including preseeding files
if [ -e config/binary_debian-installer/preseed*.cfg ]
then
cp config/binary_debian-installer/preseed*.cfg binary/install
# Sorting udebs
UDEBS="$(awk '/Filename: / { print $2 }' Packages)"
# Downloading udebs
for UDEB in ${UDEBS}
do
if [ -f ../cache/packages_debian-installer.udeb/"$(basename ${UDEB})" ]
then
# Copying cached udebs
cp ../cache/packages_debian-installer.udeb/"$(basename ${UDEB})" ./
else
# Downloading udebs
wget ${WGET_OPTIONS} "${LH_MIRROR_CHROOT}"/${UDEB}
fi
done
# Caching udebs
rm -rf ../cache/packages_debian-installer.udeb
mkdir -p ../cache/packages_debian-installer.udeb
cp *.udeb ../cache/packages_debian-installer.udeb
# Including local udebs
if ls ../config/binary_local-udebs/*_"${LH_ARCHITECTURE}".udeb > /dev/null 2>&1
then
for FILE in ../config/binary_local-udebs/*_"${LH_ARCHITECTURE}".udeb
do
Install_file "${FILE}" "pool/main"
# Prefer local udebs over downloaded udebs
rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb
done
fi
if ls ../config/binary_local-udebs/*_all.udeb > /dev/null 2>&1
then
for FILE in ../config/binary_local-udebs/*_all.udeb
do
Install_file "${FILE}" "pool/main"
# Prefer local udebs over downloaded udebs
rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb
done
fi
# Excluding udebs
grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DISTRIBUTION}"/udeb_exclude > exclude
grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DISTRIBUTION}"/exclude-udebs >> exclude
grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DISTRIBUTION}"/exclude-udebs-${LH_ARCHITECTURE} >> exclude
# Local exclude file
if [ -e ../config/binary_debian-installer/udeb_exclude ]
then
cat ../config/binary_debian-installer/udeb_exclude >> exclude
fi
for EXCLUDE in $(cat exclude)
do
rm -f "${EXCLUDE}"_*.udeb
done
# Enable live-installer
if [ "${LH_DEBIAN_INSTALLER}" = "live" ]
then
# Remove local udebs
rm -f pool/main/b/base-installer/bootstrap-base_*.udeb
# Remove d-i udebs
rm -f bootstrap-base_*.udeb
fi
# Moving udebs
for UDEB in ${UDEBS}
do
if [ -f "$(basename ${UDEB})" ]
then
mkdir -p $(dirname ${UDEB})
mv "$(basename ${UDEB})" "$(dirname ${UDEB})"
fi
done
# Creating udeb indices
mkdir -p dists/"${LH_DISTRIBUTION}"/main/debian-installer/binary-"${LH_ARCHITECTURE}"
apt-ftparchive packages pool/main > dists/"${LH_DISTRIBUTION}"/main/debian-installer/binary-"${LH_ARCHITECTURE}"/Packages
gzip -9 -c dists/${LH_DISTRIBUTION}/main/debian-installer/binary-${LH_ARCHITECTURE}/Packages > dists/${LH_DISTRIBUTION}/main/debian-installer/binary-${LH_ARCHITECTURE}/Packages.gz
rm -f Packages* exclude
find . | cpio -dmpu "${OLDPWD}"/binary
cd "${OLDPWD}"
rm -rf binary.udeb
rm -rf binary.deb
# Generating release file
apt-ftparchive \
-o APT::FTPArchive::Release::Origin="Debian" \
-o APT::FTPArchive::Release::Label="Debian" \
-o APT::FTPArchive::Release::Suite="${LH_DISTRIBUTION}" \
-o APT::FTPArchive::Release::Version="4.0" \
-o APT::FTPArchive::Release::Codename="${LH_DISTRIBUTION}" \
-o APT::FTPArchive::Release::Date="$(date -R)" \
-o APT::FTPArchive::Release::Architectures="${LH_ARCHITECTURE}" \
-o APT::FTPArchive::Release::Components="main" \
-o APT::FTPArchive::Release::Description="Last updated: $(date -R)" \
release binary/dists/${LH_DISTRIBUTION} > binary/dists/${LH_DISTRIBUTION}/Release
# Creating dist symlinks
for DISTRIBUTION in frozen stable testing unstable
do
ln -s ${LH_DISTRIBUTION} binary/dists/${DISTRIBUTION}
done
if [ "${LH_BINARY_IMAGES}" != "usb-hdd" ]
then
ln -s . binary/debian
fi
# Including preseeding files
if [ -e config/binary_debian-installer/preseed*.cfg ]
then
cp config/binary_debian-installer/preseed*.cfg binary/install
fi
fi
# Creating stage file