testing fix for conffile prompts

This commit is contained in:
Sean Finney 2006-12-05 18:34:39 +00:00
parent 0ef129fa86
commit 5cc5d66652
6 changed files with 45 additions and 13 deletions

26
debian/functions vendored Normal file
View file

@ -0,0 +1,26 @@
# functions for use by nagios plugins maintainer scripts
# called as "register_cfgs $2" from postinst
register_cfgs(){
local newinst
if [ -z "$1" ]; then
newinst="yes"
tmpfile=`mktemp -t nagios-plugins.XXXXXX`
if [ ! -f "$tmpfile" ]; then
echo "error creating tempfile >&2"
exit 1
fi
fi
(
cd $templdir
for f in *cfg; do
dest=/etc/nagios-plugins/config/$f
if [ "$newinst" = "yes" ] && [ -f $dest ]; then
cat $dest > $tmpfile
ucf $tmpfile $dest
fi
ucf $f /etc/nagios-plugins/config/$f
done
);
if [ "$newinst" = "yes" ]; then rm -f $tmpfile; fi
}