2007-09-23 08:04:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# conffile.sh - handle configuration files
|
2008-03-06 14:43:00 -01:00
|
|
|
# Copyright (C) 2006-2008 Daniel Baumann <daniel@debian.org>
|
2007-09-23 08:04:48 +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.
|
2007-09-23 08:04:46 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2008-10-22 19:08:42 +00:00
|
|
|
Get_conffiles ()
|
2007-09-23 08:04:46 +00:00
|
|
|
{
|
2008-04-07 10:01:37 +00:00
|
|
|
if [ -n "${LH_CONFIG}" ]
|
|
|
|
then
|
|
|
|
FILES="${LH_CONFIG}"
|
|
|
|
else
|
2008-04-07 10:04:35 +00:00
|
|
|
for FILE in ${@}
|
|
|
|
do
|
2008-04-08 15:58:47 +00:00
|
|
|
FILES="${FILES} ${FILE} ${FILE}.${LH_ARCHITECTURE} ${FILE}.${DISTRIBUTION}"
|
2008-04-07 10:04:35 +00:00
|
|
|
FILES="${FILES} config/$(echo ${PROGRAM} | sed -e 's|^lh_||')"
|
|
|
|
FILES="${FILES} config/$(echo ${PROGRAM} | sed -e 's|^lh_||').${ARCHITECTURE}"
|
|
|
|
FILES="${FILES} config/$(echo ${PROGRAM} | sed -e 's|^lh_||').${DISTRIBUTION}"
|
|
|
|
done
|
2008-04-07 10:01:37 +00:00
|
|
|
fi
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2008-10-22 19:08:42 +00:00
|
|
|
echo ${FILES}
|
|
|
|
}
|
|
|
|
|
|
|
|
Read_conffile ()
|
|
|
|
{
|
|
|
|
for CONFFILE in Get_conffiles "${@}"
|
2007-11-13 19:09:34 -01:00
|
|
|
do
|
2008-04-07 10:04:35 +00:00
|
|
|
if [ -f "${CONFFILE}" ]
|
2007-09-23 08:04:47 +00:00
|
|
|
then
|
2008-04-07 10:04:35 +00:00
|
|
|
if [ -r "${CONFFILE}" ]
|
2007-11-13 19:09:34 -01:00
|
|
|
then
|
2008-08-11 20:28:54 +00:00
|
|
|
Echo_debug "Reading configuration file %s" "${CONFFILE}"
|
2008-04-07 10:04:35 +00:00
|
|
|
. "${CONFFILE}"
|
2007-11-13 19:09:34 -01:00
|
|
|
else
|
2008-08-11 20:28:54 +00:00
|
|
|
Echo_warning "Failed to read configuration file %s" "${CONFFILE}"
|
2007-11-13 19:09:34 -01:00
|
|
|
fi
|
2007-09-23 08:04:47 +00:00
|
|
|
fi
|
2007-11-13 19:09:34 -01:00
|
|
|
done
|
2007-09-23 08:04:46 +00:00
|
|
|
}
|
2008-10-22 19:09:11 +00:00
|
|
|
|
2008-10-23 11:03:31 +00:00
|
|
|
Print_conffiles ()
|
|
|
|
{
|
2008-10-22 19:09:11 +00:00
|
|
|
for CONFFILE in Get_conffiles "${@}"
|
|
|
|
do
|
|
|
|
if [ -f "${CONFFILE}" ]
|
|
|
|
then
|
|
|
|
Echo_file "${CONFFILE}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|