#!/bin/bash # ------- # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA # -------- set -e MODULES_DIR="rsyncd/modules" GLOBAL_DIR="rsyncd/global" VAR_LIST="RSYNC_CONFIG_FILE" LLX_GETVAR="/usr/sbin/llxcfg-showvars" gen_conf(){ llxcfg-config dump "$GLOBAL_DIR" llxcfg-config list "$MODULES_DIR" |while read m ; do echo "[$(basename $m)]" llxcfg-config read "$MODULES_DIR/$m" echo "" done return 0 } #------ # main #----- eval `${LLX_GETVAR} ${VAR_LIST}` [ "$RSYNC_CONFIG_FILE" ] || exit 1 gen_conf |skel-install -t "${RSYNC_CONFIG_FILE}" # rsyncd.conf is generated from conffiles in /rsyncd/modules and rsyncd/global # Currently the package installs no default configuration at all # so the size of generated config file is tested to determine if rsync must be started as daemon if [ -s "./templates/$RSYNC_CONFIG_FILE" ] ; then llxcfg-systemvars add "RSYNC_ENABLE=true" else llxcfg-systemvars del "RSYNC_ENABLE" fi exit 0