live-build/functions/templates.sh

34 lines
793 B
Bash
Raw Normal View History

2007-09-23 08:05:13 +00:00
#!/bin/sh
# templates.sh - handle templates files
# Copyright (C) 2006-2009 Daniel Baumann <daniel@debian.org>
2007-09-23 08:05:13 +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.
Check_templates ()
{
2007-09-23 08:05:16 +00:00
PACKAGE="${1}"
2007-09-23 08:05:13 +00:00
2007-09-23 08:05:15 +00:00
# Check user defined templates directory
2007-09-23 08:05:17 +00:00
if [ ! -e "${LH_TEMPLATES}" ]
2007-09-23 08:05:13 +00:00
then
2007-09-23 08:05:15 +00:00
if [ -d config/templates ]
then
2007-09-23 08:05:17 +00:00
LH_TEMPLATES=config/templates
2007-09-23 08:05:15 +00:00
else
Echo_error "templates not accessible in %s nor config/templates" "${LH_TEMPLATES}"
2007-09-23 08:05:15 +00:00
exit 1
fi
2007-09-23 08:05:13 +00:00
fi
2007-09-23 08:05:17 +00:00
if [ -d "${LH_TEMPLATES}/${PACKAGE}" ]
2007-09-23 08:05:13 +00:00
then
2007-09-23 08:05:17 +00:00
TEMPLATES="${LH_TEMPLATES}/${PACKAGE}"
2007-09-23 08:05:15 +00:00
else
Echo_error "%s templates not accessible in %s" "${PACKAGE}" "${LH_TEMPLATES}"
2007-09-23 08:05:13 +00:00
exit 1
fi
}