live-build/scripts/build/lb_binary_includes

169 lines
4.3 KiB
Plaintext
Raw Normal View History

2007-09-23 08:04:46 +00:00
#!/bin/sh
## live-build(7) - System Build Scripts
2010-09-26 10:38:38 +00:00
## 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-09-23 08:04:46 +00:00
set -e
2007-09-23 08:05:11 +00:00
# Including common functions
. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh
2007-09-23 08:04:46 +00:00
2007-09-23 08:05:11 +00:00
# Setting static variables
DESCRIPTION="$(Echo 'copy files into binary')"
2007-09-23 08:04:48 +00:00
HELP=""
USAGE="${PROGRAM} [--force]"
Arguments "${@}"
2007-09-23 08:04:46 +00:00
# Reading configuration files
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
2007-09-23 08:04:46 +00:00
Set_defaults
if [ "${LB_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
Require_stagefile .stage/config .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
if [ ! -d "${LB_INCLUDES}" ]
2007-09-23 08:04:49 +00:00
then
if [ -d ../"${LB_INCLUDES}" ]
2007-09-23 08:04:49 +00:00
then
LB_INCLUDES="../${LB_INCLUDES}"
2007-09-23 08:04:49 +00:00
else
Echo_error "user specified includes not accessible in %s" "${LB_INCLUDES}"
2007-09-23 08:04:49 +00:00
exit 1
fi
fi
2007-09-23 08:05:09 +00:00
# Checking local includes
if [ -d config/includes/"${LB_DISTRIBUTION}" ]
2007-09-23 08:05:09 +00:00
then
LB_INCLUDES="config/includes"
2007-09-23 08:05:09 +00:00
fi
2007-09-23 08:04:50 +00:00
# Assemble architecture
case "${LB_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"
;;
sparc)
ARCH="spa"
;;
2007-09-23 08:04:50 +00:00
esac
2007-09-23 08:05:13 +00:00
# Working arround vfat limitations
case "${LB_BINARY_IMAGES}" in
usb*)
case "${LB_BINARY_FILESYSTEM}" in
fat*)
CP_OPTIONS="-L"
;;
esac
;;
esac
2007-09-23 08:05:13 +00:00
# Copying common templates
if [ -d "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/common ] && \
Find_files "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/common/*
2007-09-23 08:05:13 +00:00
then
cp -r ${CP_OPTIONS} "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/common/* binary
2007-09-23 08:05:13 +00:00
fi
if [ -d "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/common."${ARCH}" ] && \
Find_files "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/common."${ARCH}"/*
2007-09-23 08:05:13 +00:00
then
cp -r ${CP_OPTIONS} "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/common."${ARCH}"/* binary
2007-09-23 08:05:13 +00:00
fi
# Copying live templates
if [ -d "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/live ] && \
Find_files "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/live/*
2007-09-23 08:05:13 +00:00
then
cp -r ${CP_OPTIONS} "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/live/* binary
2007-09-23 08:05:13 +00:00
fi
if [ -d "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/live."${ARCH}" ] && \
Find_files "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/live."${ARCH}"/*
2007-09-23 08:05:13 +00:00
then
cp -r ${CP_OPTIONS} "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/live."${ARCH}"/* binary
2007-09-23 08:05:13 +00:00
fi
if [ "${LB_DEBIAN_INSTALLER}" != "false" ]
2007-09-23 08:05:13 +00:00
then
2007-09-23 08:05:12 +00:00
# Copying install templates
if [ -d "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/install ] && \
Find_files "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/install/*
2007-09-23 08:04:50 +00:00
then
cp -r ${CP_OPTIONS} "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/install/* binary
2007-09-23 08:04:50 +00:00
fi
if [ -d "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/install."${ARCH}" ] && \
Find_files "${LB_INCLUDES}"/"${LB_DISTRIBUTION}"/install."${ARCH}"/*
2007-09-23 08:04:50 +00:00
then
cp -r ${CP_OPTIONS} "${LB_INCLUDES}"/"${LB_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 ${LB_ARCHITECTURE} | sed -e 's| |/|g')"
DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')"
DISTRIBUTION="${DISTRIBUTION}$(echo ${LB_DISTRIBUTION} | cut -b 2-)"
eval VERSION="$`echo RELEASE_${LB_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
if [ "${LB_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
if [ -f binary/README.html ]
then
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
fi
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