#
# Copyright C 2003 Sun Microsystems, Inc.
# All rights reserved. Use is subject to license terms.
#
# 
# Sun, Sun Microsystems, and the Sun logo are trademarks or registered
# trademarks of Sun Microsystems, Inc. in the United States and other
# countries.
# 
# Federal Acquisitions: Commercial Software--Government Users Subject to
# Standard License Terms and Conditions
#

namespace eval dps52svrUnix {
    
    proc main { xName } {
	upvar $xName x

	if [spanInstall x] {
	    set cwd [pwd]
	    set wd [file join $x(root) setup]
	    mkdir $wd 0755
	    cd $wd
	    if [file exists dps] {
	    } else {
		file copy [file join $x(currentInstallDirectory) setup dps] .
	    }
	    cd [file join $x(root) bin]
	    if [file exist dps] {
		if [file isdirectory dps] {
		} else {
		    error "Expected [file join $x(root) bin dps] to be a directory."
		}
	    } else {
		mkdir [file join $x(root) bin dps] 0755

		cd [file join $x(root) bin dps]
		mkdir [file join $x(root) bin dps server] 0755
		exec ln -s [file join $x(currentInstallDirectory) bin dps admin] admin
		exec ln -s [file join $x(currentInstallDirectory) bin dps install] install
		exec ln -s [file join $x(currentInstallDirectory) bin dps COPYRIGHT] COPYRIGHT
		exec ln -s [file join $x(currentInstallDirectory) bin dps license.txt] license.txt

		cd [file join $x(root) bin dps server]
		mkdir [file join $x(root) bin dps server bin] 0755
		exec ln -s [file join $x(currentInstallDirectory) bin dps server script] script

		cd [file join $x(root) bin dps server bin]
		exec ln -s [file join $x(currentInstallDirectory) bin dps server bin dpsAsks.txt] dpsAsks.txt
		exec ln -s [file join $x(currentInstallDirectory) bin dps server bin dpsAsks_en.txt] dpsAsks_en.txt
		exec ln -s [file join $x(currentInstallDirectory) bin dps server bin ldapfwd] ldapfwd
	    }
	    cd $cwd
	}

	return [expr 0]
    }
}
