CHips L MINI SHELL

CHips L pro

Current Path : /proc/2/root/usr/local/rvglobalsoft/rvglobalsoft/auto/
Upload File :
Current File : //proc/2/root/usr/local/rvglobalsoft/rvglobalsoft/auto/real_autorvglobalsoft.cgi

#!/usr/bin/perl
##LICENSE##

use strict;
use warnings;
use Socket;
use File::Basename;
use Data::Dumper;


my $inst = RVGlobalSoftRealInstaller->new(programName => 'rvglobalsoft', INSTALLTITLE => 'RVGlobalSoft Package Installer');

#require reqPackage to call another
$inst->{'reqPackage'} = 'rvglobalsoft-package';

#setup reqPackage information
$inst->setInstallPackage("$inst->{'reqPackage'}.ProductName", 'RVGlobalSoft');
$inst->setInstallPackage("$inst->{'reqPackage'}.ProductCode", 'rvglobalsoft-package');
$inst->setInstallPackage("$inst->{'reqPackage'}.SaveFilename", 'rvglobalsoft.tar.bz2');

#setup for installer
$inst->setInstallPackage("$inst->{'reqPackage'}.auto.installer", 'autorvglobalsoft');
$inst->setInstallPackage("$inst->{'reqPackage'}.auto.real", 'real_autorvglobalsoft');

#override default functionConfig to extend call function
#$inst->setFunctionConfig("begin.next", 'LicenseInfo'); #test
#add new functionConfig that already override from previous

#validate rvglobalsoft license
#$inst->setFunctionConfig("LicenseInfo.next", 'LicenseInfoGet');
#$inst->setFunctionConfig("LicenseInfo.group", 'LicenseInfo');
#$inst->setFunctionConfig("LicenseInfoGet.next", 'LicenseInfoType');
#$inst->setFunctionConfig("LicenseInfoGet.group", 'LicenseInfo');
#$inst->setFunctionConfig("LicenseInfoType.next", 'LicenseInfoExp');
#$inst->setFunctionConfig("LicenseInfoType.group", 'LicenseInfo');
#$inst->setFunctionConfig("LicenseInfoExp.next", 'ValidateRVManager');
#$inst->setFunctionConfig("LicenseInfoExp.group", 'LicenseInfo');

#validate pass, require to install rvmanager
#$inst->setFunctionConfig("ValidateRVManager.next", 'installRVGlobalSoftUI');
#$inst->setFunctionConfig("ValidateRVManager.group", 'UpdateInstaller');

#fallback to main installer for rvglobalsoft
$inst->setFunctionConfig("installRVGlobalSoftUI.next", 'DownloadInstaller');
$inst->setFunctionConfig("installRVGlobalSoftUI.group", 'UpdateInstaller');
#override next function for SetupInstaller
$inst->setFunctionConfig("SetupInstaller.next", 'ConfigAndSetupRVGlobalSoft');

$inst->setFunctionConfig("ConfigAndSetupRVGlobalSoft.next", 'buildcpan');
$inst->setFunctionConfig("ConfigAndSetupRVGlobalSoft.group", 'UpdateInstaller');

#แยกการ install เป็น line product แทน
#$inst->setFunctionConfig("InstallSSLProduct.next", 'InstallSymantecVIP');
#$inst->setFunctionConfig("InstallSSLProduct.group", 'UpdateInstaller');
#$inst->setFunctionConfig("InstallSymantecVIP.next", 'buildcpan');
#$inst->setFunctionConfig("InstallSymantecVIP.group", 'UpdateInstaller');

#$inst->setFunctionConfig("buildcpan.next", 'GetLicense');
$inst->setFunctionConfig("buildcpan.next", 'end');
$inst->setFunctionConfig("buildcpan.group", 'UpdateInstaller');



#install license file
#$inst->setFunctionConfig("GetLicense.next", 'GetLicenseDow');
#$inst->setFunctionConfig("GetLicense.group", 'GetLicense');
#$inst->setFunctionConfig("GetLicenseDow.next", 'GetLicenseFile');
#$inst->setFunctionConfig("GetLicenseDow.group", 'GetLicense');
#$inst->setFunctionConfig("GetLicenseFile.next", 'end');
#$inst->setFunctionConfig("GetLicenseFile.group", 'GetLicense');


