live-build/functions/templates.sh

36 lines
786 B
Bash
Raw Normal View History

2007-09-23 08:05:13 +00:00
#!/bin/sh
# templates.sh - handle templates files
2008-03-06 14:43:00 -01:00
# Copyright (C) 2006-2008 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.
set -e
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
2007-09-23 08:05:17 +00:00
Echo_error "templates not accessible in ${LH_TEMPLATES} nor config/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
2007-09-23 08:05:17 +00:00
Echo_error "${PACKAGE} templates not accessible in ${LH_TEMPLATES}"
2007-09-23 08:05:13 +00:00
exit 1
fi
}