2007-09-23 08:05:12 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# packagelists.sh - expands package list includes
|
2008-03-06 14:43:00 -01:00
|
|
|
# Copyright (C) 2006-2008 Daniel Baumann <daniel@debian.org>
|
2007-09-23 08:05:12 +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
|
|
|
|
|
|
|
|
Expand_packagelist ()
|
|
|
|
{
|
|
|
|
# ${1} List name
|
|
|
|
# ${2} Default path to search
|
|
|
|
# ${3} Fallback path to search (optional)
|
|
|
|
|
|
|
|
# Does list exist in default path?
|
|
|
|
if [ -e "${2}/${1}" ];
|
|
|
|
then
|
|
|
|
Expand_packagelist_file "${2}/${1}" "${@}"
|
|
|
|
else
|
|
|
|
# If list exists in fallback, include it.
|
|
|
|
if [ -n "${3}" ] && [ -e "${3}/${1}" ]
|
|
|
|
then
|
|
|
|
Expand_packagelist_file "${3}/${1}" "${@}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
Expand_packagelist_file ()
|
|
|
|
{
|
|
|
|
local FILE="${1}"
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
|
2008-01-15 21:43:51 -01:00
|
|
|
for INCLUDE in $(sed -ne 's|^#<include> \(.*\)|\1|gp' -e 's|^#include <\(.*\)>|\1|gp' "${FILE}")
|
2007-09-23 08:05:12 +00:00
|
|
|
do
|
|
|
|
Expand_packagelist "${INCLUDE}" "${@}"
|
|
|
|
done
|
2008-01-15 06:25:29 -01:00
|
|
|
sed -ne 's|^\([^#].*\)|\1\n|gp' "${FILE}"
|
2007-09-23 08:05:12 +00:00
|
|
|
}
|