$inst->startInstaller();

$inst->exitScript();
























package RVGlobalSoftRealInstaller;
use strict;
use warnings;
use File::Basename;
use Data::Dumper;
use IPC::Open3;
BEGIN {
    push(@INC, dirname(__FILE__));
}
use base qw(RVSInstaller);
{
    sub new {
        my $class = shift;
        my $self = $class->SUPER::new( @_ );
        
        bless $self, $class;
        return $self;
    }
    
    sub Process_SetupInstaller_uncompressFile {
        my $self = shift;
        
        system($self->{'cmd'}->{'tar'} . ' -jxvf ' . $self->getInstallPackage("$self->{'reqPackage'}.SaveFilename")) if(-f $self->getInstallPackage("$self->{'reqPackage'}.SaveFilename"));
    	return 1;
    	
#        my @logTarData = ();
#        #TODO uncompress solution
#        chdir($self->getInstallConfig('sourcePath'));
#        my $pid3 = open3(*CMD_IN, *CMD_OUT, *CMD_ERR, $self->{'cmd'}->{'tar'} . ' -jxvf ' . $self->getInstallPackage("$self->{'reqPackage'}.SaveFilename"));
#        waitpid($pid3, 0);
#        close(CMD_IN);
#        my @errs = <CMD_ERR>;
#        close(CMD_ERR);
#        if (@errs) { 
#            my $errMsg = join("", @errs);
#                $errMsg=~s/\n$//;
#                $self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{failedColor}");
#                $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Failed'));
#                $self->{ScreenControl}->DisplayMsg("\e[0m ]", 1);
#                $self->{ScreenControl}->DisplayMsg('', 1);
#                $self->{ScreenControl}->DisplayMsg("$self->{failedColor}");
#                $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Sorry') . ', '.$errMsg, 0, 'subMsg' . $self->{ACTION}, '', '#FF0000');
#                $self->{ScreenControl}->DisplayMsg("\e[0m", 1);
#                $self->{ScreenControl}->LogMsg('Uncompress the package has been uncompleted, ' . $errMsg . ".\n");
#                $self->exitScript();
#        } else {
#            while (my $pData = <CMD_OUT>) {
#                $pData=~s/\r|\n//gi;
#                $self->{ScreenControl}->DisplayMsg($pData , '1', 'subMsg' . $self->{ACTION});
#                $self->{ScreenControl}->LogMsg($pData . "\n");
#                push(@logTarData, $pData);
#            }
#            close(CMD_OUT); 
#        }
#        
#        my $chData = 1;
#        my $errorMsg = '';
#        foreach my $data ( @logTarData ) {
#            if ( $data =~ m/\/$/) {
#                if ( !-d $data) {
#                    $errorMsg = sprintf("%s %s %s", $self->{Language}->TranSlate('the folder'), $data, $self->{Language}->TranSlate('cannot uncompressed'));
#                    $chData = 0;
#                    last;
#                }
#            }
#            else {
#                if ( !-e $data) {
#                    $errorMsg = sprintf("%s %s %s", $self->{Language}->TranSlate('the file'), $data, $self->{Language}->TranSlate('cannot uncompressed'));
#                    $chData = 0;
#                    last;
#                }
#            }
#        }
#        
#        chdir($self->getInstallConfig('thisPath'));
#        if ( !$chData ) {
#            $self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{failedColor}");
#            $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Failed'));
#            $self->{ScreenControl}->DisplayMsg("\e[0m ]", 1);
#            $self->{ScreenControl}->DisplayMsg('', 1);
#            $self->{ScreenControl}->DisplayMsg("$self->{failedColor}");
#            $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Sorry') . ', ' . $errorMsg . '.', 1, 'subMsg' . $self->{ACTION}, '', '#FF0000');
#            $self->{ScreenControl}->DisplayMsg("\e[0m", 1);
#            $self->{ScreenControl}->LogMsg('Uncompress the package has been uncompleted, ' . $errorMsg . ".\n");
#            $self->exitScript();
#        }
#        else {
#            if ( -e $self->getInstallPackage("$self->{'reqPackage'}.SaveFilename")) {
#                unlink($self->getInstallPackage("$self->{'reqPackage'}.SaveFilename"));
#            }
#            if ( -e $self->getInstallPackage("$self->{'reqPackage'}.SaveFilename")) {
#                unlink($self->getInstallPackage("$self->{'reqPackage'}.SaveFilename"));
#            }
#            
#            $self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{completedColor}");
#            $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Completed') , '', 'subMsg' . $self->{ACTION});
#            $self->{ScreenControl}->DisplayMsg("\e[0m ]", 1);
#            $self->{ScreenControl}->LogMsg('Uncompress the package has been completed' . "\n");
#        }
    }
    
    sub Process_SetupInstaller_rsyncFileAfterUncompress {
        my $self = shift;
        
        #avoid rsync to sync zip package
        my $packageFile = sprintf("%s/%s", $self->getInstallConfig('sourcePath'), $self->getInstallPackage("$self->{'reqPackage'}.SaveFilename"));
        if (-f $packageFile) {
            unlink($packageFile);
        }
        
        system($self->{'cmd'}->{'rsync'} . ' -avz --timeout=60 ' . $self->getInstallConfig('sourcePath') . '/ ' . $self->getInstallConfig('thisPath'));
        return 1;
        
#        my $pid3 = open3(*CMD_IN, *CMD_OUT, *CMD_ERR, $self->{'cmd'}->{'rsync'} . ' -avz --timeout=60 ' . $self->getInstallConfig('sourcePath') . '/ ' . $self->getInstallConfig('thisPath'));
#        waitpid($pid3, 0);
#        close(CMD_IN);
#        my @errs = <CMD_ERR>;
#        close(CMD_ERR);
#        if (@errs) {
#            my $errMsg = join("", @errs);
#            $errMsg=~s/\n$//;
#            $self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{failedColor}");
#            $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Failed'));
#            $self->{ScreenControl}->DisplayMsg("\e[0m ]", 1);
#            $self->{ScreenControl}->DisplayMsg('', 1);
#            $self->{ScreenControl}->DisplayMsg("$self->{failedColor}");
#            $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Sorry') . ', '.$errMsg, 0, 'subMsg' . $self->{ACTION}, '', '#FF0000');
#            $self->{ScreenControl}->DisplayMsg("\e[0m", 1);
#            $self->{ScreenControl}->LogMsg("Rsync the package has not completed, $errMsg.\n");
#            $self->exitScript();
#        } else {
#            while (my $rsyncData = <CMD_OUT>) {
#                $rsyncData=~s/\r|\n//gi;
#                $self->{ScreenControl}->DisplayMsg($rsyncData, 1, 'subMsg' . $self->{ACTION});
#                $self->{ScreenControl}->LogMsg($rsyncData . "\n");
#            }
#            close(CMD_OUT);
#        }
    }
    
    sub Process_installRVGlobalSoftUI {
        my $self = shift;
        my $param = shift;
        my %hParam = %{$param};
        #just for naming package no process in this part
        
        $self->callNextFunc(\%hParam);
    }
    
    sub Process_ConfigAndSetupRVGlobalSoft {
        my $self = shift;
        my $param = shift;
        my %hParam = RVSInstaller::Process::UnSerializerData($param);
        
        $self->{ScreenControl}->DisplayMsg('', 1);
        $self->{ScreenControl}->DisplayMsg('########################################################################', 1);
        $self->{ScreenControl}->DisplayMsg("#\t\t" . "Configure setup for ".$self->getInstallPackage("$inst->{'reqPackage'}.ProductName") . '.', 1);
        $self->{ScreenControl}->DisplayMsg('########################################################################', 1);
        $self->{ScreenControl}->LogMsg("Configure setup for ".$self->getInstallPackage("$inst->{'reqPackage'}.ProductName") . "\n");
        
        $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Configuring CPAN path...') , '', 'subMsg' . $self->{ACTION});
        my $indexFile = $self->getInstallConfig('thisPath').'/public_html/index.cgi';
        my %configStatus = ();
        if (open(my $fh, '<', $indexFile)) {
            my @data = <$fh>;
            close($fh);
            
            my $strData = join('', @data);
            
            my $find = '@CPAN\-PATH@';
            my $replace = $self->getInstallConfig('libPath')."/lib/perl5";
            
            $strData =~ s/$find/$replace/g; 
            if (open(my $wh, '>', $indexFile)) {
                print $wh $strData;
                close($wh);
            } else {
                $configStatus{'Err'} = $!;
            }
        } else {
            $configStatus{'Err'} = $!;
        }
        
        if (!defined($configStatus{'Err'})) {
            $self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{completedColor}");
            $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Completed') , '', 'subMsg' . $self->{ACTION});
            $self->{ScreenControl}->DisplayMsg("\e[0m ]", 1);
            $self->{ScreenControl}->LogMsg('Configure CPAN path has been completed' . "\n");
        } else {
            $self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{failedColor}");
            $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Failed') , '', 'subMsg' . $self->{ACTION});
            $self->{ScreenControl}->DisplayMsg(" ]\e[0m", 1);
            $self->{ScreenControl}->LogMsg('Configure CPAN path has error ' . $configStatus{'Err'} . ".\n");
            $self->exitScript();
        }
        
        #TODO ไฟล์ hostname.yaml จะระบุชื่อแบบไหน
        #create database for framework
#        my $hostname = RVSInstaller::Process::callBackticks("hostname");
#        chomp($hostname);
#        $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate("Updated Database Configuration") , '', 'subMsg' . $self->{ACTION});
#        my $installConfigPath = sprintf('%s/var/%s.yaml', $self->getInstallConfig('thisPath'), $hostname);
#        my $updateDBStatus = 0;
#        if (!-e $installConfigPath) {
#            $updateDBStatus = $self->autoCreateRVFrameworkDB('rvglobalsoft', 0);
#        } else {
#            $updateDBStatus = 1;
#        }
#        
#        if ($updateDBStatus) {
#            $self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{completedColor}");
#            $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Completed') , '', 'subMsg' . $self->{ACTION});
#            $self->{ScreenControl}->DisplayMsg("\e[0m ]", 1);
#            $self->{ScreenControl}->LogMsg('Updated Database Configuration completed' . "\n");
#        } else {
#            $self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{failedColor}");
#            $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Failed') , '', 'subMsg' . $self->{ACTION});
#            $self->{ScreenControl}->DisplayMsg(" ]\e[0m", 1);
#            $self->{ScreenControl}->LogMsg('Updated Database Configuration failed' . ".\n");
#            $self->exitScript();
#        }
#        
#        if (open(my $rh, '<', $installConfigPath)) {
#            my @data = <$rh>;
#            close($rh);
#            my $strData = join('', @data);
#            my $rvProductName = $self->getInstallPackage("$inst->{'reqPackage'}.ProductName");
#            $strData =~ s/name\: RV Perl Framework/name\: $rvProductName/;
#            $strData =~ s/defaultModule\: default/defaultModule\: rvglobalsoft/;
#            $strData =~ s/defaultManager\: default/defaultManager\: admin/;
#            $strData =~ s/defaultTheme\: default/defaultTheme\: RVS/;
#            if (open(my $wh, '>', $installConfigPath)) {
#                print $wh $strData;
#                close($wh);
#            }
#        }

        $self->callNextFunc(RVSInstaller::Process::SerializerData(\%hParam));
    }
    #TODO install ssl & vip
    sub Process_InstallSSLProduct {
        my $self = shift;
        my $param = shift;
        my %hParam = RVSInstaller::Process::UnSerializerData($param);
        
        $self->{ScreenControl}->DisplayMsg('', 1);
        $self->{ScreenControl}->DisplayMsg('########################################################################', 1);
        $self->{ScreenControl}->DisplayMsg("#\t\t" . "Download and Install SSL Product.", 1);
        $self->{ScreenControl}->DisplayMsg('########################################################################', 1);
        $self->{ScreenControl}->LogMsg("Download and Install SSL Product.\n");
        
        my $installCmd = 'mkdir -p /usr/local/rvglobalsoft/sslproduct;cd /usr/local/rvglobalsoft/sslproduct;rm -f sslproductauto.tar.bz2;wget http://download.rvglobalsoft.com/download.php/download/sslproduct-upgrade -O sslproductauto.tar.bz2;tar -jxvf sslproductauto.tar.bz2;chmod 755 /usr/local/rvglobalsoft/sslproduct/auto/autosslproduct.cgi;/usr/local/rvglobalsoft/sslproduct/auto/autosslproduct.cgi';
        system('cd','/');
        my $pid = open(HANDLE, "|$installCmd|");
        close(HANDLE);
        waitpid($pid, 0);
        
        if (-e '/usr/local/rvglobalsoft/sslproduct/modules/sslproduct') {
            if (!-e $self->getInstallConfig('thisPath') . '/modules/sslproduct') {
                symlink('/usr/local/rvglobalsoft/sslproduct/modules/sslproduct', $self->getInstallConfig('thisPath') . '/modules/sslproduct');
            }
        }
        
        $self->callNextFunc(\%hParam);
    }
    
    sub Process_InstallSymantecVIP {
        my $self = shift;
        my $param = shift;
        my %hParam = RVSInstaller::Process::UnSerializerData($param);
        
        $self->{ScreenControl}->DisplayMsg('', 1);
        $self->{ScreenControl}->DisplayMsg('########################################################################', 1);
        $self->{ScreenControl}->DisplayMsg("#\t\t" . "Download and Install SymantecVIP Product.", 1);
        $self->{ScreenControl}->DisplayMsg('########################################################################', 1);
        $self->{ScreenControl}->LogMsg("Download and Install SymantecVIP Product.\n");
        
        my $installCmd = 'mkdir -p /usr/local/rvglobalsoft/symantecvip;cd /usr/local/rvglobalsoft/symantecvip;rm -f symantecvipauto.tar.bz2;wget http://download.rvglobalsoft.com/download.php/download/symantecvip-upgrade -O symantecvipauto.tar.bz2;tar -jxvf symantecvipauto.tar.bz2;chmod 755 /usr/local/rvglobalsoft/symantecvip/auto/autosymantecvip.cgi;/usr/local/rvglobalsoft/symantecvip/auto/autosymantecvip.cgi';
        system('cd' , '/');
        my $pid = open(HANDLE, "|$installCmd|");
        close(HANDLE);
        waitpid($pid, 0);
        
        if (-e '/usr/local/rvglobalsoft/symantecvip/modules/symantecvip') {
            if (!-e $self->getInstallConfig('thisPath') . '/modules/symantecvip') {
                symlink('/usr/local/rvglobalsoft/symantecvip/modules/symantecvip', $self->getInstallConfig('thisPath') . '/modules/symantecvip');
            }
        }
        
        $self->callNextFunc(\%hParam);
    }
    
    sub Process_InstallRVManager{
#    	my $self = shift;
#        my $param = shift;
#        my %hParam = RVSInstaller::Process::UnSerializerData($param);
#        
#        $self->{ScreenControl}->DisplayMsg('', 1);
#        $self->{ScreenControl}->DisplayMsg('########################################################################', 1);
#        $self->{ScreenControl}->DisplayMsg("#\t\t" . "Download and Install RVManger Product.", 1);
#        $self->{ScreenControl}->DisplayMsg('########################################################################', 1);
#        $self->{ScreenControl}->LogMsg("Download and Install RVManager Product.\n");
#        
#        my $installCmd = '';
#        if(-d '/usr/local/rvglobalsoft/rvmanager' && -f '/usr/local/rvglobalsoft/rvmanager/rvmanagerauto.tar.bz2'){
#        	$installCmd = 'cd /usr/local/rvglobalsoft/rvmanager; rm -f rvmanagerauto.tar.bz2 ; wget http://download.rvglobalsoft.com/download.php/download/rvmanager-upgrade -O rvmanagerauto.tar.bz2; tar -jxvf rvmanagerauto.tar.bz2; chmod 755 /usr/local/rvglobalsoft/rvmanager/auto/real_autorvmanager.cgi; /usr/local/rvglobalsoft/rvmanager/auto/real_autorvmanager.cgi;'; 
#        } else {
#        	$installCmd = 'mkdir -p /usr/local/rvglobalsoft/rvmanager; cd /usr/local/rvglobalsoft/rvmanager; wget http://download.rvglobalsoft.com/download.php/download/rvmanager-upgrade -O rvmanagerauto.tar.bz2; tar -jxvf rvmanagerauto.tar.bz2; chmod 755 /usr/local/rvglobalsoft/rvmanager/auto/real_autorvmanager.cgi; /usr/local/rvglobalsoft/rvmanager/auto/real_autorvmanager.cgi;';
#        }
#        
#        my $pid = open(HANDLE, "|$installCmd|");
#        close(HANDLE);
#        waitpid($pid, 0);
#        
#        $self->callNextFunc(\%hParam);
    }
    
    
    sub Process_buildcpan {
        my $self = shift;
        my $param = shift;
        my %hParam = RVSInstaller::Process::UnSerializerData($param);
        
        $self->{ScreenControl}->DisplayMsg('', 1);
        $self->{ScreenControl}->DisplayMsg('########################################################################', 1);
        $self->{ScreenControl}->DisplayMsg("#\t\t" . "Download and Install CPAN.", 1);
        $self->{ScreenControl}->DisplayMsg('########################################################################', 1);
        $self->{ScreenControl}->LogMsg("Download and Install CPAN.\n");
        $self->{ScreenControl}->DisplayMsg('Waiting.........', 1);
        my ($perlPath) = RVSInstaller::Process::getPerlPath();
        my $programPath = $self->getInstallConfig('thisPath') . '/etc/buildcpan.pl';
#        my $pid3 = open3(*CMD_IN, *CMD_OUT, *CMD_ERR, $perlPath." ".$programPath);
#        waitpid($pid3, 0);
#        close(CMD_IN);
#        my @errs = <CMD_ERR>;
#        close(CMD_ERR);

		system($perlPath . " " . $programPath);
        
#       	my $printOutput = shift;
#        open( WNULL, ">/dev/null" );
#        open( RNULL, "</dev/null" );
#        my ( $pid ) = open3( "<&RNULL", \*PROG, ">&WNULL", $perlPath . " " . $programPath) || do {
#        				my ($warnMsg) = sprintf('%s: [%s]:%s','Error while executing', join( ' ', $perlPath . " " . $programPath));
#        				warn($warnMsg);
#                        return;
#       				};
#
#        my @output;
#        while(<PROG>) {
#            if ($printOutput) {
#                warn($_);
#            }
#        	print "$_ \n";
#        }
#        close(PROG);
#        close(RNULL);
#        close(WNULL);
        
        if(!-d $self->getInstallConfig('thisPath') . '/var'){
        	RVSInstaller::Process::mkdirp($self->getInstallConfig('thisPath') . '/var', "0755");
        }
        
        
        system('touch', $self->getInstallConfig('thisPath') . '/var/INSTALL_COMPLETE');
        
        if (-e '/usr/local/rvglobalsoft/symantecvip') {
        	system('touch', '/usr/local/rvglobalsoft/symantecvip/var/INSTALL_COMPLETE');
        }
            
        if (-e '/usr/local/rvglobalsoft/sslproduct') {
        	system('touch', '/usr/local/rvglobalsoft/sslproduct/var/INSTALL_COMPLETE');
        }
        
        $self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{completedColor}");
        $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Completed') , '', 'subMsg' . $self->{ACTION});
        $self->{ScreenControl}->DisplayMsg("\e[0m ]", 1);
        
        $self->callNextFunc(\%hParam);
    }
    
    sub Process_end {
        my $self = shift;
        
        $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Changes the permissions of files and making Symlink path') , '', 'subMsg' . $self->{ACTION});
        
        #create global libPath if not exist
        my $defaultRVGlobalPerlLib = $self->getInstallConfig('libPath')."/perl5";
        if (!-e $defaultRVGlobalPerlLib) {
            RVSInstaller::Process::mkdirp($defaultRVGlobalPerlLib, "0755");
        }
        
        #chmod data
        chmod(0755, $defaultRVGlobalPerlLib);
        chmod(0755, $self->getInstallConfig('thisPath')."/public_html/index.cgi");
        chmod(0700, $self->getInstallConfig('thisPath').'/public_html/activatervglobalsoft.cgi');
        chmod(0700, $self->getInstallConfig('thisPath').'/public_html/activating.cgi');
        
        #make symlink path to libpath
        if (!-l $self->getInstallConfig('thisPath')."/lib/perl5") {
            symlink($defaultRVGlobalPerlLib, $self->getInstallConfig('thisPath')."/lib/perl5");
        }
        
        #create symlink to cgi path
        if ($self->getInstallConfig('cpMode') eq 'Cpanel') {
            if (!-l '/usr/local/cpanel/whostmgr/cgi/'.$self->{'programName'}) {
                symlink($self->getInstallConfig('thisPath').'/public_html', '/usr/local/cpanel/whostmgr/cgi/'.$self->{'programName'});
            }
                      
        }
        
        #replace include path for rvcrypt
        if(-f '/usr/local/rvglobalsoft/rvglobalsoft/bin/rvcrypt'){
        	open(my $FD3, '<', '/usr/local/rvglobalsoft/rvglobalsoft/bin/rvcrypt');
		    my ($newCode3) = '';
		    while (<$FD3>) {
		    	my $line = $_;
		        $line =~ s/^\#\!\/usr\/bin\/env php/\#\!\/usr\/local\/cpanel\/3rdparty\/bin\/php/g;         
		        $newCode3 .= $line; 
		    }
		    close($FD3);
		    open(my $FW3, '>', '/usr/local/rvglobalsoft/rvglobalsoft/bin/rvcrypt');
		    print $FW3 $newCode3;
		    close($FW3);
        }
        
        #replace include path for openssl_decode
        if(-f '/usr/local/rvglobalsoft/rvglobalsoft/bin/openssl_decode'){
            open(my $FD3, '<', '/usr/local/rvglobalsoft/rvglobalsoft/bin/openssl_decode');
            my ($newCode3) = '';
            while (<$FD3>) {
                my $line = $_;
                $line =~ s/^\#\!\/usr\/bin\/env php/\#\!\/usr\/local\/cpanel\/3rdparty\/bin\/php/g;
                $newCode3 .= $line; 
            }
            close($FD3);
            open(my $FW3, '>', '/usr/local/rvglobalsoft/rvglobalsoft/bin/openssl_decode');
            print $FW3 $newCode3;
            close($FW3);
        }
        
        
        if(-f '/usr/local/rvglobalsoft/rvglobalsoft/auto/installcpan.sh'){
        	system('cp','/usr/local/rvglobalsoft/rvglobalsoft/auto/installcpan.sh','/root/');
        	system('chmod','+x','/root/installcpan.sh');
        	system('/root/installcpan.sh')
        }
        
        $self->{ScreenControl}->DisplayMsg("<TAB>[ $self->{completedColor}");
        $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate('Completed') , '', 'subMsg' . $self->{ACTION});
        $self->{ScreenControl}->DisplayMsg("\e[0m ]", 1);
        
        
        if ( -d $self->getInstallConfig('sourcePath')) {
            RVSInstaller::Process::unlinkAll($self->getInstallConfig('sourcePath'));
        }
        
        #if register success
        $self->{ScreenControl}->DisplayMsg($self->{Language}->TranSlate("Install ".$self->getInstallPackage("$inst->{'reqPackage'}.ProductName")." has completed") .'.', 1, 'msg' . $self->{ACTION});
        
        $self->exitScript();
    }
}

Copyright 2K16 - 2K18 Indonesian Hacker Rulez