2007-10-18 20:28:54 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-09-02 11:12:37 +00:00
|
|
|
## live-build(7) - System Build Scripts
|
|
|
|
## Copyright (C) 2006-2010 Daniel Baumann <daniel@debian.org>
|
|
|
|
##
|
|
|
|
## live-build 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.
|
|
|
|
|
2007-10-18 20:28:54 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Including common functions
|
2010-09-07 13:11:20 +00:00
|
|
|
. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh
|
2007-10-18 20:28:54 +00:00
|
|
|
|
|
|
|
# Setting static variables
|
2009-01-15 01:37:42 -01:00
|
|
|
DESCRIPTION="$(Echo 'install local packages into binary')"
|
2007-10-18 20:28:54 +00:00
|
|
|
HELP=""
|
|
|
|
USAGE="${PROGRAM} [--force]"
|
|
|
|
|
|
|
|
Arguments "${@}"
|
|
|
|
|
|
|
|
# Reading configuration files
|
2008-10-28 14:26:17 -01:00
|
|
|
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
|
2007-10-18 20:28:54 +00:00
|
|
|
Set_defaults
|
|
|
|
|
|
|
|
Echo_message "Begin installing local packages lists..."
|
|
|
|
|
|
|
|
# Requiring stage file
|
2008-10-14 19:32:50 +00:00
|
|
|
Require_stagefile .stage/config .stage/bootstrap
|
2007-10-18 20:28:54 +00:00
|
|
|
|
|
|
|
# Checking stage file
|
|
|
|
Check_stagefile .stage/binary_local-packageslists
|
|
|
|
|
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
|
|
|
|
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
|
|
|
|
2010-09-19 15:36:56 +00:00
|
|
|
if Find_files config/binary_local-packageslists/*.list
|
2007-10-18 20:28:54 +00:00
|
|
|
then
|
2008-06-15 01:55:33 +00:00
|
|
|
# Restoring cache
|
|
|
|
Restore_cache cache/packages_chroot
|
|
|
|
|
|
|
|
# Check depends
|
|
|
|
Check_package chroot/usr/bin/apt-ftparchive apt-utils
|
|
|
|
|
|
|
|
# Installing depends
|
|
|
|
Install_package
|
|
|
|
|
2007-10-18 20:28:54 +00:00
|
|
|
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
|
|
|
|
|
2010-09-19 15:36:56 +00:00
|
|
|
for PACKAGESLIST in config/binary_local-packageslists/*.list
|
2007-10-18 20:28:54 +00:00
|
|
|
do
|
|
|
|
# Generate package list
|
2008-04-17 20:28:51 +00:00
|
|
|
Expand_packagelist "${PACKAGESLIST}" "config/binary_local-packageslists" "config/chroot_local-packageslists" > chroot/root/"$(basename ${PACKAGESLIST})"
|
2007-10-18 20:28:54 +00:00
|
|
|
|
|
|
|
# Downloading additional packages
|
2008-10-28 14:44:06 -01:00
|
|
|
Chroot chroot "xargs --arg-file=/root/$(basename ${PACKAGESLIST}) apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb --download-only install"
|
2008-04-17 20:27:02 +00:00
|
|
|
|
|
|
|
# Remove package list
|
|
|
|
rm chroot/root/"$(basename ${PACKAGESLIST})"
|
2007-10-18 20:28:54 +00:00
|
|
|
done
|
|
|
|
|
2007-11-01 15:52:12 -01:00
|
|
|
for FILE in chroot/binary.deb/archives/*.deb
|
2007-10-18 20:28:54 +00:00
|
|
|
do
|
|
|
|
SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')"
|
2010-07-12 19:37:57 +00:00
|
|
|
SECTION="$(dpkg -f ${FILE} Section | awk '{ print $1 }')"
|
2007-10-18 20:28:54 +00:00
|
|
|
|
|
|
|
if [ -z "${SOURCE}" ]
|
|
|
|
then
|
|
|
|
SOURCE="$(basename ${FILE} | awk -F_ '{ print $1 }')"
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "${SOURCE}" in
|
|
|
|
lib?*)
|
2008-01-15 06:25:29 -01:00
|
|
|
LETTER="$(echo ${SOURCE} | sed 's|\(....\).*|\1|')"
|
2007-10-18 20:28:54 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
2008-01-15 06:25:29 -01:00
|
|
|
LETTER="$(echo ${SOURCE} | sed 's|\(.\).*|\1|')"
|
2007-10-18 20:28:54 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2010-07-12 19:37:57 +00:00
|
|
|
if echo "${SECTION}" | grep -qs contrib
|
|
|
|
then
|
|
|
|
SECTION="contrib"
|
|
|
|
elif echo "${SECTION}" | grep -qs non-free
|
|
|
|
then
|
|
|
|
SECTION="non-free"
|
|
|
|
else
|
|
|
|
SECTION="main"
|
|
|
|
fi
|
|
|
|
|
2007-10-18 20:28:54 +00:00
|
|
|
# Install directory
|
2010-07-12 19:37:57 +00:00
|
|
|
mkdir -p binary/pool/${SECTION}/"${LETTER}"/"${SOURCE}"
|
2007-10-18 20:28:54 +00:00
|
|
|
|
|
|
|
# Move files
|
2010-07-12 19:37:57 +00:00
|
|
|
mv "${FILE}" binary/pool/${SECTION}/"${LETTER}"/"${SOURCE}"
|
2007-10-18 20:28:54 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
cd binary
|
2010-07-12 19:37:57 +00:00
|
|
|
|
|
|
|
for SECTION in pool/*
|
|
|
|
do
|
|
|
|
SECTION="$(basename ${SECTION})"
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
mkdir -p dists/${LB_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURE}
|
|
|
|
apt-ftparchive packages pool/${SECTION} > dists/${LB_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURE}/Packages
|
|
|
|
gzip -9 -c dists/${LB_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURE}/Packages > dists/${LB_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURE}/Packages.gz
|
2010-07-12 19:37:57 +00:00
|
|
|
done
|
|
|
|
|
2007-10-18 20:28:54 +00:00
|
|
|
cd "${OLDPWD}"
|
|
|
|
|
|
|
|
rm -rf chroot/binary.deb
|
|
|
|
mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
|
|
|
|
|
2008-06-15 01:55:33 +00:00
|
|
|
# Removing depends
|
|
|
|
Remove_package
|
|
|
|
|
|
|
|
# Saving cache
|
|
|
|
Save_cache cache/packages_chroot
|
|
|
|
|
2007-10-18 20:28:54 +00:00
|
|
|
# Creating stage file
|
|
|
|
Create_stagefile .stage/binary_local-packageslists
|
|
|
|
fi
|