#!/usr/bin/perl

# get the current dir
use Cwd;
my $cwd = &Cwd::cwd();

use File::Basename;
# find out where this script resides
my $basedir = dirname($0);
my $scriptToRun = 'include/installAgent.pl';

if ( $] lt 5.006 ) {
    print("Note: This system is running Perl version $]. The Automate Schedule Agent\n");
    print("    installer works best with Perl 5.6.0 or later.\n");
    print("\n");
    $scriptToRun = 'include/installAgent.sh';
}

if (! $basedir eq $pwd ) {
    # change dir and launch the installer
    chdir $basedir; 
    exec("$scriptToRun @ARGV");
    exit 0;
}

# start the installer
exec("$scriptToRun @ARGV");

