live-build/helpers/binary_debian-installer

685 lines
17 KiB
Plaintext
Raw Normal View History

2007-09-23 08:04:52 +00:00
#!/bin/sh
# lh_binary_debian-installer(1) - install debian-installer into binary
# Copyright (C) 2006-2009 Daniel Baumann <daniel@debian.org>
2007-09-23 08:04:52 +00:00
#
# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
# This is free software, and you are welcome to redistribute it
# under certain conditions; see COPYING for details.
set -e
2007-09-23 08:05:11 +00:00
# Including common functions
2009-11-22 12:40:20 -01:00
. "${LH_BASE:-/usr/share/live-helper}"/live-helper.sh
2007-09-23 08:04:52 +00:00
2007-09-23 08:05:11 +00:00
# Setting static variables
DESCRIPTION="$(Echo 'install debian-installer into binary')"
2007-09-23 08:04:52 +00:00
HELP=""
USAGE="${PROGRAM} [--force]"
Arguments "${@}"
# Reading configuration files
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
2007-09-23 08:04:52 +00:00
Set_defaults
if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ]
then
exit 0
fi
if [ "${_DEBUG}" = "true" ]
then
WGET_OPTIONS="${WGET_OPTIONS} --verbose"
elif [ "${_QUIET}" = "true" ]
then
WGET_OPTIONS="${WGET_OPTIONS} --quiet"
else
WGET_OPTIONS="${WGET_OPTIONS} --no-verbose"
fi
# Check d-i configuration
2007-09-23 08:05:17 +00:00
case "${LH_DEBIAN_INSTALLER}" in
true|cdrom|netinst|netboot|businesscard|live)
2007-09-23 08:05:15 +00:00
;;
false)
2007-09-23 08:05:21 +00:00
exit 0
;;
2007-09-23 08:05:13 +00:00
*)
Echo_error "debian-installer flavour %s not supported." "${LH_DEBIAN_INSTALLER}"
2007-09-23 08:05:13 +00:00
exit 1
;;
esac
2007-09-23 08:04:52 +00:00
2007-09-23 08:05:11 +00:00
Echo_message "Begin installing debian-installer..."
2007-09-23 08:04:52 +00:00
# Requiring stage file
Require_stagefile .stage/config .stage/bootstrap
2007-09-23 08:04:52 +00:00
# Checking stage file
Check_stagefile .stage/binary_debian-installer
# Checking lock file
Check_lockfile .lock
# Creating lock file
Create_lockfile .lock
# Checking depends
Check_package chroot/usr/bin/wget wget
Check_package chroot/usr/bin/apt-ftparchive apt-utils
# Restoring cache
Restore_cache cache/packages_binary
# Installing depends
Install_package
2007-09-23 08:04:52 +00:00
# Setting destination directory
2007-09-23 08:05:17 +00:00
case "${LH_BINARY_IMAGES}" in
2007-09-23 08:04:52 +00:00
net)
DESTDIR="tftpboot/debian-install/${LH_ARCHITECTURE}"
2007-09-23 08:04:52 +00:00
;;
usb*|tar)
2007-09-23 08:05:12 +00:00
DESTDIR="binary/install"
2007-09-23 08:04:52 +00:00
;;
*)
DESTDIR="binary/install"
;;
2007-09-23 08:04:52 +00:00
esac
# Set d-i image type
case "${LH_DEBIAN_INSTALLER}" in
businesscard|netboot|netinst)
2008-06-14 15:41:58 +00:00
DI_IMAGE_TYPE="netboot"
;;
*)
case "${LH_BINARY_IMAGES}" in
net)
DI_IMAGE_TYPE="netboot"
;;
*)
DI_IMAGE_TYPE="cdrom"
;;
esac
;;
esac
# Set architecture-specific variables
case "${LH_ARCHITECTURE}" in
powerpc)
case "${DI_IMAGE_TYPE}" in
cdrom)
DI_REMOTE_BASE="${LH_ARCHITECTURE}/cdrom"
;;
netboot)
DI_REMOTE_BASE="${LH_ARCHITECTURE}/netboot"
;;
esac
DI_REMOTE_KERNEL="vmlinux"
DI_REMOTE_BASE_GTK="${DI_REMOTE_BASE}/gtk"
;;
sparc)
DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')"
DI_REMOTE_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})"
DI_REMOTE_BASE_GTK="none"
2009-11-16 10:40:43 -01:00
DI_REMOTE_BASE="cdrom"
;;
*)
case "${DI_IMAGE_TYPE}" in
netboot)
DI_REMOTE_BASE="netboot/debian-installer/${LH_ARCHITECTURE}"
DI_REMOTE_BASE_GTK="netboot/gtk/debian-installer/${LH_ARCHITECTURE}"
DI_REMOTE_KERNEL="linux"
;;
cdrom)
DI_REMOTE_BASE="cdrom"
DI_REMOTE_BASE_GTK="cdrom/gtk"
DI_REMOTE_KERNEL="vmlinuz"
;;
esac
;;
esac
2007-09-23 08:05:14 +00:00
Check_multiarchitecture
2007-09-23 08:04:52 +00:00
Install_file() {
local FILE
FILE="${1}"
local TARGET
TARGET="${2}"
SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')"
if [ -z "${SOURCE}" ]
then
SOURCE="$(basename ${FILE} | awk -F_ '{ print $1 }')"
fi
case "${SOURCE}" in
lib?*)
LETTER="$(echo ${SOURCE} | sed 's|\(....\).*|\1|')"
;;
*)
LETTER="$(echo ${SOURCE} | sed 's|\(.\).*|\1|')"
;;
esac
# Install directory
2008-01-15 18:42:28 -01:00
mkdir -p "${TARGET}"/"${LETTER}"/"${SOURCE}"
# Move files
2008-01-15 18:42:28 -01:00
cp "${FILE}" "${TARGET}"/"${LETTER}"/"${SOURCE}"
}
# Set absolute directory for caching; we require it when we call Download_file
# from a non-standard cwd.
_LH_CACHE_DIR="$(pwd)/cache/binary_debian-installer"
Download_file () {
local _LH_TARGET
_LH_TARGET="${1}"
local _LH_URL
_LH_URL="${2}"
_LH_CACHE_FILE="${_LH_CACHE_DIR}/$(echo "${_LH_URL}" | sed 's|/|_|g')"
if [ ! -f "${_LH_CACHE_FILE}" ]
then
mkdir -p ${_LH_CACHE_DIR}
if ! wget ${WGET_OPTIONS} -O "${_LH_CACHE_FILE}" "${_LH_URL}"
then
rm -f "${_LH_CACHE_FILE}"
Echo_error "Could not download file: %s" "${_LH_URL}"
exit 1
fi
fi
if [ "$(stat --printf %d "${_LH_CACHE_DIR}")" = "$(stat --printf %d ./)" ]
then
CP_OPTIONS="-l"
fi
cp -f ${CP_OPTIONS} -- "${_LH_CACHE_FILE}" "${_LH_TARGET}"
}
VMLINUZ_DI="vmlinuz"
INITRD_DI="initrd.gz"
DESTDIR_DI="${DESTDIR}"
VMLINUZ_GI="gtk/vmlinuz"
INITRD_GI="gtk/initrd.gz"
DESTDIR_GI="${DESTDIR}/gtk"
if [ "${LH_DEBIAN_INSTALLER_DISTRIBUTION}" = "daily" ]
2007-09-23 08:05:21 +00:00
then
LH_DEBIAN_INSTALLER_DISTRIBUTION="sid"
2007-09-23 08:05:21 +00:00
# Debian Installer daily builds
case "${LH_ARCHITECTURE}" in
alpha|amd64|hppa|ia64|mips|mipsel|powerpc)
URL="http://d-i.debian.org/daily-images/${LH_ARCHITECTURE}/daily/"
2007-09-23 08:05:21 +00:00
;;
2007-09-23 08:05:14 +00:00
arm|armel)
2007-09-23 08:05:21 +00:00
URL="http://people.debian.org/~kmuto/d-i/images/daily/"
;;
2007-09-23 08:05:14 +00:00
2007-09-23 08:05:21 +00:00
i386)
URL="http://people.debian.org/~joeyh/d-i/images/daily/"
;;
2007-09-23 08:05:14 +00:00
2007-09-23 08:05:21 +00:00
m68k)
URL="http://people.debian.org/~smarenka/d-i/images-m68k/daily/"
;;
2007-09-23 08:05:14 +00:00
2007-09-23 08:05:21 +00:00
s390)
URL="http://lophos.multibuild.org/d-i/images/daily/"
;;
2007-09-23 08:05:14 +00:00
2007-09-23 08:05:21 +00:00
sparc)
URL="http://people.debian.org/~stappers/d-i/images/daily/"
;;
2007-09-23 08:05:14 +00:00
2007-09-23 08:05:21 +00:00
*)
Echo_error "No daily-builds found for your architecture."
exit 1
;;
esac
else
URL="${LH_MIRROR_CHROOT}/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/installer-${LH_ARCHITECTURE}/current/images/"
2007-09-23 08:05:21 +00:00
fi
2007-09-23 08:05:14 +00:00
2007-09-23 08:05:12 +00:00
mkdir -p "${DESTDIR_DI}"
2008-06-19 17:56:11 +00:00
if [ "${LH_ARCHITECTURE}" = "sparc" ] && [ "${DI_IMAGE_TYPE}" = "netboot" ]
then
# There are no prepared kernel/initrd pairs for sparc netboot so we
# must unpack them from a mini.iso
2009-11-16 10:40:43 -01:00
Download_file mini.iso ${URL}/mini.iso
mkdir mini.tmp
${LH_ROOT_COMMAND} mount -o loop -t iso9660 mini.iso mini.tmp
cp mini.tmp/boot/vmlinuz-${DEFAULT_FLAVOUR} "${DESTDIR}"/"${VMLINUZ_DI}"
cp mini.tmp/boot/initrd.gz "${DESTDIR}"/"${INITRD_DI}"
${LH_ROOT_COMMAND} umount mini.tmp
rm -rf mini.tmp mini.iso
else
# Downloading debian-installer
Download_file "${DESTDIR}"/"${VMLINUZ_DI}" ${URL}/${DI_REMOTE_BASE}/${DI_REMOTE_KERNEL}
Download_file "${DESTDIR}"/"${INITRD_DI}" ${URL}/${DI_REMOTE_BASE}/initrd.gz
# Downloading graphical-installer
DOWNLOAD_GTK_INSTALLER=0
if [ "${LH_DEBIAN_INSTALLER_GUI}" = "true" ]
then
case "${LH_ARCHITECTURE}" in
amd64|i386)
DOWNLOAD_GTK_INSTALLER=1
;;
powerpc)
if [ "${LH_DEBIAN_INSTALLER}" = "netboot" ]
then
DOWNLOAD_GTK_INSTALLER=1
fi
;;
esac
fi
if [ ${DOWNLOAD_GTK_INSTALLER} -eq 1 ]
then
mkdir -p "${DESTDIR_GI}"
Download_file "${DESTDIR}"/"${VMLINUZ_GI}" ${URL}/${DI_REMOTE_BASE_GTK}/${DI_REMOTE_KERNEL}
Download_file "${DESTDIR}"/"${INITRD_GI}" ${URL}/${DI_REMOTE_BASE_GTK}/initrd.gz
fi
fi
2007-09-23 08:04:52 +00:00
# Only download additional packages if appropriate
2008-06-14 15:41:58 +00:00
if [ "${DI_IMAGE_TYPE}" != "netboot" ]
then
2007-09-23 08:05:13 +00:00
# Downloading additional packages
mkdir -p chroot/binary.deb/archives/partial
mkdir -p binary/pool/main
2007-09-23 08:05:13 +00:00
mv chroot/var/lib/dpkg/status chroot/var/lib/dpkg/status.tmp
touch chroot/var/lib/dpkg/status
2007-09-23 08:04:52 +00:00
2007-09-23 08:05:17 +00:00
case "${LH_ARCHITECTURE}" in
2007-09-23 08:05:13 +00:00
amd64)
DI_REQ_PACKAGES="lilo grub"
case "${LH_MODE}" in
ubuntu)
DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-generic"
;;
*)
DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-amd64"
;;
esac
2007-09-23 08:05:13 +00:00
;;
2007-09-23 08:04:52 +00:00
i386)
DI_REQ_PACKAGES="elilo lilo grub"
case "${LH_MODE}" in
ubuntu)
DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-generic"
;;
*)
DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-486 linux-image-2.6-686"
;;
esac
2007-09-23 08:05:13 +00:00
;;
2007-09-23 08:04:52 +00:00
sparc)
2008-08-17 04:58:43 +00:00
DI_REQ_PACKAGES="silo"
DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-sparc64 linux-image-2.6-sparc64-smp"
;;
2007-09-23 08:05:13 +00:00
powerpc)
DI_REQ_PACKAGES="yaboot"
DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-powerpc linux-image-2.6-powerpc64 linux-image-2.6-powerpc-smp"
2007-09-23 08:05:13 +00:00
;;
esac
DI_PACKAGES="${DI_PACKAGES} busybox cryptsetup lvm2"
2007-09-23 08:04:52 +00:00
# Set apt command prefix
_LH_APT_COMMAND="apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb -o APT::Install-Recommends=false --download-only"
if [ "${LH_DEBIAN_INSTALLER}" = "live" ]
then
# We don't want to duplicate .debs of packages in binary/pool that are already
# installed to target/ via live-installer.
#
# However, we need to force various packages' inclusion in binary/pool/main as
# d-i does not support (for example) re-installing grub from target/ - the grub
2008-08-17 04:58:43 +00:00
# .debs must actually exist.
# Modify dpkg status to show the required packages are not installed.
cp chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
for PACKAGE in ${DI_REQ_PACKAGES}
do
awk -v f=0 '
f == 1 { print "Status: purge ok not-installed"; f=0; next }
/Package: '"${PACKAGE}"'/ { f=1; }
{ print }
' chroot/var/lib/dpkg/status > chroot/var/lib/dpkg/status.awk
mv chroot/var/lib/dpkg/status.awk chroot/var/lib/dpkg/status
done
# Download .deb's that we just marked as "purged" which caused broken dependencies
Chroot chroot ${_LH_APT_COMMAND} -f dist-upgrade
# Revert dpkg status file
mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
# Download .debs of the required packages
Chroot chroot ${_LH_APT_COMMAND} install ${DI_REQ_PACKAGES}
else
# Download .debs of the required packages
Chroot chroot ${_LH_APT_COMMAND} install ${DI_PACKAGES}
# Revert dpkg status file
mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
fi
2007-09-23 08:05:13 +00:00
mv chroot/binary.deb ./
2008-04-17 08:42:34 +00:00
if Find_files binary.deb/archives/*.deb
then
for FILE in binary.deb/archives/*.deb
do
Install_file "${FILE}" "binary/pool/main"
done
fi
2007-09-23 08:04:52 +00:00
if [ "${LH_DEBIAN_INSTALLER}" != "live" ]
then
# 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 "Could not find cache/packages_bootstrap."
Echo_error "You selected values of LH_CACHE, LH_CACHE_PACKAGES, LH_CACHE_STAGES and LH_DEBIAN_INSTALLER which will result in 'bootstrap' packages not being cached - these are required when integrating the Debian Installer."
exit 1
fi
fi
2007-09-23 08:04:52 +00:00
# Including local debs
if Find_files config/binary_local-debs/*_"${LH_ARCHITECTURE}".deb
then
for FILE in config/binary_local-debs/*_"${LH_ARCHITECTURE}".deb
do
Install_file "${FILE}" "binary/pool/main"
done
fi
if Find_files config/binary_local-debs/*_all.deb
then
for FILE in config/binary_local-debs/*_all.deb
do
Install_file "${FILE}" "binary/pool/main"
done
fi
2007-09-23 08:05:13 +00:00
# Generating deb indices
mkdir -p binary/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}
2007-09-23 08:04:52 +00:00
mv binary chroot/root
echo "cd /root/binary && apt-ftparchive packages pool/main > dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages" > chroot/binary.sh
Chroot chroot "sh binary.sh"
rm -f chroot/binary.sh
mv chroot/root/binary ./
gzip -9 -c binary/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages > binary/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages.gz
2007-09-23 08:05:12 +00:00
# Fetching release
Download_file binary/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Release "${LH_MIRROR_CHROOT}"/dists/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/main/binary-"${LH_ARCHITECTURE}"/Release
2007-09-23 08:04:52 +00:00
mkdir binary.udeb
cd binary.udeb
2007-09-23 08:05:12 +00:00
# Downloading udeb indices
Download_file Packages.gz "${LH_MIRROR_CHROOT}"/dists/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LH_ARCHITECTURE}"/Packages.gz
gunzip -c Packages.gz > Packages
2007-09-23 08:05:12 +00:00
# Sorting udebs
UDEBS="$(awk '/Filename: / { print $2 }' Packages)"
2007-09-23 08:05:12 +00:00
# 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 Find_files ../config/binary_local-udebs/*_"${LH_ARCHITECTURE}".udeb
2007-09-23 08:05:13 +00:00
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
2007-09-23 08:05:13 +00:00
fi
2008-04-17 08:42:34 +00:00
if Find_files ../config/binary_local-udebs/*_all.udeb
then
for FILE in ../config/binary_local-udebs/*_all.udeb
do
Install_file "${FILE}" "pool/main"
2007-09-23 08:05:12 +00:00
# Prefer local udebs over downloaded udebs
rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb
done
fi
2007-09-23 08:05:13 +00:00
# Excluding udebs
grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/udeb_exclude > exclude || true
grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/exclude-udebs >> exclude || true
grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/exclude-udebs-${LH_ARCHITECTURE} >> exclude || true
2007-09-23 08:05:12 +00:00
# Local exclude file
if [ -e ../config/binary_debian-installer/udeb_exclude ]
then
cat ../config/binary_debian-installer/udeb_exclude >> exclude
fi
2007-09-23 08:05:12 +00:00
# Excluding udebs from excludes because we want them to be in the image on purpose
sed -i -e 's|di-utils-exit-installer||' exclude # used for live-installer-launcher
while read EXCLUDE
do
if [ "${LH_DEBIAN_INSTALLER}" = "live" ] && [ "${EXCLUDE}" = "live-installer" ]
then
continue
fi
rm -f ${EXCLUDE}_*.udeb
done < exclude
2007-09-23 08:05:12 +00:00
# Enable live-installer
2009-11-16 10:40:43 -01:00
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
2007-09-23 08:05:12 +00:00
# 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_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LH_ARCHITECTURE}"
cd "${OLDPWD}"
mv binary.udeb chroot/root
echo "cd /root/binary.udeb && apt-ftparchive packages pool/main > dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LH_ARCHITECTURE}/Packages" > chroot/binary.sh
Chroot chroot "sh binary.sh"
rm -f chroot/binary.sh
mv chroot/root/binary.udeb ./
cd binary.udeb
gzip -9 -c dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LH_ARCHITECTURE}/Packages > dists/${LH_DEBIAN_INSTALLER_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
mv binary chroot/root
cat > chroot/binary.sh << EOF
cd /root/binary && apt-ftparchive \
-o APT::FTPArchive::Release::Origin="Debian" \
-o APT::FTPArchive::Release::Label="Debian" \
-o APT::FTPArchive::Release::Suite="${LH_DEBIAN_INSTALLER_DISTRIBUTION}" \
-o APT::FTPArchive::Release::Version="4.0" \
-o APT::FTPArchive::Release::Codename="${LH_DEBIAN_INSTALLER_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 dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION} > dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/Release
EOF
Chroot chroot "sh binary.sh"
rm -f chroot/binary.sh
mv chroot/root/binary ./
# Creating dist symlinks
for DISTRIBUTION in frozen stable testing unstable
do
ln -s ${LH_DEBIAN_INSTALLER_DISTRIBUTION} binary/dists/${DISTRIBUTION}
done
2007-09-23 12:05:10 +00:00
case "${LH_BINARY_IMAGES}" in
usb*)
;;
*)
ln -s . binary/debian
;;
esac
2007-09-23 08:04:52 +00:00
# Including preseeding files
if Find_files config/binary_debian-installer/*.cfg
then
cp config/binary_debian-installer/*.cfg binary/install
fi
fi
2008-04-17 08:42:34 +00:00
Repack_initrd()
{
local TARGET_INITRD
local INCLUDE_PATH
TARGET_INITRD="${1}"
INCLUDE_PATH="${2}"
REPACK_TMPDIR="unpacked-initrd"
2008-04-17 08:42:34 +00:00
if [ -d "${INCLUDE_PATH}" ]
then
INCLUDE_PATH=$(readlink -f ${INCLUDE_PATH})
fi
# cpio does not have a "extract to directory", so we must change directory
mkdir -p ${REPACK_TMPDIR}
cd ${REPACK_TMPDIR}
gzip -d < ../${TARGET_INITRD} | cpio -i --make-directories --no-absolute-filenames
if [ ! -d "${INCLUDE_PATH}" ]
then
# Invoked the old way, just copy the preseeds
cp ../config/binary_debian-installer/*.cfg .
else
# New way, include target directory content in the initrd
REPACK_TMPDIR_ABS="${PWD}"
cd "${INCLUDE_PATH}"
find -print0 | cpio -pumd0 --no-preserve-owner "${REPACK_TMPDIR_ABS}/"
cd "${OLDPWD}"
fi
find -print0 | cpio -H newc -o0 | gzip -9 > ../${TARGET_INITRD}
cd ..
rm -rf ${REPACK_TMPDIR}
}
# Preseed d-i by repacking the initrd in certain situations
2008-06-14 15:41:58 +00:00
if [ "${DI_IMAGE_TYPE}" = "netboot" ] && [ -e config/binary_debian-installer/preseed.cfg ]
then
2008-04-17 08:42:34 +00:00
Repack_initrd "${DESTDIR}"/"${INITRD_DI}"
if [ -e "${DESTDIR}"/"${INITRD_GI}" ]
then
2008-04-17 08:42:34 +00:00
Repack_initrd "${DESTDIR}"/"${INITRD_GI}"
fi
fi
# Include content of config/binary_debian-installer-includes if exists and not empty
if [ -d config/binary_debian-installer-includes ] && [ -n "$(ls -A config/binary_debian-installer-includes)" ]
then
Repack_initrd "${DESTDIR}"/"${INITRD_DI}" config/binary_debian-installer-includes
if [ -e "${DESTDIR}"/"${INITRD_GI}" ]
then
Repack_initrd "${DESTDIR}"/"${INITRD_GI}" config/binary_debian-installer-includes
fi
fi
# Saving cache
Save_cache cache/packages_binary
# Removing depends
Remove_package
2007-09-23 08:04:52 +00:00
# Creating stage file
Create_stagefile .stage/binary_debian-installer