#!<#PERLEXE#> -- # -*-Perl-*-

#=====================================================================
# userKit -                 sambaSync
#
# This script is run by the Ganymede server whenever the NTSambaBuilderTask
# is run and data relevant to the NTSambaBuilderTask has changed.
#
# The NTSambaBuilderTask included in the userKit src directory
#
# This script is expected to require hand-editing to suit your local
# configuration needs.
#
# Jonathan Abbey
#
# Released under GPL as part of the Ganymede network directory
# management system, http://www.arlut.utexas.edu/gash2
#
# Release: $Name: userKit_103 $
# Version: $Revision: 1.4 $
# Date: $Date: 2001/06/02 01:37:09 $
#
#=====================================================================

die "We require Perl 5.003 or greater to install Ganymede schema kit." if $] < 5.003;

use File::Copy;
use Cwd;
use English;

$root = "<#SCHEMAROOT#>";

# ------------ Vars
#

$generatedSambaPasswordFile = "$root/output/ntsamba/smb.passwd";

#
# You should uncomment the following line and edit it to set the
# $targetLocation variable to specify the location where
# your copy of Samba keeps its smbpasswd file.
#

#$targetLocation = "/opt/depot/samba-1.9.18p10/private/smbpasswd";

#
# ------------ End Vars

print "Executing Samba Sync\n";

# Don't background anything here.. Ganymede Builder Tasks are meant to
# run external scripts synchronously, on a separate thread.  We want to
# block until we complete here so that the Ganymede server can avoid
# running multiple instances of a given build simultaneously.

if (-f $generatedSambaPasswordFile && defined $targetLocation) {
    copy("$generatedSambaPasswordFile $targetLocation");
    chmod(0600, $targetLocation);
}

print "Done with Samba Sync\n";

exit 0;
