#!/usr/local/bin/perl
#
# $Header: createsusetempfolder.pl 26-oct-2006.06:18:42 ssdas Exp $
#
# createsusetempfolder.pl
#
# Copyright (c) 2005, 2006, Oracle. All rights reserved.  
#
#    NAME
#      createsusetempfolder.pl - <one-line expansion of the name>
#
#    DESCRIPTION
#      <short description of component this file declares/defines>
#
#    NOTES
#      <other useful comments, qualifications, etc.>
#
#    MODIFIED   (MM/DD/YY)
#    ssdas        10/26/06 - changing the ownership of the directory
#    ssdas        08/09/06 - 
#    gaurgupt     07/17/06 - Creation
#

my $temp_folder=$ARGV[0];
my $rpms_folder=$ARGV[1];
my $username=$ARGV[3];

my $pathSeperator="/";
my $exitstatus;

mkdir $temp_folder;

my $rpms_path=$temp_folder.$pathSeperator.$rpms_folder;
my $create_rpm_cmd="mkdir -p $rpms_path";
system($create_rpm_cmd);
$exitstatus = $? >> 8;
if ($exitstatus == 0)
        {
            $command="chown -R $username $temp_folder";
            system($command);
            exit ($? >> 8);
        }

exit $exitstatus;
