FreeNAS Code
This project has moved to github - see https://github.com/freenas
Brought to you by:
cochard,
mattolander
#!/bin/sh # Copyright (c) 2007 Volker Theile (votdev@gmx.de) # All rights reserved. # PROVIDE: rsyncd # REQUIRE: DAEMON # KEYWORD: shutdown # XQUERY: -i "count(//rsyncd/enable) > 0" -o "0" -b # RCVAR: rsyncd . /etc/rc.subr . /etc/configxml.subr name="rsyncd" rcvar=`set_rcvar` # Custom commands start_precmd="create_conf" # Defaults rsyncd_enable=${rsyncd_enable:-"NO"} rsyncd_config=${rsyncd_config:-"/var/etc/${name}.conf"} rsyncd_motd=${rsyncd_motd:-"/var/etc/rsyncd.motd"} command="/usr/local/bin/rsync" command_args="--daemon --config=${rsyncd_config}" pidfile="/var/run/${name}.pid" create_conf() { local _motd # Create rsyncd.conf file. /usr/local/bin/xml sel -t -m "//rsyncd" \ -v "concat('read only = ',readonly)" -n \ -o "syslog facility = local4" -n \ -o "list = yes" -n \ -v "concat('port = ',port)" -n \ -o "pid file = ${pidfile}" -n \ -i "string-length(maxcon) > 0" -v "concat('max connections = ',maxcon)" -n -b \ -i "string-length(motd) > 0" -o "motd file = ${rsyncd_motd}" -n -b \ -i "count(rsyncd_user) > 0" -v "concat('uid = ',rsyncd_user)" -n -b \ -i "count(rsyncd_user) = 0" -o "uid = ftp" -n -o "gid = ftp" -n -b \ -m "//mounts/mount" \ -n -v "concat('[',sharename,']')" -n \ -v "concat('comment = ',desc)" -n \ -v "concat('path = /mnt/',sharename)" -n \ -b \ ${configxml_file} | /usr/local/bin/xml unesc > ${rsyncd_config} # Create MOTD file. _motd=`configxml_get "//rsyncd/motd"` if [ -n "${_motd}" ]; then echo "${_motd}" > ${rsyncd_motd} fi } load_rc_config $name run_rc_command "$1"