2007-09-23 08:05:12 +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-09-23 08:05:12 +00:00
|
|
|
|
|
|
|
Expand_packagelist ()
|
|
|
|
{
|
2008-04-17 20:08:58 +00:00
|
|
|
_LH_EXPAND_QUEUE="$(basename "${1}")"
|
2007-09-23 08:05:12 +00:00
|
|
|
|
|
|
|
shift
|
|
|
|
|
2008-04-17 20:08:58 +00:00
|
|
|
while [ -n "${_LH_EXPAND_QUEUE}" ]
|
2007-09-23 08:05:12 +00:00
|
|
|
do
|
2008-04-17 20:08:58 +00:00
|
|
|
_LH_LIST_NAME="$(echo ${_LH_EXPAND_QUEUE} | cut -d" " -f1)"
|
|
|
|
_LH_EXPAND_QUEUE="$(echo ${_LH_EXPAND_QUEUE} | cut -s -d" " -f2-)"
|
|
|
|
_LH_LIST_LOCATION=""
|
2008-04-26 22:43:01 +00:00
|
|
|
_LH_NESTED=0
|
|
|
|
_LH_ENABLED=1
|
2008-04-17 20:08:58 +00:00
|
|
|
|
2010-08-14 18:29:05 +00:00
|
|
|
for _LH_SEARCH_PATH in ${@} "${LH_BASE:-/usr/share/live/build}/lists"
|
2008-04-17 20:08:58 +00:00
|
|
|
do
|
|
|
|
if [ -e "${_LH_SEARCH_PATH}/${_LH_LIST_NAME}" ]
|
|
|
|
then
|
|
|
|
_LH_LIST_LOCATION="${_LH_SEARCH_PATH}/${_LH_LIST_NAME}"
|
2008-09-21 10:54:47 +00:00
|
|
|
break
|
2008-04-17 20:08:58 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "${_LH_LIST_LOCATION}" ]
|
|
|
|
then
|
|
|
|
echo "W: Unknown package list '${_LH_LIST_NAME}'" >&2
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2008-04-26 22:43:01 +00:00
|
|
|
while read _LH_LINE
|
|
|
|
do
|
|
|
|
case "${_LH_LINE}" in
|
|
|
|
\#if\ *)
|
|
|
|
if [ ${_LH_NESTED} -eq 1 ]
|
|
|
|
then
|
|
|
|
echo "E: Nesting conditionals is not supported" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
_LH_NESTED=1
|
|
|
|
|
2008-04-28 16:05:30 +00:00
|
|
|
_LH_NEEDLE="$(echo "${_LH_LINE}" | cut -d' ' -f3-)"
|
|
|
|
_LH_HAYSTACK="$(eval "echo \$LH_$(echo "${_LH_LINE}" | cut -d' ' -f2)")"
|
|
|
|
|
|
|
|
_LH_ENABLED=0
|
|
|
|
for _LH_NEEDLE_PART in ${_LH_NEEDLE}
|
|
|
|
do
|
|
|
|
for _LH_HAYSTACK_PART in ${_LH_HAYSTACK}
|
|
|
|
do
|
|
|
|
if [ "${_LH_NEEDLE_PART}" = "${_LH_HAYSTACK_PART}" ]
|
|
|
|
then
|
|
|
|
_LH_ENABLED=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
2008-04-26 22:43:01 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
\#endif*)
|
|
|
|
_LH_NESTED=0
|
|
|
|
_LH_ENABLED=1
|
|
|
|
;;
|
|
|
|
|
|
|
|
\#*)
|
|
|
|
if [ ${_LH_ENABLED} -ne 1 ]
|
|
|
|
then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Find includes
|
|
|
|
_LH_INCLUDES="$(echo "${_LH_LINE}" | sed -n \
|
|
|
|
-e 's|^#<include> \([^ ]*\)|\1|gp' \
|
|
|
|
-e 's|^#include <\([^ ]*\)>|\1|gp')"
|
|
|
|
|
|
|
|
# Add to queue
|
|
|
|
_LH_EXPAND_QUEUE="$(echo ${_LH_EXPAND_QUEUE} ${_LH_INCLUDES} |
|
|
|
|
sed -e 's|[ ]*$||' -e 's|^[ ]*||')"
|
|
|
|
;;
|
2008-04-17 20:08:58 +00:00
|
|
|
|
2008-04-26 22:43:01 +00:00
|
|
|
*)
|
|
|
|
if [ ${_LH_ENABLED} -eq 1 ]
|
|
|
|
then
|
|
|
|
echo "${_LH_LINE}"
|
|
|
|
fi
|
|
|
|
;;
|
2008-04-17 20:08:58 +00:00
|
|
|
|
2008-04-26 22:43:01 +00:00
|
|
|
esac
|
|
|
|
done < "${_LH_LIST_LOCATION}"
|
2007-09-23 08:05:12 +00:00
|
|
|
done
|
|
|
|
}
|