diff options
-rwxr-xr-x | helpers/lh_binary_debian-installer | 306 |
1 files changed, 163 insertions, 143 deletions
diff --git a/helpers/lh_binary_debian-installer b/helpers/lh_binary_debian-installer index 7faead249..52f8226d0 100755 --- a/helpers/lh_binary_debian-installer +++ b/helpers/lh_binary_debian-installer @@ -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 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 + # 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 + 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} + # 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}" + 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 + # 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 + 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 + # 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)" + # Sorting udebs + UDEBS="$(awk '/Filename: / { print $2 }' Packages)" -# Downloading udebs -for UDEB in ${UDEBS} -do - if [ -f ../cache/packages_debian-installer.udeb/"$(basename ${UDEB})" ] + # 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 - # Copying cached udebs - cp ../cache/packages_debian-installer.udeb/"$(basename ${UDEB})" ./ - else - # Downloading udebs - wget ${WGET_OPTIONS} "${LH_MIRROR_CHROOT}"/${UDEB} + 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 -done + 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" -# Caching udebs -rm -rf ../cache/packages_debian-installer.udeb -mkdir -p ../cache/packages_debian-installer.udeb -cp *.udeb ../cache/packages_debian-installer.udeb + # Prefer local udebs over downloaded udebs + rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb + done + fi -# 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" + # 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 - # 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" + # Local exclude file + if [ -e ../config/binary_debian-installer/udeb_exclude ] + then + cat ../config/binary_debian-installer/udeb_exclude >> exclude + fi - # Prefer local udebs over downloaded udebs - rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb + for EXCLUDE in $(cat exclude) + do + rm -f "${EXCLUDE}"_*.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 + # Enable live-installer + if [ "${LH_DEBIAN_INSTALLER}" = "live" ] + then + # Remove local udebs + rm -f pool/main/b/base-installer/bootstrap-base_*.udeb -for EXCLUDE in $(cat exclude) -do - rm -f "${EXCLUDE}"_*.udeb -done + # Remove d-i udebs + rm -f bootstrap-base_*.udeb + fi -# Enable live-installer -if [ "${LH_DEBIAN_INSTALLER}" = "live" ] -then - # Remove local udebs - rm -f pool/main/b/base-installer/bootstrap-base_*.udeb + # Moving udebs + for UDEB in ${UDEBS} + do + if [ -f "$(basename ${UDEB})" ] + then + mkdir -p $(dirname ${UDEB}) + mv "$(basename ${UDEB})" "$(dirname ${UDEB})" + fi + done - # Remove d-i udebs - rm -f bootstrap-base_*.udeb -fi + # 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 -# Moving udebs -for UDEB in ${UDEBS} -do - if [ -f "$(basename ${UDEB})" ] + if [ "${LH_BINARY_IMAGES}" != "usb-hdd" ] then - mkdir -p $(dirname ${UDEB}) - mv "$(basename ${UDEB})" "$(dirname ${UDEB})" + ln -s . binary/debian 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 + # 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 |