function import_export_templates {
- # import from or export to $BASE_CONF in svn repository
+ # import from or export to $BASE_CONF in a svn repository
# usage: template_export <import|export> <repository>
local templates_folder basedir repository mode preposition
# update the template package list
- components="$TEMPLATE.template $TEMPLATE.perms $TEMPLATE.d $TEMPLATE.s"
+ components="$TEMPLATE_BASE.template $TEMPLATE_BASE.perms $TEMPLATE_BASE.d $TEMPLATE_BASE.s"
for component in $components; do
if [ ! -a "$component" ]; then
echo $BASENAME: template component not found: $component
# add a file in a template
# usage: template_add <jail-root> <file>
- local info_commit
+ local info_commit cwd
mkdir -p $TEMPLATE_BASE.d
mkdir -p $TEMPLATE_BASE.d/`dirname $candidate`
cp -a $jail/$candidate $TEMPLATE_BASE.d/$candidate
if use_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then
+ cwd="`pwd`"
cd $TEMPLATE_BASE.d
svn add ./$candidate
- # TODO: error checking
+ if [ "$?" != "0" ]; then
+ echo $BASENAME: error adding $candidate into the revision system
+ fi
+ cd $cwd
info_commit="yes"
else
echo Added $jail/$candidate on $TEMPLATE_BASE.d/$candidate
destination="`echo $TEMPLATE_BASE.d/$file | sed -e 's/\/$//'`"
cp -a $jail/$file $destination
if use_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then
+ cwd="`pwd`"
cd $TEMPLATE_BASE.d
svn add ./$file
- # TODO: error checking
+ if [ "$?" != "0" ]; then
+ echo $BASENAME: error adding $candidate into the revision system
+ fi
+ cd $cwd
echo $BASENAME: please run jail-commit to add $file into the svn repository
true
else