live-build/helpers/lh_binary_includes

161 lines
4.3 KiB
Plaintext
Raw Normal View History

2007-09-23 08:04:46 +00:00
#!/bin/sh
# lh_binary_includes(1) - copy files into binary
2008-03-06 14:43:00 -01:00
# Copyright (C) 2006-2008 Daniel Baumann <daniel@debian.org>
2007-09-23 08:04:48 +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.
2007-09-23 08:04:46 +00:00
set -e
2007-09-23 08:05:11 +00:00
# Including common functions
LH_BASE="${LH_BASE:-/usr/share/live-helper}"
for FUNCTION in "${LH_BASE}"/functions/*.sh
2007-09-23 08:04:46 +00:00
do
2007-09-23 08:05:11 +00:00
. "${FUNCTION}"
2007-09-23 08:04:46 +00:00
done
2007-09-23 08:05:11 +00:00
# Setting static variables
2007-09-23 08:04:48 +00:00
DESCRIPTION="copy files into binary"
HELP=""
USAGE="${PROGRAM} [--force]"
Arguments "${@}"
2007-09-23 08:04:46 +00:00
# Reading configuration files
2008-04-07 10:10:21 +00:00
Read_conffile config/all config/common config/bootstrap config/chroot config/binary config/source
2007-09-23 08:04:46 +00:00
Set_defaults
2007-09-23 08:05:17 +00:00
if [ "${LH_INCLUDES}" = "none" ]
2007-09-23 08:04:49 +00:00
then
exit 0
fi
2007-09-23 08:05:11 +00:00
Echo_message "Begin copying binary includes..."
2007-09-23 08:04:49 +00:00
2007-09-23 08:04:46 +00:00
# Requiring stage file
2007-09-23 08:04:47 +00:00
Require_stagefile .stage/bootstrap
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:50 +00:00
# Checking stage file
Check_stagefile .stage/binary_includes
2007-09-23 08:04:46 +00:00
# Checking lock file
2007-09-23 08:04:47 +00:00
Check_lockfile .lock
2007-09-23 08:04:46 +00:00
# Creating lock file
2007-09-23 08:04:47 +00:00
Create_lockfile .lock
2007-09-23 08:04:46 +00:00
2007-09-23 08:05:09 +00:00
# Check user includes
2007-09-23 08:05:17 +00:00
if [ ! -d "${LH_INCLUDES}" ]
2007-09-23 08:04:49 +00:00
then
2007-09-23 08:05:17 +00:00
if [ -d ../"${LH_INCLUDES}" ]
2007-09-23 08:04:49 +00:00
then
2007-09-23 08:05:17 +00:00
LH_INCLUDES="../${LH_INCLUDES}"
2007-09-23 08:04:49 +00:00
else
2007-09-23 08:05:17 +00:00
Echo_error "user specified includes not accessible in ${LH_INCLUDES}"
2007-09-23 08:04:49 +00:00
exit 1
fi
fi
2007-09-23 08:05:09 +00:00
# Checking local includes
2007-09-23 08:05:17 +00:00
if [ -d config/includes/"${LH_DISTRIBUTION}" ]
2007-09-23 08:05:09 +00:00
then
2007-09-23 08:05:17 +00:00
LH_INCLUDES="config/includes"
2007-09-23 08:05:09 +00:00
fi
2007-09-23 08:04:50 +00:00
# Assemble architecture
2007-09-23 08:05:17 +00:00
case "${LH_ARCHITECTURE}" in
2007-09-23 08:04:50 +00:00
amd64)
ARCH="amd"
;;
i386)
ARCH="386"
;;
2007-09-23 08:04:46 +00:00
2007-09-23 08:04:50 +00:00
powerpc)
ARCH="ppc"
;;
esac
2007-09-23 08:05:13 +00:00
# Working arround vfat limitations
2007-09-23 08:05:17 +00:00
if [ "${LH_BINARY_IMAGE}" = "usb-hdd" ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:05:13 +00:00
CP_OPTIONS="-L"
fi
# Copying common templates
2007-09-23 08:05:17 +00:00
if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common ] && \
ls "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common/* > /dev/null 2>&1
2007-09-23 08:05:13 +00:00
then
2007-09-23 08:05:17 +00:00
cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common/* binary
2007-09-23 08:05:13 +00:00
fi
2007-09-23 08:05:17 +00:00
if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common."${ARCH}" ] && \
ls "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common."${ARCH}"/* > /dev/null 2>&1
2007-09-23 08:05:13 +00:00
then
2007-09-23 08:05:17 +00:00
cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common."${ARCH}"/* binary
2007-09-23 08:05:13 +00:00
fi
# Copying live templates
2007-09-23 08:05:17 +00:00
if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live ] && \
ls "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live/* > /dev/null 2>&1
2007-09-23 08:05:13 +00:00
then
2007-09-23 08:05:17 +00:00
cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live/* binary
2007-09-23 08:05:13 +00:00
fi
2007-09-23 08:05:17 +00:00
if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live."${ARCH}" ] && \
ls "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live."${ARCH}"/* > /dev/null 2>&1
2007-09-23 08:05:13 +00:00
then
2007-09-23 08:05:17 +00:00
cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live."${ARCH}"/* binary
2007-09-23 08:05:13 +00:00
fi
2007-09-23 08:05:17 +00:00
if [ "${LH_DEBIAN_INSTALLER}" != "disabled" ]
2007-09-23 08:05:13 +00:00
then
2007-09-23 08:05:12 +00:00
# Copying install templates
2007-09-23 08:05:17 +00:00
if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install ] && \
ls "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install/* > /dev/null 2>&1
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:17 +00:00
cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install/* binary
2007-09-23 08:04:50 +00:00
fi
2007-09-23 08:05:17 +00:00
if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install."${ARCH}" ] && \
ls "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install."${ARCH}"/* > /dev/null 2>&1
2007-09-23 08:04:50 +00:00
then
2007-09-23 08:05:17 +00:00
cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install."${ARCH}"/* binary
2007-09-23 08:04:50 +00:00
fi
2007-09-23 08:05:12 +00:00
# Adjusting install templates
ARCHITECTURE="$(echo ${LH_ARCHITECTURE} | sed -e 's| |/|g')"
DISTRIBUTION="$(echo ${LH_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')"
DISTRIBUTION="${DISTRIBUTION}$(echo ${LH_DISTRIBUTION} | cut -b 2-)"
eval VERSION="$`echo VERSION_${LH_DISTRIBUTION}`"
2007-09-23 08:05:13 +00:00
if [ -d binary/pool/main/l/live-installer ]
then
TYPE="LIVE/INSTALL"
fi
TYPE="LIVE/NETINST"
DEBIAN_NAME="Debian GNU/Linux ${VERSION} \"${DISTRIBUTION}\" - Official ${ARCHITECTURE} ${TYPE} Binary $(date +%Y%m%d-%H:%M)"
DEBIAN_DATE="$(date +%Y%m%d-%H:%M)"
2007-09-23 08:04:50 +00:00
2007-09-23 08:05:17 +00:00
if [ "${LH_ARCHITECTURE}" = "i386" ]
2007-09-23 08:04:50 +00:00
then
DEBIAN_TOOLS_HTML=" <P>\n <tt>&nbsp;\n <A href="tools/">/tools/</a>\n </tt>\n\n and\n <tt>&nbsp;\n <A href="install/floppy/">/install/floppy/</a>\n </tt>"
DEBIAN_TOOLS_TXT="/tools/ and /install/floppy/"
else
DEBIAN_TOOLS_HTML=" <P>\n <tt>&nbsp;\n <A href="tools/">/tools/</a>\n </tt>\n\n\n\n\n\n"
DEBIAN_TOOLS_TXT="/tools/"
fi
sed -i -e "s|DEBIAN_NAME|${DEBIAN_NAME}|g" -e "s|DEBIAN_DATE|${DEBIAN_DATE}|g" -e "s|DEBIAN_TOOLS|${DEBIAN_TOOLS_HTML}|g" binary/README.html
sed -i -e "s|DEBIAN_NAME|${DEBIAN_NAME}|g" -e "s|DEBIAN_DATE|${DEBIAN_DATE}|g" -e "s|DEBIAN_TOOLS|${DEBIAN_TOOLS_TXT}|g" binary/README.txt
2007-09-23 08:04:46 +00:00
fi
# Creating stage file
2007-09-23 08:04:47 +00:00
Create_stagefile .stage/binary_includes