#!/bin/sh # # PROVIDE: btsync # REQUIRE: LOGIN DAEMON NETWORKING # KEYWORD: shutdown # # To enable BTSync, add this line to your /etc/rc.conf: # # btsync_enable="YES" # # And optionally these line: # # btsync_user="username" # Default is "root" # btsync_bin="/path/to/btsync" # Default is "/usr/local/sbin/btsync" . /etc/rc.subr name="btsync" rcvar="btsync_enable" load_rc_config $name required_files=$btsync_bin : ${btsync_enable="NO"} : ${btsync_user="root"} : ${btsync_bin="/usr/local/bin/${name}"} HOMEDIR=`getent passwd $btsync_user | cut -d: -f6` echo $HOMEDIR if [ -d $HOMEDIR/.config ]; then command="su -l $btsync_user -c \"$btsync_bin --config $HOMEDIR/.config/btsync/config.json\"" fi echo $command run_rc_command "$1"